OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/memory/memory_pressure_listener.h" | 9 #include "base/memory/memory_pressure_listener.h" |
10 #include "base/process/launch.h" | 10 #include "base/process/launch.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #if defined(USE_AURA) | 59 #if defined(USE_AURA) |
60 #include "ui/aura/window.h" | 60 #include "ui/aura/window.h" |
61 #endif | 61 #endif |
62 | 62 |
63 class SessionRestoreTest : public InProcessBrowserTest { | 63 class SessionRestoreTest : public InProcessBrowserTest { |
64 public: | 64 public: |
65 SessionRestoreTest() : active_browser_list_(NULL) {} | 65 SessionRestoreTest() : active_browser_list_(NULL) {} |
66 | 66 |
67 protected: | 67 protected: |
68 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
69 virtual void SetUpCommandLine(CommandLine* command_line) override { | 69 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
70 // TODO(nkostylev): Investigate if we can remove this switch. | 70 // TODO(nkostylev): Investigate if we can remove this switch. |
71 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); | 71 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); |
72 InProcessBrowserTest::SetUpCommandLine(command_line); | 72 InProcessBrowserTest::SetUpCommandLine(command_line); |
73 } | 73 } |
74 #endif | 74 #endif |
75 | 75 |
76 void SetUpOnMainThread() override { | 76 void SetUpOnMainThread() override { |
77 active_browser_list_ = BrowserList::GetInstance(chrome::GetActiveDesktop()); | 77 active_browser_list_ = BrowserList::GetInstance(chrome::GetActiveDesktop()); |
78 | 78 |
79 SessionStartupPref pref(SessionStartupPref::LAST); | 79 SessionStartupPref pref(SessionStartupPref::LAST); |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 // for details. It was disabled for a long time so might never have worked on | 975 // for details. It was disabled for a long time so might never have worked on |
976 // ChromeOS. | 976 // ChromeOS. |
977 | 977 |
978 // Launches an app window, closes tabbed browser, launches and makes sure | 978 // Launches an app window, closes tabbed browser, launches and makes sure |
979 // we restore the tabbed browser url. | 979 // we restore the tabbed browser url. |
980 // If this test flakes, use http://crbug.com/29110 | 980 // If this test flakes, use http://crbug.com/29110 |
981 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, | 981 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, |
982 RestoreAfterClosingTabbedBrowserWithAppAndLaunching) { | 982 RestoreAfterClosingTabbedBrowserWithAppAndLaunching) { |
983 #if defined(OS_WIN) && defined(USE_ASH) | 983 #if defined(OS_WIN) && defined(USE_ASH) |
984 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 984 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
985 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 985 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 986 switches::kAshBrowserTests)) |
986 return; | 987 return; |
987 #endif | 988 #endif |
988 | 989 |
989 ui_test_utils::NavigateToURL(browser(), url1_); | 990 ui_test_utils::NavigateToURL(browser(), url1_); |
990 | 991 |
991 // Launch an app. | 992 // Launch an app. |
992 CommandLine app_launch_arguments = GetCommandLineForRelaunch(); | 993 base::CommandLine app_launch_arguments = GetCommandLineForRelaunch(); |
993 app_launch_arguments.AppendSwitchASCII(switches::kApp, url2_.spec()); | 994 app_launch_arguments.AppendSwitchASCII(switches::kApp, url2_.spec()); |
994 | 995 |
995 ui_test_utils::BrowserAddedObserver window_observer; | 996 ui_test_utils::BrowserAddedObserver window_observer; |
996 | 997 |
997 base::LaunchProcess(app_launch_arguments, base::LaunchOptionsForTest()); | 998 base::LaunchProcess(app_launch_arguments, base::LaunchOptionsForTest()); |
998 | 999 |
999 Browser* app_window = window_observer.WaitForSingleNewBrowser(); | 1000 Browser* app_window = window_observer.WaitForSingleNewBrowser(); |
1000 ASSERT_EQ(2u, active_browser_list_->size()); | 1001 ASSERT_EQ(2u, active_browser_list_->size()); |
1001 | 1002 |
1002 // Close the first window. The only window left is the App window. | 1003 // Close the first window. The only window left is the App window. |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 content::NavigationController* controller = | 1261 content::NavigationController* controller = |
1261 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); | 1262 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); |
1262 EXPECT_TRUE( | 1263 EXPECT_TRUE( |
1263 controller->GetDefaultSessionStorageNamespace()->should_persist()); | 1264 controller->GetDefaultSessionStorageNamespace()->should_persist()); |
1264 | 1265 |
1265 // Quit and restore. Check that no extra tabs were created. | 1266 // Quit and restore. Check that no extra tabs were created. |
1266 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 1267 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
1267 ASSERT_EQ(1u, active_browser_list_->size()); | 1268 ASSERT_EQ(1u, active_browser_list_->size()); |
1268 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); | 1269 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); |
1269 } | 1270 } |
OLD | NEW |