diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 19:19:20 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 19:19:20 +0000 |
commit | 9c0179d3d912061206badb98ba39ad744020d67e (patch) | |
tree | d01546eda69b1ff83f8055f58f1424228546574e /chrome_frame | |
parent | 26d6e92975118c66047e7a3df83d6acf6c9b9db3 (diff) | |
download | chromium_src-9c0179d3d912061206badb98ba39ad744020d67e.zip chromium_src-9c0179d3d912061206badb98ba39ad744020d67e.tar.gz chromium_src-9c0179d3d912061206badb98ba39ad744020d67e.tar.bz2 |
The FullTabModeIE_ChromeFrameKeyboardTest test would never complete at times. This test fabricates keyboard
input to IE by forcing the IE window to the foreground. This is achieved by registering a hot key, sending
a keyboard message and waiting in a message loop for the hot key message. Apparently there are scenarios
where this hot key message is not dispatched at all and we end up waiting in the message loop for ever.
To get around this, we set a timer and if this fires we exit the loop.
TBR=amit
Review URL: http://codereview.chromium.org/406005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-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; |