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/strings/string_number_conversions.h" | 6 #include "base/strings/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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 // Tests history navigation actions: Navigate from A to B with a referrer | 370 // Tests history navigation actions: Navigate from A to B with a referrer |
371 // policy, then navigate to C, back to B, and reload. | 371 // policy, then navigate to C, back to B, and reload. |
372 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { | 372 IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { |
373 // Navigate from A to B. | 373 // Navigate from A to B. |
374 GURL start_url = RunReferrerTest("origin", true, false, true, false, | 374 GURL start_url = RunReferrerTest("origin", true, false, true, false, |
375 WebKit::WebMouseEvent::ButtonLeft, | 375 WebKit::WebMouseEvent::ButtonLeft, |
376 EXPECT_ORIGIN_AS_REFERRER); | 376 EXPECT_ORIGIN_AS_REFERRER); |
377 | 377 |
378 // Navigate to C. | 378 // Navigate to C. |
379 ui_test_utils::NavigateToURL(browser(), test_server_->GetURL("")); | 379 ui_test_utils::NavigateToURL(browser(), test_server_->GetURL(std::string())); |
380 | 380 |
381 string16 expected_title = | 381 string16 expected_title = |
382 GetExpectedTitle(start_url, EXPECT_ORIGIN_AS_REFERRER); | 382 GetExpectedTitle(start_url, EXPECT_ORIGIN_AS_REFERRER); |
383 content::WebContents* tab = | 383 content::WebContents* tab = |
384 browser()->tab_strip_model()->GetActiveWebContents(); | 384 browser()->tab_strip_model()->GetActiveWebContents(); |
385 scoped_ptr<content::TitleWatcher> title_watcher( | 385 scoped_ptr<content::TitleWatcher> title_watcher( |
386 new content::TitleWatcher(tab, expected_title)); | 386 new content::TitleWatcher(tab, expected_title)); |
387 | 387 |
388 // Watch for all possible outcomes to avoid timeouts if something breaks. | 388 // Watch for all possible outcomes to avoid timeouts if something breaks. |
389 AddAllPossibleTitles(start_url, title_watcher.get()); | 389 AddAllPossibleTitles(start_url, title_watcher.get()); |
390 | 390 |
391 // Go back to B. | 391 // Go back to B. |
392 chrome::GoBack(browser(), CURRENT_TAB); | 392 chrome::GoBack(browser(), CURRENT_TAB); |
393 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); | 393 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); |
394 | 394 |
395 title_watcher.reset(new content::TitleWatcher(tab, expected_title)); | 395 title_watcher.reset(new content::TitleWatcher(tab, expected_title)); |
396 AddAllPossibleTitles(start_url, title_watcher.get()); | 396 AddAllPossibleTitles(start_url, title_watcher.get()); |
397 | 397 |
398 // Reload to B. | 398 // Reload to B. |
399 chrome::Reload(browser(), CURRENT_TAB); | 399 chrome::Reload(browser(), CURRENT_TAB); |
400 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); | 400 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); |
401 | 401 |
402 title_watcher.reset(new content::TitleWatcher(tab, expected_title)); | 402 title_watcher.reset(new content::TitleWatcher(tab, expected_title)); |
403 AddAllPossibleTitles(start_url, title_watcher.get()); | 403 AddAllPossibleTitles(start_url, title_watcher.get()); |
404 | 404 |
405 // Shift-reload to B. | 405 // Shift-reload to B. |
406 chrome::ReloadIgnoringCache(browser(), CURRENT_TAB); | 406 chrome::ReloadIgnoringCache(browser(), CURRENT_TAB); |
407 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); | 407 EXPECT_EQ(expected_title, title_watcher->WaitAndGetTitle()); |
408 } | 408 } |
OLD | NEW |