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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #if defined(USE_AURA) | 58 #if defined(USE_AURA) |
59 #include "ui/aura/window.h" | 59 #include "ui/aura/window.h" |
60 #endif | 60 #endif |
61 | 61 |
62 class SessionRestoreTest : public InProcessBrowserTest { | 62 class SessionRestoreTest : public InProcessBrowserTest { |
63 public: | 63 public: |
64 SessionRestoreTest() : active_browser_list_(NULL) {} | 64 SessionRestoreTest() : active_browser_list_(NULL) {} |
65 | 65 |
66 protected: | 66 protected: |
67 #if defined(OS_CHROMEOS) | 67 #if defined(OS_CHROMEOS) |
68 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 68 virtual void SetUpCommandLine(CommandLine* command_line) override { |
69 // TODO(nkostylev): Investigate if we can remove this switch. | 69 // TODO(nkostylev): Investigate if we can remove this switch. |
70 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); | 70 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); |
71 InProcessBrowserTest::SetUpCommandLine(command_line); | 71 InProcessBrowserTest::SetUpCommandLine(command_line); |
72 } | 72 } |
73 #endif | 73 #endif |
74 | 74 |
75 virtual void SetUpOnMainThread() OVERRIDE { | 75 virtual void SetUpOnMainThread() override { |
76 active_browser_list_ = BrowserList::GetInstance(chrome::GetActiveDesktop()); | 76 active_browser_list_ = BrowserList::GetInstance(chrome::GetActiveDesktop()); |
77 | 77 |
78 SessionStartupPref pref(SessionStartupPref::LAST); | 78 SessionStartupPref pref(SessionStartupPref::LAST); |
79 SessionStartupPref::SetStartupPref(browser()->profile(), pref); | 79 SessionStartupPref::SetStartupPref(browser()->profile(), pref); |
80 #if defined(OS_CHROMEOS) | 80 #if defined(OS_CHROMEOS) |
81 const testing::TestInfo* const test_info = | 81 const testing::TestInfo* const test_info = |
82 testing::UnitTest::GetInstance()->current_test_info(); | 82 testing::UnitTest::GetInstance()->current_test_info(); |
83 if (strcmp(test_info->name(), "NoSessionRestoreNewWindowChromeOS") != 0) { | 83 if (strcmp(test_info->name(), "NoSessionRestoreNewWindowChromeOS") != 0) { |
84 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we | 84 // Undo the effect of kBrowserAliveWithNoWindows in defaults.cc so that we |
85 // can get these test to work without quitting. | 85 // can get these test to work without quitting. |
86 SessionServiceTestHelper helper( | 86 SessionServiceTestHelper helper( |
87 SessionServiceFactory::GetForProfile(browser()->profile())); | 87 SessionServiceFactory::GetForProfile(browser()->profile())); |
88 helper.SetForceBrowserNotAliveWithNoWindows(true); | 88 helper.SetForceBrowserNotAliveWithNoWindows(true); |
89 helper.ReleaseService(); | 89 helper.ReleaseService(); |
90 } | 90 } |
91 #endif | 91 #endif |
92 | 92 |
93 InProcessBrowserTest::SetUpOnMainThread(); | 93 InProcessBrowserTest::SetUpOnMainThread(); |
94 } | 94 } |
95 | 95 |
96 virtual bool SetUpUserDataDirectory() OVERRIDE { | 96 virtual bool SetUpUserDataDirectory() override { |
97 url1_ = ui_test_utils::GetTestUrl( | 97 url1_ = ui_test_utils::GetTestUrl( |
98 base::FilePath().AppendASCII("session_history"), | 98 base::FilePath().AppendASCII("session_history"), |
99 base::FilePath().AppendASCII("bot1.html")); | 99 base::FilePath().AppendASCII("bot1.html")); |
100 url2_ = ui_test_utils::GetTestUrl( | 100 url2_ = ui_test_utils::GetTestUrl( |
101 base::FilePath().AppendASCII("session_history"), | 101 base::FilePath().AppendASCII("session_history"), |
102 base::FilePath().AppendASCII("bot2.html")); | 102 base::FilePath().AppendASCII("bot2.html")); |
103 url3_ = ui_test_utils::GetTestUrl( | 103 url3_ = ui_test_utils::GetTestUrl( |
104 base::FilePath().AppendASCII("session_history"), | 104 base::FilePath().AppendASCII("session_history"), |
105 base::FilePath().AppendASCII("bot3.html")); | 105 base::FilePath().AppendASCII("bot3.html")); |
106 | 106 |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 content::NavigationController* controller = | 1194 content::NavigationController* controller = |
1195 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); | 1195 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); |
1196 EXPECT_TRUE( | 1196 EXPECT_TRUE( |
1197 controller->GetDefaultSessionStorageNamespace()->should_persist()); | 1197 controller->GetDefaultSessionStorageNamespace()->should_persist()); |
1198 | 1198 |
1199 // Quit and restore. Check that no extra tabs were created. | 1199 // Quit and restore. Check that no extra tabs were created. |
1200 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 1200 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
1201 ASSERT_EQ(1u, active_browser_list_->size()); | 1201 ASSERT_EQ(1u, active_browser_list_->size()); |
1202 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); | 1202 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); |
1203 } | 1203 } |
OLD | NEW |