| 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/file_path.h" | 6 #include "base/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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // (http://crbug.com/120927) | 174 // (http://crbug.com/120927) |
| 175 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, NoSessionRestoreNewWindowChromeOS) { | 175 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, NoSessionRestoreNewWindowChromeOS) { |
| 176 GURL url(ui_test_utils::GetTestUrl( | 176 GURL url(ui_test_utils::GetTestUrl( |
| 177 FilePath(FilePath::kCurrentDirectory), | 177 FilePath(FilePath::kCurrentDirectory), |
| 178 FilePath(FILE_PATH_LITERAL("title1.html")))); | 178 FilePath(FILE_PATH_LITERAL("title1.html")))); |
| 179 | 179 |
| 180 // Add a single tab. | 180 // Add a single tab. |
| 181 ui_test_utils::NavigateToURL(browser(), url); | 181 ui_test_utils::NavigateToURL(browser(), url); |
| 182 | 182 |
| 183 Browser* incognito_browser = CreateIncognitoBrowser(); | 183 Browser* incognito_browser = CreateIncognitoBrowser(); |
| 184 chrome::AddBlankTab(incognito_browser, true); | 184 chrome::AddBlankTabAt(incognito_browser, -1, true); |
| 185 incognito_browser->window()->Show(); | 185 incognito_browser->window()->Show(); |
| 186 | 186 |
| 187 // Close the normal browser. After this we only have the incognito window | 187 // Close the normal browser. After this we only have the incognito window |
| 188 // open. | 188 // open. |
| 189 CloseBrowserSynchronously(browser()); | 189 CloseBrowserSynchronously(browser()); |
| 190 | 190 |
| 191 // Create a new window, which should open NTP. | 191 // Create a new window, which should open NTP. |
| 192 ui_test_utils::BrowserAddedObserver browser_added_observer; | 192 ui_test_utils::BrowserAddedObserver browser_added_observer; |
| 193 chrome::NewWindow(incognito_browser); | 193 chrome::NewWindow(incognito_browser); |
| 194 Browser* new_browser = browser_added_observer.WaitForSingleNewBrowser(); | 194 Browser* new_browser = browser_added_observer.WaitForSingleNewBrowser(); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, IncognitotoNonIncognito) { | 367 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, IncognitotoNonIncognito) { |
| 368 GURL url(ui_test_utils::GetTestUrl( | 368 GURL url(ui_test_utils::GetTestUrl( |
| 369 FilePath(FilePath::kCurrentDirectory), | 369 FilePath(FilePath::kCurrentDirectory), |
| 370 FilePath(FILE_PATH_LITERAL("title1.html")))); | 370 FilePath(FILE_PATH_LITERAL("title1.html")))); |
| 371 | 371 |
| 372 // Add a single tab. | 372 // Add a single tab. |
| 373 ui_test_utils::NavigateToURL(browser(), url); | 373 ui_test_utils::NavigateToURL(browser(), url); |
| 374 | 374 |
| 375 // Create a new incognito window. | 375 // Create a new incognito window. |
| 376 Browser* incognito_browser = CreateIncognitoBrowser(); | 376 Browser* incognito_browser = CreateIncognitoBrowser(); |
| 377 chrome::AddBlankTab(incognito_browser, true); | 377 chrome::AddBlankTabAt(incognito_browser, -1, true); |
| 378 incognito_browser->window()->Show(); | 378 incognito_browser->window()->Show(); |
| 379 | 379 |
| 380 // Close the normal browser. After this we only have the incognito window | 380 // Close the normal browser. After this we only have the incognito window |
| 381 // open. | 381 // open. |
| 382 CloseBrowserSynchronously(browser()); | 382 CloseBrowserSynchronously(browser()); |
| 383 | 383 |
| 384 // Create a new window, which should trigger session restore. | 384 // Create a new window, which should trigger session restore. |
| 385 ui_test_utils::BrowserAddedObserver browser_added_observer; | 385 ui_test_utils::BrowserAddedObserver browser_added_observer; |
| 386 chrome::NewWindow(incognito_browser); | 386 chrome::NewWindow(incognito_browser); |
| 387 Browser* new_browser = browser_added_observer.WaitForSingleNewBrowser(); | 387 Browser* new_browser = browser_added_observer.WaitForSingleNewBrowser(); |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 content::NavigationController* controller = | 926 content::NavigationController* controller = |
| 927 &chrome::GetActiveWebContents(browser())->GetController(); | 927 &chrome::GetActiveWebContents(browser())->GetController(); |
| 928 EXPECT_TRUE( | 928 EXPECT_TRUE( |
| 929 controller->GetDefaultSessionStorageNamespace()->should_persist()); | 929 controller->GetDefaultSessionStorageNamespace()->should_persist()); |
| 930 | 930 |
| 931 // Quit and restore. Check that no extra tabs were created. | 931 // Quit and restore. Check that no extra tabs were created. |
| 932 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 932 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
| 933 ASSERT_EQ(1u, BrowserList::size()); | 933 ASSERT_EQ(1u, BrowserList::size()); |
| 934 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); | 934 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); |
| 935 } | 935 } |
| OLD | NEW |