Since the British guarantee to Poland March/April 1939, the possibility of an Anglo-French intervention had to be taken seriously. Hence planning for the Polish campaign proceeded on the basis that it be completed in as short a period as possible, so as to prevent Western intervention and avoid fighting on two fronts. But by May Hitler was still talking of a war with the West in 1943 and was confident that they would not go to war over Poland.
This was still true as late as 22 August when he briefed the Reich's military leaders on the Poland campaign. Western intervention was a risk, he admitted, but not a great one. And he was confident that even if they did intervene, Germany's relative strength was sufficient.
But the negotiations and diplomatic manoeuvres of the following days were frantic. On 25 August, London had formally ratified its military alliance with Warsaw. The same day France communicated to Berlin that it would honour its Polish commitments. Attempts at negotiation continued up to and beyond 1 Sept but the formal message was clear: Britain and France would stand by Poland.
So what did Hitler know? Whatever the signals earlier in the summer, by the end of August it must have been clear that Britain and France were not about to back down from their public commitments. Even Hitler, whose opinion of the Anglo-French political leadership was poor, could not expect London to sign a defence treaty and then renounce it a week later. What had once seemed improbable was now likely.
But then Hitler was a supreme gambler; it was just like him to stake it all on a weak reaction from Paris and London. He was probably surprised when the British didn't back down but he can't have been shocked. Nor had he ever been so delusional as to ignore the possibility.
As you'd expect, Kershaw's Hitler spends quite a few pages on this and the general lead-up to the war.