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

Side by Side Diff: chrome/browser/history/history_browsertest.cc

Issue 2972793002: Fix did_replace_entry reported as false for meta refresh tags (Closed)
Patch Set: Minor rewrite and updated tests. Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/test/data/History/redirector.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 5 #include <utility>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 std::string script = "location.replace('form.html')"; 467 std::string script = "location.replace('form.html')";
468 content::TestFrameNavigationObserver observer(frame); 468 content::TestFrameNavigationObserver observer(frame);
469 EXPECT_TRUE(ExecuteScript(frame, script)); 469 EXPECT_TRUE(ExecuteScript(frame, script));
470 observer.Wait(); 470 observer.Wait();
471 GURL auto_subframe = 471 GURL auto_subframe =
472 ui_test_utils::GetTestUrl(base::FilePath().AppendASCII("History"), 472 ui_test_utils::GetTestUrl(base::FilePath().AppendASCII("History"),
473 base::FilePath().AppendASCII("form.html")); 473 base::FilePath().AppendASCII("form.html"));
474 ASSERT_FALSE(HistoryContainsURL(auto_subframe)); 474 ASSERT_FALSE(HistoryContainsURL(auto_subframe));
475 } 475 }
476 476
477 // HTTP meta-refresh redirects should have separate history entries. 477 // HTTP meta-refresh redirects should have separate history entries iff the
478 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, RedirectHistory) { 478 // timeout is > 1 seconds.
479 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, RedirectHistoryFast) {
479 GURL redirector = ui_test_utils::GetTestUrl( 480 GURL redirector = ui_test_utils::GetTestUrl(
480 base::FilePath().AppendASCII("History"), 481 base::FilePath().AppendASCII("History"),
481 base::FilePath().AppendASCII("redirector.html")); 482 base::FilePath().AppendASCII("redirector_fast.html"));
483 GURL landing_url =
484 ui_test_utils::GetTestUrl(base::FilePath().AppendASCII("History"),
485 base::FilePath().AppendASCII("landing.html"));
486 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(),
487 redirector, 2);
488 ASSERT_EQ(landing_url,
489 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
490 std::vector<GURL> urls(GetHistoryContents());
491 ASSERT_EQ(1u, urls.size());
492 ASSERT_EQ(landing_url, urls[0]);
493 }
494
495 // HTTP meta-refresh redirects should have separate history entries iff the
496 // timeout is > 1 seconds.
497 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, RedirectHistorySlow) {
498 GURL redirector = ui_test_utils::GetTestUrl(
499 base::FilePath().AppendASCII("History"),
500 base::FilePath().AppendASCII("redirector_slow.html"));
482 GURL landing_url = ui_test_utils::GetTestUrl( 501 GURL landing_url = ui_test_utils::GetTestUrl(
483 base::FilePath().AppendASCII("History"), 502 base::FilePath().AppendASCII("History"),
484 base::FilePath().AppendASCII("landing.html")); 503 base::FilePath().AppendASCII("landing.html"));
485 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( 504 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
486 browser(), redirector, 2); 505 browser(), redirector, 2);
487 ASSERT_EQ(landing_url, 506 ASSERT_EQ(landing_url,
488 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 507 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
489 std::vector<GURL> urls(GetHistoryContents()); 508 std::vector<GURL> urls(GetHistoryContents());
490 ASSERT_EQ(2u, urls.size()); 509 ASSERT_EQ(2u, urls.size());
491 ASSERT_EQ(landing_url, urls[0]); 510 ASSERT_EQ(landing_url, urls[0]);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 627
609 content::WebContents* active_web_contents = 628 content::WebContents* active_web_contents =
610 browser()->tab_strip_model()->GetActiveWebContents(); 629 browser()->tab_strip_model()->GetActiveWebContents();
611 ASSERT_EQ(web_contents, active_web_contents); 630 ASSERT_EQ(web_contents, active_web_contents);
612 ASSERT_EQ(history_url, active_web_contents->GetURL()); 631 ASSERT_EQ(history_url, active_web_contents->GetURL());
613 632
614 content::WebContents* second_tab = 633 content::WebContents* second_tab =
615 browser()->tab_strip_model()->GetWebContentsAt(1); 634 browser()->tab_strip_model()->GetWebContentsAt(1);
616 ASSERT_NE(history_url, second_tab->GetURL()); 635 ASSERT_NE(history_url, second_tab->GetURL());
617 } 636 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/History/redirector.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698