diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 17:45:10 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 17:45:10 +0000 |
commit | 9e2f65a4250e757b6e3afb8b3b46ae24c2ab76d6 (patch) | |
tree | 8d53d75c9bfe110d457e0fb85d96060d0f9714b0 /chrome_frame/test | |
parent | bc01a196e4c809edaa5b42e166bfe65ffbac4647 (diff) | |
download | chromium_src-9e2f65a4250e757b6e3afb8b3b46ae24c2ab76d6.zip chromium_src-9e2f65a4250e757b6e3afb8b3b46ae24c2ab76d6.tar.gz chromium_src-9e2f65a4250e757b6e3afb8b3b46ae24c2ab76d6.tar.bz2 |
Fix the expectations for the ChromeFrame FullTabModeIE_BackForwardAnchor test to get it to work on IE6. It appears that on IE6
we don't receive the BeforeNavigate notifications for the anchor URLs.
Review URL: http://codereview.chromium.org/1568032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r-- | chrome_frame/test/data/anchor.html | 2 | ||||
-rw-r--r-- | chrome_frame/test/test_mock_with_web_server.cc | 37 | ||||
-rw-r--r-- | chrome_frame/test/test_mock_with_web_server.h | 3 |
3 files changed, 33 insertions, 9 deletions
diff --git a/chrome_frame/test/data/anchor.html b/chrome_frame/test/data/anchor.html index 2687982..7fde037 100644 --- a/chrome_frame/test/data/anchor.html +++ b/chrome_frame/test/data/anchor.html @@ -4,7 +4,7 @@ <TITLE> Chrome Frame Test </TITLE> </HEAD> <BODY> - Chrome trame in tab mode + Chrome frame in full tab mode Jump to different named sections here <a href="#a1">Jump to A1</a> diff --git a/chrome_frame/test/test_mock_with_web_server.cc b/chrome_frame/test/test_mock_with_web_server.cc index 9588618..518b28b 100644 --- a/chrome_frame/test/test_mock_with_web_server.cc +++ b/chrome_frame/test/test_mock_with_web_server.cc @@ -119,6 +119,29 @@ ExpectationSet MockWebBrowserEventSink::ExpectNavigation( return navigation; } +ExpectationSet MockWebBrowserEventSink::ExpectNavigationSequenceForAnchors( + const std::wstring& url) { + // When the onhttpequiv patch is enabled, we will get two + // BeforeNavigate2/OnNavigateComplete2 notifications due to + // switching from IE to CF. + // Note that when going backwards, we don't expect that since the extra + // navigational entries in the travel log should have been removed. + // On IE6 we don't receive the BeforeNavigate notifications for anchors. + ExpectationSet navigation; + navigation += EXPECT_CALL(*this, OnBeforeNavigate2(_, + testing::Field(&VARIANT::bstrVal, + testing::StrCaseEq(url)),_, _, _, _, _)) + .Times(testing::AnyNumber()); + navigation += EXPECT_CALL(*this, OnFileDownload(VARIANT_TRUE, _)) + .Times(testing::AnyNumber()); + navigation += EXPECT_CALL(*this, OnNavigateComplete2(_, + testing::Field(&VARIANT::bstrVal, + testing::StrCaseEq(url)))) + .Times(testing::AnyNumber()); + + return navigation; +} + ExpectationSet MockWebBrowserEventSink::ExpectNavigationAndSwitch( const std::wstring& url) { return ExpectNavigationCardinality(url, testing::AnyNumber()); @@ -689,8 +712,8 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_BackForwardAnchor) { .WillOnce(testing::DoAll( SetFocusToChrome(&mock), DelaySendString(&loop, 200, tab_enter_keys))); - mock.ExpectNavigation(kAnchor1Url); + mock.ExpectNavigationSequenceForAnchors(kAnchor1Url); // Navigate to anchor 2 after the previous navigation is complete // Back/Forward state at this point: // Back: 1 (kAnchorUrl) @@ -699,7 +722,7 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_BackForwardAnchor) { .WillOnce(testing::DoAll( VerifyAddressBarUrl(&mock), DelaySendString(&loop, 200, tab_enter_keys))); - mock.ExpectNavigation(kAnchor2Url); + mock.ExpectNavigationSequenceForAnchors(kAnchor2Url); // Navigate to anchor 3 after the previous navigation is complete // Back/Forward state at this point: @@ -709,7 +732,7 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_BackForwardAnchor) { .WillOnce(testing::DoAll( VerifyAddressBarUrl(&mock), DelaySendString(&loop, 200, tab_enter_keys))); - mock.ExpectNavigation(kAnchor3Url); + mock.ExpectNavigationSequenceForAnchors(kAnchor3Url); // We will reach anchor 3 once the navigation is complete, // then go back to anchor 2 @@ -721,7 +744,7 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_BackForwardAnchor) { VerifyAddressBarUrl(&mock), testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor( ReceivePointer(mock.web_browser2_), &IWebBrowser::GoBack))))); - mock.ExpectNavigation(kAnchor2Url); + mock.ExpectNavigationSequenceForAnchors(kAnchor2Url); // We will reach anchor 2 once the navigation is complete, // then go back to anchor 1 @@ -733,7 +756,7 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_BackForwardAnchor) { VerifyAddressBarUrl(&mock), testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor( ReceivePointer(mock.web_browser2_), &IWebBrowser::GoBack))))); - mock.ExpectNavigation(kAnchor1Url); + mock.ExpectNavigationSequenceForAnchors(kAnchor1Url); // We will reach anchor 1 once the navigation is complete, // now go forward to anchor 2 @@ -745,7 +768,7 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_BackForwardAnchor) { VerifyAddressBarUrl(&mock), testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor( ReceivePointer(mock.web_browser2_), &IWebBrowser::GoForward))))); - mock.ExpectNavigation(kAnchor2Url); + mock.ExpectNavigationSequenceForAnchors(kAnchor2Url); // We have reached anchor 2, go forward to anchor 3 again // Back/Forward state at this point: @@ -756,7 +779,7 @@ TEST_F(ChromeFrameTestWithWebServer, FLAKY_FullTabModeIE_BackForwardAnchor) { VerifyAddressBarUrl(&mock), testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor( ReceivePointer(mock.web_browser2_), &IWebBrowser::GoForward))))); - mock.ExpectNavigation(kAnchor3Url); + mock.ExpectNavigationSequenceForAnchors(kAnchor3Url); // We have gone a few steps back and forward, this should be enough for now. EXPECT_CALL(mock, OnLoad(testing::StrCaseEq(kAnchor3Url))) diff --git a/chrome_frame/test/test_mock_with_web_server.h b/chrome_frame/test/test_mock_with_web_server.h index fd21c99..c14a03f 100644 --- a/chrome_frame/test/test_mock_with_web_server.h +++ b/chrome_frame/test/test_mock_with_web_server.h @@ -82,7 +82,8 @@ class MockWebBrowserEventSink : public chrome_frame_test::WebBrowserEventSink { ExpectationSet ExpectNavigationAndSwitch(const std::wstring& url); ExpectationSet ExpectNavigationAndSwitchSequence(const std::wstring& url); ExpectationSet ExpectNewWindow(MockWebBrowserEventSink* new_window_mock); - + ExpectationSet MockWebBrowserEventSink::ExpectNavigationSequenceForAnchors( + const std::wstring& url); }; } // namespace chrome_frame_test |