| 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 <vector> | 5 #include <vector> |
| 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/process/launch.h" | 9 #include "base/process/launch.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we | 80 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we |
| 81 // can get these test to work without quitting. | 81 // can get these test to work without quitting. |
| 82 SessionServiceTestHelper helper( | 82 SessionServiceTestHelper helper( |
| 83 SessionServiceFactory::GetForProfile(browser()->profile())); | 83 SessionServiceFactory::GetForProfile(browser()->profile())); |
| 84 helper.SetForceBrowserNotAliveWithNoWindows(true); | 84 helper.SetForceBrowserNotAliveWithNoWindows(true); |
| 85 helper.ReleaseService(); | 85 helper.ReleaseService(); |
| 86 } | 86 } |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 InProcessBrowserTest::SetUpOnMainThread(); | 89 InProcessBrowserTest::SetUpOnMainThread(); |
| 90 |
| 91 // Wait for the InstantNTP prerendered contents to load. |
| 92 content::WindowedNotificationObserver observer( |
| 93 content::NOTIFICATION_LOAD_STOP, |
| 94 content::NotificationService::AllSources()); |
| 95 observer.Wait(); |
| 90 } | 96 } |
| 91 | 97 |
| 92 virtual bool SetUpUserDataDirectory() OVERRIDE { | 98 virtual bool SetUpUserDataDirectory() OVERRIDE { |
| 93 url1_ = ui_test_utils::GetTestUrl( | 99 url1_ = ui_test_utils::GetTestUrl( |
| 94 base::FilePath().AppendASCII("session_history"), | 100 base::FilePath().AppendASCII("session_history"), |
| 95 base::FilePath().AppendASCII("bot1.html")); | 101 base::FilePath().AppendASCII("bot1.html")); |
| 96 url2_ = ui_test_utils::GetTestUrl( | 102 url2_ = ui_test_utils::GetTestUrl( |
| 97 base::FilePath().AppendASCII("session_history"), | 103 base::FilePath().AppendASCII("session_history"), |
| 98 base::FilePath().AppendASCII("bot2.html")); | 104 base::FilePath().AppendASCII("bot2.html")); |
| 99 url3_ = ui_test_utils::GetTestUrl( | 105 url3_ = ui_test_utils::GetTestUrl( |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 649 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
| 644 ASSERT_EQ(1u, active_browser_list_->size()); | 650 ASSERT_EQ(1u, active_browser_list_->size()); |
| 645 ASSERT_EQ(url2_, | 651 ASSERT_EQ(url2_, |
| 646 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); | 652 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 647 GoBack(new_browser); | 653 GoBack(new_browser); |
| 648 ASSERT_EQ(url1_, | 654 ASSERT_EQ(url1_, |
| 649 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); | 655 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 650 } | 656 } |
| 651 | 657 |
| 652 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWebUI) { | 658 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWebUI) { |
| 653 const GURL webui_url("chrome://newtab"); | 659 const GURL webui_url("chrome://omnibox"); |
| 654 ui_test_utils::NavigateToURL(browser(), webui_url); | 660 ui_test_utils::NavigateToURL(browser(), webui_url); |
| 655 const content::WebContents* old_tab = | 661 const content::WebContents* old_tab = |
| 656 browser()->tab_strip_model()->GetActiveWebContents(); | 662 browser()->tab_strip_model()->GetActiveWebContents(); |
| 657 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, | 663 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, |
| 658 old_tab->GetRenderViewHost()->GetEnabledBindings()); | 664 old_tab->GetRenderViewHost()->GetEnabledBindings()); |
| 659 | 665 |
| 660 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 666 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
| 661 ASSERT_EQ(1u, active_browser_list_->size()); | 667 ASSERT_EQ(1u, active_browser_list_->size()); |
| 662 const content::WebContents* new_tab = | 668 const content::WebContents* new_tab = |
| 663 new_browser->tab_strip_model()->GetActiveWebContents(); | 669 new_browser->tab_strip_model()->GetActiveWebContents(); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 content::NavigationController* controller = | 1156 content::NavigationController* controller = |
| 1151 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); | 1157 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); |
| 1152 EXPECT_TRUE( | 1158 EXPECT_TRUE( |
| 1153 controller->GetDefaultSessionStorageNamespace()->should_persist()); | 1159 controller->GetDefaultSessionStorageNamespace()->should_persist()); |
| 1154 | 1160 |
| 1155 // Quit and restore. Check that no extra tabs were created. | 1161 // Quit and restore. Check that no extra tabs were created. |
| 1156 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 1162 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
| 1157 ASSERT_EQ(1u, active_browser_list_->size()); | 1163 ASSERT_EQ(1u, active_browser_list_->size()); |
| 1158 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); | 1164 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); |
| 1159 } | 1165 } |
| OLD | NEW |