| OLD | NEW |
| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // User initiated navigation, middle click, target blank, from HTTPS to HTTP. | 248 // User initiated navigation, middle click, target blank, from HTTPS to HTTP. |
| 249 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickTargetBlankOrigin) { | 249 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, HttpsMiddleClickTargetBlankOrigin) { |
| 250 RunReferrerTest("origin", true, true, false, true, | 250 RunReferrerTest("origin", true, true, false, true, |
| 251 WebKit::WebMouseEvent::ButtonMiddle, | 251 WebKit::WebMouseEvent::ButtonMiddle, |
| 252 EXPECT_ORIGIN_AS_REFERRER); | 252 EXPECT_ORIGIN_AS_REFERRER); |
| 253 } | 253 } |
| 254 | 254 |
| 255 // Context menu, from HTTP to HTTP. | 255 // Context menu, from HTTP to HTTP. |
| 256 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuOrigin) { | 256 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuOrigin) { |
| 257 ContextMenuNotificationObserver context_menu_observer( | 257 ContextMenuNotificationObserver context_menu_observer( |
| 258 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, | 258 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
| 259 chrome::NOTIFICATION_TAB_ADDED); | |
| 260 RunReferrerTest("origin", false, false, false, true, | 259 RunReferrerTest("origin", false, false, false, true, |
| 261 WebKit::WebMouseEvent::ButtonRight, | 260 WebKit::WebMouseEvent::ButtonRight, |
| 262 EXPECT_ORIGIN_AS_REFERRER); | 261 EXPECT_ORIGIN_AS_REFERRER); |
| 263 } | 262 } |
| 264 | 263 |
| 265 // Context menu, from HTTPS to HTTP. | 264 // Context menu, from HTTPS to HTTP. |
| 266 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuOrigin) { | 265 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuOrigin) { |
| 267 ContextMenuNotificationObserver context_menu_observer( | 266 ContextMenuNotificationObserver context_menu_observer( |
| 268 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, | 267 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
| 269 chrome::NOTIFICATION_TAB_ADDED); | |
| 270 RunReferrerTest("origin", true, false, false, true, | 268 RunReferrerTest("origin", true, false, false, true, |
| 271 WebKit::WebMouseEvent::ButtonRight, | 269 WebKit::WebMouseEvent::ButtonRight, |
| 272 EXPECT_ORIGIN_AS_REFERRER); | 270 EXPECT_ORIGIN_AS_REFERRER); |
| 273 } | 271 } |
| 274 | 272 |
| 275 // Content initiated navigation, from HTTP to HTTP via server redirect. | 273 // Content initiated navigation, from HTTP to HTTP via server redirect. |
| 276 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, Redirect) { | 274 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, Redirect) { |
| 277 RunReferrerTest("origin", false, false, true, false, | 275 RunReferrerTest("origin", false, false, true, false, |
| 278 WebKit::WebMouseEvent::ButtonNone, | 276 WebKit::WebMouseEvent::ButtonNone, |
| 279 EXPECT_ORIGIN_AS_REFERRER); | 277 EXPECT_ORIGIN_AS_REFERRER); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, | 343 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, |
| 346 HttpsMiddleClickTargetBlankRedirect) { | 344 HttpsMiddleClickTargetBlankRedirect) { |
| 347 RunReferrerTest("origin", true, true, true, true, | 345 RunReferrerTest("origin", true, true, true, true, |
| 348 WebKit::WebMouseEvent::ButtonMiddle, | 346 WebKit::WebMouseEvent::ButtonMiddle, |
| 349 EXPECT_ORIGIN_AS_REFERRER); | 347 EXPECT_ORIGIN_AS_REFERRER); |
| 350 } | 348 } |
| 351 | 349 |
| 352 // Context menu, from HTTP to HTTP via server redirect. | 350 // Context menu, from HTTP to HTTP via server redirect. |
| 353 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuRedirect) { | 351 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_ContextMenuRedirect) { |
| 354 ContextMenuNotificationObserver context_menu_observer( | 352 ContextMenuNotificationObserver context_menu_observer( |
| 355 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, | 353 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
| 356 chrome::NOTIFICATION_TAB_ADDED); | |
| 357 RunReferrerTest("origin", false, false, true, true, | 354 RunReferrerTest("origin", false, false, true, true, |
| 358 WebKit::WebMouseEvent::ButtonRight, | 355 WebKit::WebMouseEvent::ButtonRight, |
| 359 EXPECT_ORIGIN_AS_REFERRER); | 356 EXPECT_ORIGIN_AS_REFERRER); |
| 360 } | 357 } |
| 361 | 358 |
| 362 // Context menu, from HTTPS to HTTP via server redirect. | 359 // Context menu, from HTTPS to HTTP via server redirect. |
| 363 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuRedirect) { | 360 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, MAYBE_HttpsContextMenuRedirect) { |
| 364 ContextMenuNotificationObserver context_menu_observer( | 361 ContextMenuNotificationObserver context_menu_observer( |
| 365 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, | 362 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
| 366 chrome::NOTIFICATION_TAB_ADDED); | |
| 367 RunReferrerTest("origin", true, false, true, true, | 363 RunReferrerTest("origin", true, false, true, true, |
| 368 WebKit::WebMouseEvent::ButtonRight, | 364 WebKit::WebMouseEvent::ButtonRight, |
| 369 EXPECT_ORIGIN_AS_REFERRER); | 365 EXPECT_ORIGIN_AS_REFERRER); |
| 370 } | 366 } |
| 371 | 367 |
| 372 // Tests history navigation actions: Navigate from A to B with a referrer | 368 // Tests history navigation actions: Navigate from A to B with a referrer |
| 373 // policy, then navigate to C, back to B, and reload. | 369 // policy, then navigate to C, back to B, and reload. |
| 374 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { | 370 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { |
| 375 // Navigate from A to B. | 371 // Navigate from A to B. |
| 376 GURL start_url = RunReferrerTest("origin", true, false, true, false, | 372 GURL start_url = RunReferrerTest("origin", true, false, true, false, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 400 chrome::Reload(browser(), CURRENT_TAB); | 396 chrome::Reload(browser(), CURRENT_TAB); |
| 401 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); | 397 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); |
| 402 | 398 |
| 403 title_watcher.reset(new ui_test_utils::TitleWatcher(tab, expected_title)); | 399 title_watcher.reset(new ui_test_utils::TitleWatcher(tab, expected_title)); |
| 404 AddAllPossibleTitles(start_url, title_watcher.get()); | 400 AddAllPossibleTitles(start_url, title_watcher.get()); |
| 405 | 401 |
| 406 // Shift-reload to B. | 402 // Shift-reload to B. |
| 407 chrome::ReloadIgnoringCache(browser(), CURRENT_TAB); | 403 chrome::ReloadIgnoringCache(browser(), CURRENT_TAB); |
| 408 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); | 404 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); |
| 409 } | 405 } |
| OLD | NEW |