| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/scoped_comptr_win.h" | 7 #include "base/scoped_comptr_win.h" |
| 8 #include "base/test/test_file_util.h" | 8 #include "base/test/test_file_util.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome_frame/test/chrome_frame_test_utils.h" | 10 #include "chrome_frame/test/chrome_frame_test_utils.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 CFInvocation(CFInvocation::NONE))); | 38 CFInvocation(CFInvocation::NONE))); |
| 39 INSTANTIATE_TEST_CASE_P(MetaTag, FullTabNavigationTest, testing::Values( | 39 INSTANTIATE_TEST_CASE_P(MetaTag, FullTabNavigationTest, testing::Values( |
| 40 CFInvocation(CFInvocation::META_TAG))); | 40 CFInvocation(CFInvocation::META_TAG))); |
| 41 INSTANTIATE_TEST_CASE_P(HttpHeader, FullTabNavigationTest, testing::Values( | 41 INSTANTIATE_TEST_CASE_P(HttpHeader, FullTabNavigationTest, testing::Values( |
| 42 CFInvocation(CFInvocation::HTTP_HEADER))); | 42 CFInvocation(CFInvocation::HTTP_HEADER))); |
| 43 | 43 |
| 44 // This tests navigation to a typed URL. | 44 // This tests navigation to a typed URL. |
| 45 TEST_P(FullTabNavigationTest, TypeUrl) { | 45 TEST_P(FullTabNavigationTest, TypeUrl) { |
| 46 MockAccEventObserver acc_observer; | 46 MockAccEventObserver acc_observer; |
| 47 EXPECT_CALL(acc_observer, OnAccDocLoad(_)).Times(testing::AnyNumber()); | 47 EXPECT_CALL(acc_observer, OnAccDocLoad(_)).Times(testing::AnyNumber()); |
| 48 AccObjectMatcher address_matcher(L"Address", L"editable text"); | 48 AccObjectMatcher address_matcher(L"Address*", L"editable text"); |
| 49 AccObjectMatcher go_matcher(L"Go*", L"push button"); | 49 AccObjectMatcher go_matcher(L"Go*", L"push button"); |
| 50 | 50 |
| 51 ie_mock_.ExpectNavigation(IN_IE, GetSimplePageUrl()); | 51 ie_mock_.ExpectNavigation(IN_IE, GetSimplePageUrl()); |
| 52 server_mock_.ExpectAndServeRequest(CFInvocation::None(), GetSimplePageUrl()); | 52 server_mock_.ExpectAndServeRequest(CFInvocation::None(), GetSimplePageUrl()); |
| 53 // Enter the new url into the address bar. | 53 // Enter the new url into the address bar. |
| 54 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetSimplePageUrl()))) | 54 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetSimplePageUrl()))) |
| 55 .WillOnce(testing::DoAll( | 55 .WillOnce(testing::DoAll( |
| 56 AccSetValueInBrowser(&ie_mock_, address_matcher, GetAnchorPageUrl(0)), | 56 AccSetValueInBrowser(&ie_mock_, address_matcher, GetAnchorPageUrl(0)), |
| 57 AccWatchForOneValueChange(&acc_observer, address_matcher))); | 57 AccWatchForOneValueChange(&acc_observer, address_matcher))); |
| 58 // Click the go button once the address has changed. | 58 // Click the go button once the address has changed. |
| 59 EXPECT_CALL(acc_observer, OnAccValueChange(_, _, GetAnchorPageUrl(0))) | 59 EXPECT_CALL(acc_observer, OnAccValueChange(_, _, GetAnchorPageUrl(0))) |
| 60 .WillOnce(AccLeftClickInBrowser(&ie_mock_, go_matcher)); | 60 .WillOnce(AccLeftClickInBrowser(&ie_mock_, go_matcher)); |
| 61 | 61 |
| 62 bool in_cf = GetParam().invokes_cf(); | 62 bool in_cf = GetParam().invokes_cf(); |
| 63 ie_mock_.ExpectNavigation(in_cf, GetAnchorPageUrl(0)); | 63 ie_mock_.ExpectNavigation(in_cf, GetAnchorPageUrl(0)); |
| 64 server_mock_.ExpectAndServeRequest(GetParam(), GetAnchorPageUrl(0)); | 64 server_mock_.ExpectAndServeRequest(GetParam(), GetAnchorPageUrl(0)); |
| 65 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(GetAnchorPageUrl(0)))) | 65 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(GetAnchorPageUrl(0)))) |
| 66 .WillOnce(CloseBrowserMock(&ie_mock_)); | 66 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 67 | 67 |
| 68 LaunchIEAndNavigate(GetSimplePageUrl()); | 68 LaunchIEAndNavigate(GetSimplePageUrl()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // This tests navigation to a typed URL containing an fragment. | 71 // This tests navigation to a typed URL containing an fragment. |
| 72 TEST_P(FullTabNavigationTest, TypeAnchorUrl) { | 72 TEST_P(FullTabNavigationTest, TypeAnchorUrl) { |
| 73 MockAccEventObserver acc_observer; | 73 MockAccEventObserver acc_observer; |
| 74 EXPECT_CALL(acc_observer, OnAccDocLoad(_)).Times(testing::AnyNumber()); | 74 EXPECT_CALL(acc_observer, OnAccDocLoad(_)).Times(testing::AnyNumber()); |
| 75 AccObjectMatcher address_matcher(L"Address", L"editable text"); | 75 AccObjectMatcher address_matcher(L"Address*", L"editable text"); |
| 76 AccObjectMatcher go_matcher(L"Go*", L"push button"); | 76 AccObjectMatcher go_matcher(L"Go*", L"push button"); |
| 77 | 77 |
| 78 ie_mock_.ExpectNavigation(IN_IE, GetSimplePageUrl()); | 78 ie_mock_.ExpectNavigation(IN_IE, GetSimplePageUrl()); |
| 79 server_mock_.ExpectAndServeRequest(CFInvocation::None(), GetSimplePageUrl()); | 79 server_mock_.ExpectAndServeRequest(CFInvocation::None(), GetSimplePageUrl()); |
| 80 | 80 |
| 81 // Enter the new url into the address bar. | 81 // Enter the new url into the address bar. |
| 82 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetSimplePageUrl()))) | 82 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetSimplePageUrl()))) |
| 83 .WillOnce(testing::DoAll( | 83 .WillOnce(testing::DoAll( |
| 84 AccSetValueInBrowser(&ie_mock_, address_matcher, GetAnchorPageUrl(1)), | 84 AccSetValueInBrowser(&ie_mock_, address_matcher, GetAnchorPageUrl(1)), |
| 85 AccWatchForOneValueChange(&acc_observer, address_matcher))); | 85 AccWatchForOneValueChange(&acc_observer, address_matcher))); |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 &no_referrer_target_opener_window_mock)); | 1246 &no_referrer_target_opener_window_mock)); |
| 1247 | 1247 |
| 1248 EXPECT_CALL(no_referrer_target_opener_window_mock, OnQuit()) | 1248 EXPECT_CALL(no_referrer_target_opener_window_mock, OnQuit()) |
| 1249 .WillOnce(CloseBrowserMock(&ie_mock_)); | 1249 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 1250 | 1250 |
| 1251 LaunchIENavigateAndLoop(initial_url, | 1251 LaunchIENavigateAndLoop(initial_url, |
| 1252 kChromeFrameLongNavigationTimeoutInSeconds); | 1252 kChromeFrameLongNavigationTimeoutInSeconds); |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 } // namespace chrome_frame_test | 1255 } // namespace chrome_frame_test |
| OLD | NEW |