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

Side by Side Diff: chrome/browser/referrer_policy_browsertest.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jar, phajdan feedback Created 8 years, 6 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/string_number_conversions.h" 6 #include "base/string_number_conversions.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" 9 #include "chrome/browser/tab_contents/render_view_context_menu.h"
10 #include "chrome/browser/tab_contents/render_view_context_menu_browsertest_util. h" 10 #include "chrome/browser/tab_contents/render_view_context_menu_browsertest_util. h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // User initiated navigation, middle click, target blank, from HTTPS to HTTP. 247 // User initiated navigation, middle click, target blank, from HTTPS to HTTP.
248 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickTargetBlankOrigin) { 248 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickTargetBlankOrigin) {
249 RunReferrerTest("origin", true, true, false, true, 249 RunReferrerTest("origin", true, true, false, true,
250 WebKit::WebMouseEvent::ButtonMiddle, 250 WebKit::WebMouseEvent::ButtonMiddle,
251 EXPECT_ORIGIN_AS_REFERRER); 251 EXPECT_ORIGIN_AS_REFERRER);
252 } 252 }
253 253
254 // Context menu, from HTTP to HTTP. 254 // Context menu, from HTTP to HTTP.
255 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuOrigin) { 255 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuOrigin) {
256 ContextMenuNotificationObserver context_menu_observer( 256 ContextMenuNotificationObserver context_menu_observer(
257 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 257 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB);
258 chrome::NOTIFICATION_TAB_ADDED);
259 RunReferrerTest("origin", false, false, false, true, 258 RunReferrerTest("origin", false, false, false, true,
260 WebKit::WebMouseEvent::ButtonRight, 259 WebKit::WebMouseEvent::ButtonRight,
261 EXPECT_ORIGIN_AS_REFERRER); 260 EXPECT_ORIGIN_AS_REFERRER);
262 } 261 }
263 262
264 // Context menu, from HTTPS to HTTP. 263 // Context menu, from HTTPS to HTTP.
265 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuOrigin) { 264 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuOrigin) {
266 ContextMenuNotificationObserver context_menu_observer( 265 ContextMenuNotificationObserver context_menu_observer(
267 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 266 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB);
268 chrome::NOTIFICATION_TAB_ADDED);
269 RunReferrerTest("origin", true, false, false, true, 267 RunReferrerTest("origin", true, false, false, true,
270 WebKit::WebMouseEvent::ButtonRight, 268 WebKit::WebMouseEvent::ButtonRight,
271 EXPECT_ORIGIN_AS_REFERRER); 269 EXPECT_ORIGIN_AS_REFERRER);
272 } 270 }
273 271
274 // Content initiated navigation, from HTTP to HTTP via server redirect. 272 // Content initiated navigation, from HTTP to HTTP via server redirect.
275 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, Redirect) { 273 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, Redirect) {
276 RunReferrerTest("origin", false, false, true, false, 274 RunReferrerTest("origin", false, false, true, false,
277 WebKit::WebMouseEvent::ButtonNone, 275 WebKit::WebMouseEvent::ButtonNone,
278 EXPECT_ORIGIN_AS_REFERRER); 276 EXPECT_ORIGIN_AS_REFERRER);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, 342 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest,
345 HttpsMiddleClickTargetBlankRedirect) { 343 HttpsMiddleClickTargetBlankRedirect) {
346 RunReferrerTest("origin", true, true, true, true, 344 RunReferrerTest("origin", true, true, true, true,
347 WebKit::WebMouseEvent::ButtonMiddle, 345 WebKit::WebMouseEvent::ButtonMiddle,
348 EXPECT_ORIGIN_AS_REFERRER); 346 EXPECT_ORIGIN_AS_REFERRER);
349 } 347 }
350 348
351 // Context menu, from HTTP to HTTP via server redirect. 349 // Context menu, from HTTP to HTTP via server redirect.
352 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuRedirect) { 350 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuRedirect) {
353 ContextMenuNotificationObserver context_menu_observer( 351 ContextMenuNotificationObserver context_menu_observer(
354 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 352 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB);
355 chrome::NOTIFICATION_TAB_ADDED);
356 RunReferrerTest("origin", false, false, true, true, 353 RunReferrerTest("origin", false, false, true, true,
357 WebKit::WebMouseEvent::ButtonRight, 354 WebKit::WebMouseEvent::ButtonRight,
358 EXPECT_ORIGIN_AS_REFERRER); 355 EXPECT_ORIGIN_AS_REFERRER);
359 } 356 }
360 357
361 // Context menu, from HTTPS to HTTP via server redirect. 358 // Context menu, from HTTPS to HTTP via server redirect.
362 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuRedirect) { 359 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuRedirect) {
363 ContextMenuNotificationObserver context_menu_observer( 360 ContextMenuNotificationObserver context_menu_observer(
364 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 361 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB);
365 chrome::NOTIFICATION_TAB_ADDED);
366 RunReferrerTest("origin", true, false, true, true, 362 RunReferrerTest("origin", true, false, true, true,
367 WebKit::WebMouseEvent::ButtonRight, 363 WebKit::WebMouseEvent::ButtonRight,
368 EXPECT_ORIGIN_AS_REFERRER); 364 EXPECT_ORIGIN_AS_REFERRER);
369 } 365 }
370 366
371 // Tests history navigation actions: Navigate from A to B with a referrer 367 // Tests history navigation actions: Navigate from A to B with a referrer
372 // policy, then navigate to C, back to B, and reload. 368 // policy, then navigate to C, back to B, and reload.
373 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { 369 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) {
374 // Navigate from A to B. 370 // Navigate from A to B.
375 GURL start_url = RunReferrerTest("origin", true, false, true, false, 371 GURL start_url = RunReferrerTest("origin", true, false, true, false,
(...skipping 23 matching lines...) Expand all
399 browser()->Reload(CURRENT_TAB); 395 browser()->Reload(CURRENT_TAB);
400 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); 396 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle());
401 397
402 title_watcher.reset(new ui_test_utils::TitleWatcher(tab, expected_title)); 398 title_watcher.reset(new ui_test_utils::TitleWatcher(tab, expected_title));
403 AddAllPossibleTitles(start_url, title_watcher.get()); 399 AddAllPossibleTitles(start_url, title_watcher.get());
404 400
405 // Shift-reload to B. 401 // Shift-reload to B.
406 browser()->ReloadIgnoringCache(CURRENT_TAB); 402 browser()->ReloadIgnoringCache(CURRENT_TAB);
407 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); 403 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle());
408 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698