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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // Restore the next-to-last-closed tab into the same window. | 404 // Restore the next-to-last-closed tab into the same window. |
405 ASSERT_NO_FATAL_FAILURE(RestoreTab(1, 0)); | 405 ASSERT_NO_FATAL_FAILURE(RestoreTab(1, 0)); |
406 EXPECT_EQ(2, browser->tab_strip_model()->count()); | 406 EXPECT_EQ(2, browser->tab_strip_model()->count()); |
407 EXPECT_EQ(url1_, | 407 EXPECT_EQ(url1_, |
408 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); | 408 browser->tab_strip_model()->GetActiveWebContents()->GetURL()); |
409 } | 409 } |
410 | 410 |
411 // Tests that a duplicate history entry is not created when we restore a page | 411 // Tests that a duplicate history entry is not created when we restore a page |
412 // to an existing SiteInstance. (Bug 1230446) | 412 // to an existing SiteInstance. (Bug 1230446) |
413 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) { | 413 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) { |
414 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 414 ASSERT_TRUE(embedded_test_server()->Start()); |
415 | 415 |
416 GURL http_url1(embedded_test_server()->GetURL("/title1.html")); | 416 GURL http_url1(embedded_test_server()->GetURL("/title1.html")); |
417 GURL http_url2(embedded_test_server()->GetURL("/title2.html")); | 417 GURL http_url2(embedded_test_server()->GetURL("/title2.html")); |
418 int tab_count = browser()->tab_strip_model()->count(); | 418 int tab_count = browser()->tab_strip_model()->count(); |
419 | 419 |
420 // Add a tab | 420 // Add a tab |
421 ui_test_utils::NavigateToURLWithDisposition( | 421 ui_test_utils::NavigateToURLWithDisposition( |
422 browser(), http_url1, NEW_FOREGROUND_TAB, | 422 browser(), http_url1, NEW_FOREGROUND_TAB, |
423 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 423 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
424 EXPECT_EQ(++tab_count, browser()->tab_strip_model()->count()); | 424 EXPECT_EQ(++tab_count, browser()->tab_strip_model()->count()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 #define MAYBE_RestoreCrossSiteWithExistingSiteInstance DISABLED_RestoreCrossSite
WithExistingSiteInstance | 461 #define MAYBE_RestoreCrossSiteWithExistingSiteInstance DISABLED_RestoreCrossSite
WithExistingSiteInstance |
462 #else | 462 #else |
463 #define MAYBE_RestoreCrossSiteWithExistingSiteInstance RestoreCrossSiteWithExist
ingSiteInstance | 463 #define MAYBE_RestoreCrossSiteWithExistingSiteInstance RestoreCrossSiteWithExist
ingSiteInstance |
464 #endif | 464 #endif |
465 | 465 |
466 // Tests that the SiteInstances used for entries in a restored tab's history | 466 // Tests that the SiteInstances used for entries in a restored tab's history |
467 // are given appropriate max page IDs, even if the renderer for the entry | 467 // are given appropriate max page IDs, even if the renderer for the entry |
468 // already exists. (Bug 1204135) | 468 // already exists. (Bug 1204135) |
469 IN_PROC_BROWSER_TEST_F(TabRestoreTest, | 469 IN_PROC_BROWSER_TEST_F(TabRestoreTest, |
470 MAYBE_RestoreCrossSiteWithExistingSiteInstance) { | 470 MAYBE_RestoreCrossSiteWithExistingSiteInstance) { |
471 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 471 ASSERT_TRUE(embedded_test_server()->Start()); |
472 | 472 |
473 GURL http_url1(embedded_test_server()->GetURL("/title1.html")); | 473 GURL http_url1(embedded_test_server()->GetURL("/title1.html")); |
474 GURL http_url2(embedded_test_server()->GetURL("/title2.html")); | 474 GURL http_url2(embedded_test_server()->GetURL("/title2.html")); |
475 | 475 |
476 int tab_count = browser()->tab_strip_model()->count(); | 476 int tab_count = browser()->tab_strip_model()->count(); |
477 | 477 |
478 // Add a tab | 478 // Add a tab |
479 ui_test_utils::NavigateToURLWithDisposition( | 479 ui_test_utils::NavigateToURLWithDisposition( |
480 browser(), http_url1, NEW_FOREGROUND_TAB, | 480 browser(), http_url1, NEW_FOREGROUND_TAB, |
481 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 481 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 // See if content is as expected. | 584 // See if content is as expected. |
585 EXPECT_GT( | 585 EXPECT_GT( |
586 ui_test_utils::FindInPage(tab, base::ASCIIToUTF16("webkit"), true, false, | 586 ui_test_utils::FindInPage(tab, base::ASCIIToUTF16("webkit"), true, false, |
587 NULL, NULL), | 587 NULL, NULL), |
588 0); | 588 0); |
589 } | 589 } |
590 | 590 |
591 // Restore tab with special URL in its navigation history, go back to that | 591 // Restore tab with special URL in its navigation history, go back to that |
592 // entry and see that it loads properly. See http://crbug.com/31905 | 592 // entry and see that it loads properly. See http://crbug.com/31905 |
593 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabWithSpecialURLOnBack) { | 593 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabWithSpecialURLOnBack) { |
594 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 594 ASSERT_TRUE(embedded_test_server()->Start()); |
595 | 595 |
596 const GURL http_url(embedded_test_server()->GetURL("/title1.html")); | 596 const GURL http_url(embedded_test_server()->GetURL("/title1.html")); |
597 | 597 |
598 // Navigate new tab to a special URL. | 598 // Navigate new tab to a special URL. |
599 ui_test_utils::NavigateToURLWithDisposition( | 599 ui_test_utils::NavigateToURLWithDisposition( |
600 browser(), GURL(chrome::kChromeUICreditsURL), NEW_FOREGROUND_TAB, | 600 browser(), GURL(chrome::kChromeUICreditsURL), NEW_FOREGROUND_TAB, |
601 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 601 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
602 | 602 |
603 // Then navigate to a normal URL. | 603 // Then navigate to a normal URL. |
604 ui_test_utils::NavigateToURL(browser(), http_url); | 604 ui_test_utils::NavigateToURL(browser(), http_url); |
(...skipping 22 matching lines...) Expand all Loading... |
627 while (browser()->tab_strip_model()->count()) | 627 while (browser()->tab_strip_model()->count()) |
628 CloseTab(0); | 628 CloseTab(0); |
629 } | 629 } |
630 | 630 |
631 // Verifies restoring a tab works on startup. | 631 // Verifies restoring a tab works on startup. |
632 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreOnStartup) { | 632 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreOnStartup) { |
633 ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1)); | 633 ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1)); |
634 EXPECT_EQ(url1_, | 634 EXPECT_EQ(url1_, |
635 browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL()); | 635 browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL()); |
636 } | 636 } |
OLD | NEW |