WindowFinderTest.FindConsoleWindow is flaky on Win32 ASan

The root cause of the flakiness is unknown, the possible issue is that the
console window running the test case is hidden or minimized. So this change
adds a SetWindow(SW_MAXIMIZE) to ensure the console window is showing.

I have run the tests against win_asan for hundreds times during the
thanksgiving. So far, no flakiness were caught.

Bug: webrtc:8568
Change-Id: Ib2c93e9bd511257213254bdaa0079c14ea50f3e4
Reviewed-on: https://webrtc-review.googlesource.com/25286
Reviewed-by: Zijie He <zijiehe@chromium.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Zijie He <zijiehe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#20902}
This commit is contained in:
Zijie He
2017-11-27 16:27:15 -08:00
committed by Commit Bot
parent 99206df620
commit 8f00ad02fb

View File

@ -58,6 +58,9 @@ TEST(WindowFinderTest, FindConsoleWindow) {
// Enlarges current console window.
system("mode 1000,1000");
const HWND console_window = GetConsoleWindow();
// Ensures that current console window is visible.
ShowWindow(console_window, SW_MAXIMIZE);
// Moves the window to the top-left of the display.
MoveWindow(console_window, 0, 0, kMaxSize, kMaxSize, true);
// Brings console window to top.