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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 Browser* QuitBrowserAndRestore(Browser* browser, int expected_tab_count) { | 117 Browser* QuitBrowserAndRestore(Browser* browser, int expected_tab_count) { |
118 Profile* profile = browser->profile(); | 118 Profile* profile = browser->profile(); |
119 | 119 |
120 // Close the browser. | 120 // Close the browser. |
121 g_browser_process->AddRefModule(); | 121 g_browser_process->AddRefModule(); |
122 CloseBrowserSynchronously(browser); | 122 CloseBrowserSynchronously(browser); |
123 | 123 |
124 // Create a new window, which should trigger session restore. | 124 // Create a new window, which should trigger session restore. |
125 ui_test_utils::BrowserAddedObserver window_observer; | 125 ui_test_utils::BrowserAddedObserver window_observer; |
126 content::TestNavigationObserver navigation_observer( | 126 content::TestNavigationObserver navigation_observer( |
127 content::NotificationService::AllSources(), NULL, expected_tab_count); | 127 content::NotificationService::AllSources(), expected_tab_count); |
128 chrome::NewEmptyWindow(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); | 128 chrome::NewEmptyWindow(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); |
129 Browser* new_browser = window_observer.WaitForSingleNewBrowser(); | 129 Browser* new_browser = window_observer.WaitForSingleNewBrowser(); |
130 navigation_observer.Wait(); | 130 navigation_observer.Wait(); |
131 g_browser_process->ReleaseModule(); | 131 g_browser_process->ReleaseModule(); |
132 | 132 |
133 return new_browser; | 133 return new_browser; |
134 } | 134 } |
135 | 135 |
136 void GoBack(Browser* browser) { | 136 void GoBack(Browser* browser) { |
137 content::WindowedNotificationObserver observer( | 137 content::WindowedNotificationObserver observer( |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 content::NavigationController* controller = | 963 content::NavigationController* controller = |
964 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); | 964 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); |
965 EXPECT_TRUE( | 965 EXPECT_TRUE( |
966 controller->GetDefaultSessionStorageNamespace()->should_persist()); | 966 controller->GetDefaultSessionStorageNamespace()->should_persist()); |
967 | 967 |
968 // Quit and restore. Check that no extra tabs were created. | 968 // Quit and restore. Check that no extra tabs were created. |
969 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 969 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
970 ASSERT_EQ(1u, native_browser_list->size()); | 970 ASSERT_EQ(1u, native_browser_list->size()); |
971 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); | 971 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); |
972 } | 972 } |
OLD | NEW |