Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: chrome_frame/test/navigation_test.cc

Issue 4866002: Fix flakiness... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome_frame/test/ui_test.cc » ('j') | chrome_frame/test/ui_test.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // This tests navigation to a typed URL containing an fragment. 70 // This tests navigation to a typed URL containing an fragment.
71 TEST_P(FullTabNavigationTest, TypeAnchorUrl) { 71 TEST_P(FullTabNavigationTest, TypeAnchorUrl) {
72 MockAccEventObserver acc_observer; 72 MockAccEventObserver acc_observer;
73 EXPECT_CALL(acc_observer, OnAccDocLoad(_)).Times(testing::AnyNumber()); 73 EXPECT_CALL(acc_observer, OnAccDocLoad(_)).Times(testing::AnyNumber());
74 AccObjectMatcher address_matcher(L"Address", L"editable text"); 74 AccObjectMatcher address_matcher(L"Address", L"editable text");
75 AccObjectMatcher go_matcher(L"Go*", L"push button"); 75 AccObjectMatcher go_matcher(L"Go*", L"push button");
76 76
77 ie_mock_.ExpectNavigation(IN_IE, GetSimplePageUrl()); 77 ie_mock_.ExpectNavigation(IN_IE, GetSimplePageUrl());
78 server_mock_.ExpectAndServeRequest(CFInvocation::None(), GetSimplePageUrl()); 78 server_mock_.ExpectAndServeRequest(CFInvocation::None(), GetSimplePageUrl());
79
79 // Enter the new url into the address bar. 80 // Enter the new url into the address bar.
80 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetSimplePageUrl()))) 81 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetSimplePageUrl())))
81 .WillOnce(testing::DoAll( 82 .WillOnce(testing::DoAll(
82 AccSetValueInBrowser(&ie_mock_, address_matcher, GetAnchorPageUrl(1)), 83 AccSetValueInBrowser(&ie_mock_, address_matcher, GetAnchorPageUrl(1)),
83 AccWatchForOneValueChange(&acc_observer, address_matcher))); 84 AccWatchForOneValueChange(&acc_observer, address_matcher)));
84 // Click the go button once the address has changed. 85 // Click the go button once the address has changed.
85 EXPECT_CALL(acc_observer, OnAccValueChange(_, _, GetAnchorPageUrl(1))) 86 EXPECT_CALL(acc_observer, OnAccValueChange(_, _, GetAnchorPageUrl(1)))
86 .WillOnce(AccLeftClickInBrowser(&ie_mock_, go_matcher)); 87 .WillOnce(AccDoDefaultActionInBrowser(&ie_mock_, go_matcher));
87 88
88 bool in_cf = GetParam().invokes_cf(); 89 bool in_cf = GetParam().invokes_cf();
89 ie_mock_.ExpectNavigation(in_cf, GetAnchorPageUrl(1)); 90 ie_mock_.ExpectNavigation(in_cf, GetAnchorPageUrl(1));
90 server_mock_.ExpectAndServeRequest(GetParam(), GetAnchorPageUrl(1)); 91 server_mock_.ExpectAndServeRequest(GetParam(), GetAnchorPageUrl(1));
91 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(GetAnchorPageUrl(1)))) 92 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(GetAnchorPageUrl(1))))
92 .WillOnce(CloseBrowserMock(&ie_mock_)); 93 .WillOnce(CloseBrowserMock(&ie_mock_));
93 94
94 LaunchIEAndNavigate(GetSimplePageUrl()); 95 LaunchIEAndNavigate(GetSimplePageUrl());
95 } 96 }
96 97
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 267
267 // We have gone a few steps back and forward, this should be enough for now. 268 // We have gone a few steps back and forward, this should be enough for now.
268 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(GetAnchorPageUrl(3)))) 269 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(GetAnchorPageUrl(3))))
269 .WillOnce(CloseBrowserMock(&ie_mock_)); 270 .WillOnce(CloseBrowserMock(&ie_mock_));
270 271
271 LaunchIEAndNavigate(GetAnchorPageUrl(0)); 272 LaunchIEAndNavigate(GetAnchorPageUrl(0));
272 } 273 }
273 274
274 // Test that a user cannot navigate to a restricted site and that the security 275 // Test that a user cannot navigate to a restricted site and that the security
275 // dialog appears. 276 // dialog appears.
276 TEST_P(FullTabNavigationTest, FLAKY_RestrictedSite) { 277 TEST_P(FullTabNavigationTest, RestrictedSite) {
277 if (!GetParam().invokes_cf() || GetInstalledIEVersion() == IE_8) { 278 // Add the server to restricted sites zone.
278 // Test has been disabled on IE8 bot because it hangs at times.
279 // http://crbug.com/47596
280 LOG(ERROR) << "Test disabled for this configuration.";
281 return;
282 }
283 MockWindowObserver win_observer_mock;
284
285 ScopedComPtr<IInternetSecurityManager> security_manager; 279 ScopedComPtr<IInternetSecurityManager> security_manager;
286 HRESULT hr = security_manager.CreateInstance(CLSID_InternetSecurityManager); 280 HRESULT hr = security_manager.CreateInstance(CLSID_InternetSecurityManager);
287 ASSERT_HRESULT_SUCCEEDED(hr); 281 ASSERT_HRESULT_SUCCEEDED(hr);
288 // Add the server to restricted sites zone.
289 hr = security_manager->SetZoneMapping(URLZONE_UNTRUSTED, 282 hr = security_manager->SetZoneMapping(URLZONE_UNTRUSTED,
290 GetTestUrl(L"").c_str(), SZM_CREATE); 283 GetTestUrl(L"").c_str(), SZM_CREATE);
291 284
292 EXPECT_CALL(ie_mock_, OnFileDownload(_, _)).Times(testing::AnyNumber()); 285 EXPECT_CALL(ie_mock_, OnFileDownload(_, _)).Times(testing::AnyNumber());
293 server_mock_.ExpectAndServeAnyRequests(GetParam()); 286 server_mock_.ExpectAndServeAnyRequests(GetParam());
294 287
295 const char* kAlertDlgCaption = "Security Alert"; 288 MockWindowObserver win_observer_mock;
296 289
297 EXPECT_CALL(ie_mock_, OnBeforeNavigate2( 290 // If the page is loaded in mshtml, then IE allows the page to be loaded
298 _, 291 // and just shows 'Restricted sites' in the status bar.
299 testing::Field(&VARIANT::bstrVal, testing::StrCaseEq(GetSimplePageUrl())), 292 if (!GetParam().invokes_cf()) {
300 _, _, _, _, _)) 293 ie_mock_.ExpectNavigation(IN_IE, GetSimplePageUrl());
301 .Times(1) 294 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetSimplePageUrl())))
302 .WillOnce(WatchWindow(&win_observer_mock, kAlertDlgCaption, "")); 295 .Times(1)
296 .WillOnce(CloseBrowserMock(&ie_mock_));
297 } else {
298 // If the page is being loaded in chrome frame then we will see
299 // a security dialog.
300 const char* kAlertDlgCaption = "Security Alert";
301 win_observer_mock.WatchWindow(kAlertDlgCaption, "");
303 302
304 EXPECT_CALL(ie_mock_, OnBeforeNavigate2( 303 EXPECT_CALL(ie_mock_, OnBeforeNavigate2(_, testing::Field(&VARIANT::bstrVal,
305 _, 304 testing::StrCaseEq(GetSimplePageUrl())), _, _, _, _, _))
306 testing::Field(&VARIANT::bstrVal, testing::HasSubstr(L"res://")), 305 .Times(1);
307 _, _, _, _, _)) 306 //.WillOnce(WatchWindow(&win_observer_mock, kAlertDlgCaption, ""));
ananta 2010/11/12 21:10:34 Remove?
308 .Times(testing::AtMost(1));
309 307
310 EXPECT_CALL(ie_mock_, OnNavigateComplete2(_, 308 EXPECT_CALL(ie_mock_, OnNavigateComplete2(_,
311 testing::Field(&VARIANT::bstrVal, StrEq(GetSimplePageUrl())))) 309 testing::Field(&VARIANT::bstrVal, StrEq(GetSimplePageUrl()))))
312 .Times(testing::AtMost(1)); 310 .Times(testing::AtMost(1));
313 311
314 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) 312 EXPECT_CALL(win_observer_mock, OnWindowOpen(_))
315 .Times(1) 313 .Times(1)
316 .WillOnce(DoCloseWindow()); 314 .WillOnce(DoCloseWindow());
317 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) 315 EXPECT_CALL(win_observer_mock, OnWindowClose(_))
318 .Times(1) 316 .Times(1)
319 .WillOnce(CloseBrowserMock(&ie_mock_)); 317 .WillOnce(CloseBrowserMock(&ie_mock_));
318 }
320 319
321 LaunchIEAndNavigate(GetSimplePageUrl()); 320 LaunchIEAndNavigate(GetSimplePageUrl());
322 321
323 ASSERT_HRESULT_SUCCEEDED(security_manager->SetZoneMapping(URLZONE_UNTRUSTED, 322 ASSERT_HRESULT_SUCCEEDED(security_manager->SetZoneMapping(URLZONE_UNTRUSTED,
324 GetTestUrl(L"").c_str(), SZM_DELETE)); 323 GetTestUrl(L"").c_str(), SZM_DELETE));
325 } 324 }
326 325
327 // This test checks if window.open calls with target blank issued for a 326 // This test checks if window.open calls with target blank issued for a
328 // different domain make it back to IE instead of completing the navigation 327 // different domain make it back to IE instead of completing the navigation
329 // within Chrome. We validate this by initiating a navigation to a non existent 328 // within Chrome. We validate this by initiating a navigation to a non existent
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 DelayRefresh(&ie_mock_, &loop_, 2000), 945 DelayRefresh(&ie_mock_, &loop_, 2000),
947 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_))); 946 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_)));
948 947
949 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(src_url))) 948 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(src_url)))
950 .Times(2); 949 .Times(2);
951 950
952 LaunchIEAndNavigate(src_url); 951 LaunchIEAndNavigate(src_url);
953 } 952 }
954 953
955 } // namespace chrome_frame_test 954 } // namespace chrome_frame_test
OLDNEW
« no previous file with comments | « no previous file | chrome_frame/test/ui_test.cc » ('j') | chrome_frame/test/ui_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698