diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 02:35:53 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 02:35:53 +0000 |
commit | 5dc70d8f0ef807f84c30e5e47655de2fcfdf84c4 (patch) | |
tree | 9aa1f2b4d4471cc3b754be9c1f48e6b0b14f24c5 /chrome_frame | |
parent | 418978d61a520f12d637f044ee2dfb34698bce90 (diff) | |
download | chromium_src-5dc70d8f0ef807f84c30e5e47655de2fcfdf84c4.zip chromium_src-5dc70d8f0ef807f84c30e5e47655de2fcfdf84c4.tar.gz chromium_src-5dc70d8f0ef807f84c30e5e47655de2fcfdf84c4.tar.bz2 |
Some more ChromeFrame test fixes to get the failing IE7 new window tests to pass. On IE7 the DocumentComplete
event is fired twice at times for popup windows. We need to add expectations for those.
TBR=stoyan
Review URL: http://codereview.chromium.org/2809031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/test/no_interference_test.cc | 70 | ||||
-rw-r--r-- | chrome_frame/test/test_mock_with_web_server.cc | 5 | ||||
-rw-r--r-- | chrome_frame/test/test_mock_with_web_server.h | 5 |
3 files changed, 66 insertions, 14 deletions
diff --git a/chrome_frame/test/no_interference_test.cc b/chrome_frame/test/no_interference_test.cc index e90dfe5..5e68c6f 100644 --- a/chrome_frame/test/no_interference_test.cc +++ b/chrome_frame/test/no_interference_test.cc @@ -143,13 +143,48 @@ TEST_F(NoInterferenceTest, FLAKY_JavascriptWindowOpen) { DelaySendMouseClickToIE(&mock_, &loop_, 0, 100, 100, simulate_input::LEFT))); - mock_.ExpectNewWindowWithIE(empty_page_url(), &new_window_mock); - EXPECT_CALL(new_window_mock, OnIELoad(testing::StrCaseEq(empty_page_url()))) + EXPECT_CALL(mock_, OnNewWindow3(_, _, _, _, _)); + + EXPECT_CALL(mock_, OnNewBrowserWindow(_, _)) + .WillOnce(testing::WithArgs<0>(testing::Invoke(CreateFunctor( + &new_window_mock, &MockWebBrowserEventSink::Attach)))); + + EXPECT_CALL(new_window_mock, OnBeforeNavigate2(_, + testing::Field(&VARIANT::bstrVal, + testing::StrCaseEq(empty_page_url())), + _, _, _, _, _)); + + EXPECT_CALL(new_window_mock, OnFileDownload(VARIANT_TRUE, _)) + .Times(testing::AnyNumber()); + + EXPECT_CALL(new_window_mock, OnNavigateComplete2(_, + testing::Field(&VARIANT::bstrVal, + testing::StrCaseEq(empty_page_url())))) .WillOnce(testing::DoAll( - VerifyAddressBarUrl(&new_window_mock), - CloseBrowserMock(&new_window_mock))); + testing::InvokeWithoutArgs(CreateFunctor(&new_window_mock, + &chrome_frame_test::MockWebBrowserEventSink::ExpectAddressBarUrl, + empty_page_url())), + DelayCloseBrowserMock(&loop_, 2000, &new_window_mock))); + + if (chrome_frame_test::GetInstalledIEVersion() == IE_7) { + // On IE7 the DocumentComplete fires twice for new windows. Hack to account + // for that. + testing::InSequence seq; + EXPECT_CALL(new_window_mock, + OnIELoad(testing::StrCaseEq(empty_page_url()))) + .Times(1); + + EXPECT_CALL(new_window_mock, + OnIELoad(testing::StrCaseEq(empty_page_url()))) + .Times(1); + } else { + EXPECT_CALL(new_window_mock, + OnIELoad(testing::StrCaseEq(empty_page_url()))) + .Times(1); + } + EXPECT_CALL(new_window_mock, OnQuit()) - .WillOnce(CloseBrowserMock(&mock_)); + .WillOnce(DelayCloseBrowserMock(&loop_, 2000, &mock_)); LaunchIEAndNavigate(kWindowOpenUrl); } @@ -228,10 +263,27 @@ TEST_F(NoInterferenceTest, FLAKY_SelectContextMenuOpenInNewWindow) { SelectItem(&loop_, 1500, open_new_window_index))); mock_.ExpectNewWindowWithIE(empty_page_url(), &new_window_mock); - // TODO(kkania): Verifying the address bar is flaky with this, at least - // on XP ie6. Fix. - EXPECT_CALL(new_window_mock, OnIELoad(testing::StrCaseEq(empty_page_url()))) - .WillOnce(CloseBrowserMock(&new_window_mock)); + if (chrome_frame_test::GetInstalledIEVersion() == IE_7) { + // On IE7 the DocumentComplete fires twice for new windows. Hack to account + // for that. + testing::InSequence seq; + EXPECT_CALL(new_window_mock, + OnIELoad(testing::StrCaseEq(empty_page_url()))) + .Times(1); + + // TODO(kkania): Verifying the address bar is flaky with this, at least + // on XP ie6. Fix. + EXPECT_CALL(new_window_mock, + OnIELoad(testing::StrCaseEq(empty_page_url()))) + .WillOnce(DelayCloseBrowserMock(&loop_, 2000, &new_window_mock)); + } else { + // TODO(kkania): Verifying the address bar is flaky with this, at least + // on XP ie6. Fix. + EXPECT_CALL(new_window_mock, + OnIELoad(testing::StrCaseEq(empty_page_url()))) + .WillOnce(DelayCloseBrowserMock(&loop_, 2000, &new_window_mock)); + } + EXPECT_CALL(new_window_mock, OnQuit()).WillOnce(CloseBrowserMock(&mock_)); LaunchIEAndNavigate(link_page_url()); diff --git a/chrome_frame/test/test_mock_with_web_server.cc b/chrome_frame/test/test_mock_with_web_server.cc index 59faaab..cef0b61d 100644 --- a/chrome_frame/test/test_mock_with_web_server.cc +++ b/chrome_frame/test/test_mock_with_web_server.cc @@ -177,11 +177,6 @@ ExpectationSet MockWebBrowserEventSink::ExpectNewWindowWithIE( } // namespace chrome_frame_test -ACTION_P3(DelayCloseBrowserMock, loop, delay, mock) { - loop->PostDelayedTask(FROM_HERE, NewRunnableMethod(mock, - &MockWebBrowserEventSink::CloseWebBrowser), delay); -} - ACTION_P(SetFocusToChrome, mock) { mock->SetFocusToChrome(); } diff --git a/chrome_frame/test/test_mock_with_web_server.h b/chrome_frame/test/test_mock_with_web_server.h index dfec957..fd684bb 100644 --- a/chrome_frame/test/test_mock_with_web_server.h +++ b/chrome_frame/test/test_mock_with_web_server.h @@ -128,6 +128,11 @@ ACTION_P4(DelaySendChar, loop, delay, c, mod) { simulate_input::SendCharA, c, mod), delay); } +ACTION_P3(DelayCloseBrowserMock, loop, delay, mock) { + loop->PostDelayedTask(FROM_HERE, NewRunnableMethod(mock, + &MockWebBrowserEventSink::CloseWebBrowser), delay); +} + } // namespace chrome_frame_test #endif // CHROME_FRAME_TEST_MOCK_WITH_WEB_SERVER_H_ |