diff options
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.cc | 24 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_unittests.cc | 4 |
2 files changed, 17 insertions, 11 deletions
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index 4912901..54d18de 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -114,29 +114,35 @@ END_MSG_MAP() if (NULL == Create(NULL, NULL, NULL, WS_POPUP)) return AtlHresultFromLastError(); - static const int hotkey_id = 0x0000baba; + static const int kHotKeyId = 0x0000baba; + static const int kHotKeyWaitTimeout = 2000; SetWindowLongPtr(GWLP_USERDATA, reinterpret_cast<ULONG_PTR>(window)); - RegisterHotKey(m_hWnd, hotkey_id, 0, VK_F22); + RegisterHotKey(m_hWnd, kHotKeyId, 0, VK_F22); MSG msg = {0}; PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); - INPUT hotkey = {0}; - hotkey.type = INPUT_KEYBOARD; - hotkey.ki.wVk = VK_F22; - SendInput(1, &hotkey, sizeof(hotkey)); + SendVirtualKey(VK_F22, false); + // There are scenarios where the WM_HOTKEY is not dispatched by the + // the corresponding foreground thread. To prevent us from indefinitely + // waiting for the hotkey, we set a timer and exit the loop. + SetTimer(kHotKeyId, kHotKeyWaitTimeout, NULL); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); - if (WM_HOTKEY == msg.message) + if (msg.message == WM_HOTKEY) break; + else if (msg.message == WM_TIMER) { + SetForegroundWindow(window); + break; + } } - UnregisterHotKey(m_hWnd, hotkey_id); + UnregisterHotKey(m_hWnd, kHotKeyId); + KillTimer(kHotKeyId); DestroyWindow(); - return S_OK; } diff --git a/chrome_frame/test/chrome_frame_unittests.cc b/chrome_frame/test/chrome_frame_unittests.cc index cbacdb6..d43cd52 100644 --- a/chrome_frame/test/chrome_frame_unittests.cc +++ b/chrome_frame/test/chrome_frame_unittests.cc @@ -1506,9 +1506,9 @@ const wchar_t kChromeFrameAboutVersion[] = // with the chrome revision. The test finally checks for success by comparing // the URL of the window being opened with cf:about:version, which indicates // that the operation succeeded. -// Disabling this test as it is consistently failing on the builder. +// Marking this test FLAKY as it fails at times on the buildbot. // http://code.google.com/p/chromium/issues/detail?id=26549 -TEST_F(ChromeFrameTestWithWebServer, DISABLED_FullTabModeIE_AboutChromeFrame) { +TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_AboutChromeFrame) { TimedMsgLoop loop; CComObjectStackEx<MockWebBrowserEventSink> mock; |