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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 url1_ = ui_test_utils::GetTestUrl( | 84 url1_ = ui_test_utils::GetTestUrl( |
85 base::FilePath().AppendASCII("session_history"), | 85 base::FilePath().AppendASCII("session_history"), |
86 base::FilePath().AppendASCII("bot1.html")); | 86 base::FilePath().AppendASCII("bot1.html")); |
87 url2_ = ui_test_utils::GetTestUrl( | 87 url2_ = ui_test_utils::GetTestUrl( |
88 base::FilePath().AppendASCII("session_history"), | 88 base::FilePath().AppendASCII("session_history"), |
89 base::FilePath().AppendASCII("bot2.html")); | 89 base::FilePath().AppendASCII("bot2.html")); |
90 } | 90 } |
91 | 91 |
92 protected: | 92 protected: |
93 void SetUpOnMainThread() override { | 93 void SetUpOnMainThread() override { |
94 active_browser_list_ = BrowserList::GetInstance(chrome::GetActiveDesktop()); | 94 active_browser_list_ = BrowserList::GetInstance(); |
95 InProcessBrowserTest::SetUpOnMainThread(); | 95 InProcessBrowserTest::SetUpOnMainThread(); |
96 } | 96 } |
97 | 97 |
98 Browser* GetBrowser(int index) { | 98 Browser* GetBrowser(int index) { |
99 CHECK(static_cast<int>(active_browser_list_->size()) > index); | 99 CHECK(static_cast<int>(active_browser_list_->size()) > index); |
100 return active_browser_list_->get(index); | 100 return active_browser_list_->get(index); |
101 } | 101 } |
102 | 102 |
103 // Adds tabs to the given browser, all navigated to url1_. Returns | 103 // Adds tabs to the given browser, all navigated to url1_. Returns |
104 // the final number of tabs. | 104 // the final number of tabs. |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 // And make sure the URLs match. | 454 // And make sure the URLs match. |
455 EXPECT_EQ(http_url2, | 455 EXPECT_EQ(http_url2, |
456 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 456 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
457 GoBack(browser()); | 457 GoBack(browser()); |
458 EXPECT_EQ(http_url1, | 458 EXPECT_EQ(http_url1, |
459 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 459 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
460 } | 460 } |
461 | 461 |
462 // See crbug.com/248574 | 462 // See crbug.com/248574 |
463 #if defined(OS_WIN) | 463 #if defined(OS_WIN) |
464 #define MAYBE_RestoreCrossSiteWithExistingSiteInstance DISABLED_RestoreCrossSite
WithExistingSiteInstance | 464 #define MAYBE_RestoreCrossSiteWithExistingSiteInstance \ |
| 465 DISABLED_RestoreCrossSiteWithExistingSiteInstance |
465 #else | 466 #else |
466 #define MAYBE_RestoreCrossSiteWithExistingSiteInstance RestoreCrossSiteWithExist
ingSiteInstance | 467 #define MAYBE_RestoreCrossSiteWithExistingSiteInstance \ |
| 468 RestoreCrossSiteWithExistingSiteInstance |
467 #endif | 469 #endif |
468 | 470 |
469 // Tests that the SiteInstances used for entries in a restored tab's history | 471 // Tests that the SiteInstances used for entries in a restored tab's history |
470 // are given appropriate max page IDs, even if the renderer for the entry | 472 // are given appropriate max page IDs, even if the renderer for the entry |
471 // already exists. (Bug 1204135) | 473 // already exists. (Bug 1204135) |
472 IN_PROC_BROWSER_TEST_F(TabRestoreTest, | 474 IN_PROC_BROWSER_TEST_F(TabRestoreTest, |
473 MAYBE_RestoreCrossSiteWithExistingSiteInstance) { | 475 MAYBE_RestoreCrossSiteWithExistingSiteInstance) { |
474 ASSERT_TRUE(embedded_test_server()->Start()); | 476 ASSERT_TRUE(embedded_test_server()->Start()); |
475 | 477 |
476 GURL http_url1(embedded_test_server()->GetURL("/title1.html")); | 478 GURL http_url1(embedded_test_server()->GetURL("/title1.html")); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 while (browser()->tab_strip_model()->count()) | 632 while (browser()->tab_strip_model()->count()) |
631 CloseTab(0); | 633 CloseTab(0); |
632 } | 634 } |
633 | 635 |
634 // Verifies restoring a tab works on startup. | 636 // Verifies restoring a tab works on startup. |
635 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreOnStartup) { | 637 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreOnStartup) { |
636 ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1)); | 638 ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1)); |
637 EXPECT_EQ(url1_, | 639 EXPECT_EQ(url1_, |
638 browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL()); | 640 browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL()); |
639 } | 641 } |
OLD | NEW |