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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/first_run/first_run.h" | 11 #include "chrome/browser/first_run/first_run.h" |
12 #include "chrome/browser/infobars/infobar_tab_helper.h" | 12 #include "chrome/browser/infobars/infobar_tab_helper.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
14 #include "chrome/browser/prefs/session_startup_pref.h" | 14 #include "chrome/browser/prefs/session_startup_pref.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/profiles/profile_impl.h" | 16 #include "chrome/browser/profiles/profile_impl.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/browser/sessions/session_restore.h" | 18 #include "chrome/browser/sessions/session_restore.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
21 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
22 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 22 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 23 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
26 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
27 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
28 #include "chrome/test/base/ui_test_utils.h" | 29 #include "chrome/test/base/ui_test_utils.h" |
29 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
31 | 32 |
32 class StartupBrowserCreatorTest : public ExtensionBrowserTest { | 33 class StartupBrowserCreatorTest : public ExtensionBrowserTest { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 virtual void OnBrowserAdded(const Browser* browser) { | 103 virtual void OnBrowserAdded(const Browser* browser) { |
103 added_browser_ = browser; | 104 added_browser_ = browser; |
104 } | 105 } |
105 | 106 |
106 virtual void OnBrowserRemoved(const Browser* browser) { } | 107 virtual void OnBrowserRemoved(const Browser* browser) { } |
107 | 108 |
108 const Browser* added_browser_; | 109 const Browser* added_browser_; |
109 }; | 110 }; |
110 | 111 |
111 // Test that when there is a popup as the active browser any requests to | 112 // Test that when there is a popup as the active browser any requests to |
112 // StartupBrowserCreator::LaunchWithProfile::OpenURLsInBrowser don't crash | 113 // StartupBrowserCreatorImpl::OpenURLsInBrowser don't crash because there's no |
113 // because there's no explicit profile given. | 114 // explicit profile given. |
114 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) { | 115 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) { |
115 std::vector<GURL> urls; | 116 std::vector<GURL> urls; |
116 urls.push_back(GURL("http://localhost")); | 117 urls.push_back(GURL("http://localhost")); |
117 | 118 |
118 // Note that in our testing we do not ever query the BrowserList for the "last | 119 // Note that in our testing we do not ever query the BrowserList for the "last |
119 // active" browser. That's because the browsers are set as "active" by | 120 // active" browser. That's because the browsers are set as "active" by |
120 // platform UI toolkit messages, and those messages are not sent during unit | 121 // platform UI toolkit messages, and those messages are not sent during unit |
121 // testing sessions. | 122 // testing sessions. |
122 | 123 |
123 OpenURLsPopupObserver observer; | 124 OpenURLsPopupObserver observer; |
124 BrowserList::AddObserver(&observer); | 125 BrowserList::AddObserver(&observer); |
125 | 126 |
126 Browser* popup = Browser::CreateWithParams( | 127 Browser* popup = Browser::CreateWithParams( |
127 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); | 128 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); |
128 ASSERT_TRUE(popup->is_type_popup()); | 129 ASSERT_TRUE(popup->is_type_popup()); |
129 ASSERT_EQ(popup, observer.added_browser_); | 130 ASSERT_EQ(popup, observer.added_browser_); |
130 | 131 |
131 CommandLine dummy(CommandLine::NO_PROGRAM); | 132 CommandLine dummy(CommandLine::NO_PROGRAM); |
132 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 133 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
133 StartupBrowserCreator::IS_FIRST_RUN : | 134 browser::startup::IS_FIRST_RUN : |
134 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 135 browser::startup::IS_NOT_FIRST_RUN; |
135 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run); | 136 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); |
136 // This should create a new window, but re-use the profile from |popup|. If | 137 // This should create a new window, but re-use the profile from |popup|. If |
137 // it used a NULL or invalid profile, it would crash. | 138 // it used a NULL or invalid profile, it would crash. |
138 launch.OpenURLsInBrowser(popup, false, urls); | 139 launch.OpenURLsInBrowser(popup, false, urls); |
139 ASSERT_NE(popup, observer.added_browser_); | 140 ASSERT_NE(popup, observer.added_browser_); |
140 BrowserList::RemoveObserver(&observer); | 141 BrowserList::RemoveObserver(&observer); |
141 } | 142 } |
142 | 143 |
143 // We don't do non-process-startup browser launches on ChromeOS. | 144 // We don't do non-process-startup browser launches on ChromeOS. |
144 // Session restore for process-startup browser launches is tested | 145 // Session restore for process-startup browser launches is tested |
145 // in session_restore_uitest. | 146 // in session_restore_uitest. |
(...skipping 12 matching lines...) Expand all Loading... |
158 // Set the startup preference to open these URLs. | 159 // Set the startup preference to open these URLs. |
159 SessionStartupPref pref(SessionStartupPref::URLS); | 160 SessionStartupPref pref(SessionStartupPref::URLS); |
160 pref.urls = urls; | 161 pref.urls = urls; |
161 SessionStartupPref::SetStartupPref(browser()->profile(), pref); | 162 SessionStartupPref::SetStartupPref(browser()->profile(), pref); |
162 | 163 |
163 // Close the browser. | 164 // Close the browser. |
164 browser()->window()->Close(); | 165 browser()->window()->Close(); |
165 | 166 |
166 // Do a simple non-process-startup browser launch. | 167 // Do a simple non-process-startup browser launch. |
167 CommandLine dummy(CommandLine::NO_PROGRAM); | 168 CommandLine dummy(CommandLine::NO_PROGRAM); |
168 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 169 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
169 StartupBrowserCreator::IS_FIRST_RUN : | 170 browser::startup::IS_FIRST_RUN : |
170 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 171 browser::startup::IS_NOT_FIRST_RUN; |
171 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run); | 172 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); |
172 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); | 173 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); |
173 | 174 |
174 // This should have created a new browser window. |browser()| is still | 175 // This should have created a new browser window. |browser()| is still |
175 // around at this point, even though we've closed its window. | 176 // around at this point, even though we've closed its window. |
176 Browser* new_browser = NULL; | 177 Browser* new_browser = NULL; |
177 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); | 178 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); |
178 | 179 |
179 // The new browser should have one tab for each URL. | 180 // The new browser should have one tab for each URL. |
180 ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count()); | 181 ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count()); |
181 for (size_t i=0; i < urls.size(); i++) { | 182 for (size_t i=0; i < urls.size(); i++) { |
(...skipping 20 matching lines...) Expand all Loading... |
202 FilePath(FilePath::kCurrentDirectory), | 203 FilePath(FilePath::kCurrentDirectory), |
203 FilePath(FILE_PATH_LITERAL("title2.html")))); | 204 FilePath(FILE_PATH_LITERAL("title2.html")))); |
204 | 205 |
205 // Set the startup preference to open these URLs. | 206 // Set the startup preference to open these URLs. |
206 SessionStartupPref pref(SessionStartupPref::URLS); | 207 SessionStartupPref pref(SessionStartupPref::URLS); |
207 pref.urls = urls; | 208 pref.urls = urls; |
208 SessionStartupPref::SetStartupPref(browser()->profile(), pref); | 209 SessionStartupPref::SetStartupPref(browser()->profile(), pref); |
209 | 210 |
210 // Do a simple non-process-startup browser launch. | 211 // Do a simple non-process-startup browser launch. |
211 CommandLine dummy(CommandLine::NO_PROGRAM); | 212 CommandLine dummy(CommandLine::NO_PROGRAM); |
212 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 213 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
213 StartupBrowserCreator::IS_FIRST_RUN : | 214 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; |
214 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 215 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); |
215 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run); | |
216 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); | 216 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); |
217 | 217 |
218 // This should have created a new browser window. | 218 // This should have created a new browser window. |
219 Browser* new_browser = NULL; | 219 Browser* new_browser = NULL; |
220 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); | 220 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); |
221 | 221 |
222 // The new browser should have exactly one tab (not the startup URLs). | 222 // The new browser should have exactly one tab (not the startup URLs). |
223 ASSERT_EQ(1, new_browser->tab_count()); | 223 ASSERT_EQ(1, new_browser->tab_count()); |
224 } | 224 } |
225 | 225 |
226 // App shortcuts are not implemented on mac os. | 226 // App shortcuts are not implemented on mac os. |
227 #if !defined(OS_MACOSX) | 227 #if !defined(OS_MACOSX) |
228 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { | 228 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { |
229 // Load an app with launch.container = 'tab'. | 229 // Load an app with launch.container = 'tab'. |
230 const Extension* extension_app = NULL; | 230 const Extension* extension_app = NULL; |
231 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); | 231 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); |
232 | 232 |
233 // Add --app-id=<extension->id()> to the command line. | 233 // Add --app-id=<extension->id()> to the command line. |
234 CommandLine command_line(CommandLine::NO_PROGRAM); | 234 CommandLine command_line(CommandLine::NO_PROGRAM); |
235 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 235 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
236 | 236 |
237 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 237 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
238 StartupBrowserCreator::IS_FIRST_RUN : | 238 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; |
239 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 239 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); |
240 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line, | |
241 first_run); | |
242 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); | 240 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); |
243 | 241 |
244 // No pref was set, so the app should have opened in a window. | 242 // No pref was set, so the app should have opened in a window. |
245 // The launch should have created a new browser. | 243 // The launch should have created a new browser. |
246 Browser* new_browser = NULL; | 244 Browser* new_browser = NULL; |
247 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); | 245 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); |
248 | 246 |
249 // Expect an app window. | 247 // Expect an app window. |
250 EXPECT_TRUE(new_browser->is_app()); | 248 EXPECT_TRUE(new_browser->is_app()); |
251 | 249 |
252 // The browser's app_name should include the app's ID. | 250 // The browser's app_name should include the app's ID. |
253 EXPECT_NE( | 251 EXPECT_NE( |
254 new_browser->app_name_.find(extension_app->id()), | 252 new_browser->app_name_.find(extension_app->id()), |
255 std::string::npos) << new_browser->app_name_; | 253 std::string::npos) << new_browser->app_name_; |
256 } | 254 } |
257 | 255 |
258 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) { | 256 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) { |
259 const Extension* extension_app = NULL; | 257 const Extension* extension_app = NULL; |
260 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); | 258 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); |
261 | 259 |
262 // Set a pref indicating that the user wants to open this app in a window. | 260 // Set a pref indicating that the user wants to open this app in a window. |
263 SetAppLaunchPref(extension_app->id(), ExtensionPrefs::LAUNCH_WINDOW); | 261 SetAppLaunchPref(extension_app->id(), ExtensionPrefs::LAUNCH_WINDOW); |
264 | 262 |
265 CommandLine command_line(CommandLine::NO_PROGRAM); | 263 CommandLine command_line(CommandLine::NO_PROGRAM); |
266 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 264 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
267 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 265 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
268 StartupBrowserCreator::IS_FIRST_RUN : | 266 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; |
269 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 267 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); |
270 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line, | |
271 first_run); | |
272 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); | 268 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); |
273 | 269 |
274 // Pref was set to open in a window, so the app should have opened in a | 270 // Pref was set to open in a window, so the app should have opened in a |
275 // window. The launch should have created a new browser. Find the new | 271 // window. The launch should have created a new browser. Find the new |
276 // browser. | 272 // browser. |
277 Browser* new_browser = NULL; | 273 Browser* new_browser = NULL; |
278 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); | 274 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); |
279 | 275 |
280 // Expect an app window. | 276 // Expect an app window. |
281 EXPECT_TRUE(new_browser->is_app()); | 277 EXPECT_TRUE(new_browser->is_app()); |
282 | 278 |
283 // The browser's app_name should include the app's ID. | 279 // The browser's app_name should include the app's ID. |
284 EXPECT_NE( | 280 EXPECT_NE( |
285 new_browser->app_name_.find(extension_app->id()), | 281 new_browser->app_name_.find(extension_app->id()), |
286 std::string::npos) << new_browser->app_name_; | 282 std::string::npos) << new_browser->app_name_; |
287 } | 283 } |
288 | 284 |
289 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) { | 285 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) { |
290 // Load an app with launch.container = 'tab'. | 286 // Load an app with launch.container = 'tab'. |
291 const Extension* extension_app = NULL; | 287 const Extension* extension_app = NULL; |
292 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); | 288 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); |
293 | 289 |
294 // Set a pref indicating that the user wants to open this app in a window. | 290 // Set a pref indicating that the user wants to open this app in a window. |
295 SetAppLaunchPref(extension_app->id(), ExtensionPrefs::LAUNCH_REGULAR); | 291 SetAppLaunchPref(extension_app->id(), ExtensionPrefs::LAUNCH_REGULAR); |
296 | 292 |
297 CommandLine command_line(CommandLine::NO_PROGRAM); | 293 CommandLine command_line(CommandLine::NO_PROGRAM); |
298 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 294 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
299 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 295 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
300 StartupBrowserCreator::IS_FIRST_RUN : | 296 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; |
301 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 297 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); |
302 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line, | |
303 first_run); | |
304 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); | 298 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); |
305 | 299 |
306 // When an app shortcut is open and the pref indicates a tab should | 300 // When an app shortcut is open and the pref indicates a tab should |
307 // open, the tab is open in a new browser window. Expect a new window. | 301 // open, the tab is open in a new browser window. Expect a new window. |
308 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); | 302 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); |
309 | 303 |
310 Browser* new_browser = NULL; | 304 Browser* new_browser = NULL; |
311 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); | 305 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); |
312 | 306 |
313 // The tab should be in a tabbed window. | 307 // The tab should be in a tabbed window. |
314 EXPECT_TRUE(new_browser->is_type_tabbed()); | 308 EXPECT_TRUE(new_browser->is_type_tabbed()); |
315 | 309 |
316 // The browser's app_name should not include the app's ID: It is in a | 310 // The browser's app_name should not include the app's ID: It is in a |
317 // normal browser. | 311 // normal browser. |
318 EXPECT_EQ( | 312 EXPECT_EQ( |
319 new_browser->app_name_.find(extension_app->id()), | 313 new_browser->app_name_.find(extension_app->id()), |
320 std::string::npos) << new_browser->app_name_; | 314 std::string::npos) << new_browser->app_name_; |
321 } | 315 } |
322 | 316 |
323 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) { | 317 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) { |
324 // Load an app with launch.container = 'panel'. | 318 // Load an app with launch.container = 'panel'. |
325 const Extension* extension_app = NULL; | 319 const Extension* extension_app = NULL; |
326 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_panel_container", &extension_app)); | 320 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_panel_container", &extension_app)); |
327 | 321 |
328 CommandLine command_line(CommandLine::NO_PROGRAM); | 322 CommandLine command_line(CommandLine::NO_PROGRAM); |
329 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 323 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
330 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 324 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
331 StartupBrowserCreator::IS_FIRST_RUN : | 325 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; |
332 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 326 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); |
333 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line, | |
334 first_run); | |
335 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); | 327 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); |
336 | 328 |
337 // The launch should have created a new browser, with a panel type. | 329 // The launch should have created a new browser, with a panel type. |
338 Browser* new_browser = NULL; | 330 Browser* new_browser = NULL; |
339 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); | 331 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); |
340 | 332 |
341 // Expect an app panel. | 333 // Expect an app panel. |
342 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app()); | 334 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app()); |
343 | 335 |
344 // The new browser's app_name should include the app's ID. | 336 // The new browser's app_name should include the app's ID. |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_urls)); | 681 ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_urls)); |
690 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); | 682 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); |
691 ASSERT_TRUE(new_browser); | 683 ASSERT_TRUE(new_browser); |
692 ASSERT_EQ(1, new_browser->tab_count()); | 684 ASSERT_EQ(1, new_browser->tab_count()); |
693 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 685 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
694 new_browser->GetWebContentsAt(0)->GetURL()); | 686 new_browser->GetWebContentsAt(0)->GetURL()); |
695 EXPECT_EQ(1U, new_browser->GetTabContentsWrapperAt(0)->infobar_tab_helper()-> | 687 EXPECT_EQ(1U, new_browser->GetTabContentsWrapperAt(0)->infobar_tab_helper()-> |
696 infobar_count()); | 688 infobar_count()); |
697 } | 689 } |
698 #endif // !OS_CHROMEOS | 690 #endif // !OS_CHROMEOS |
OLD | NEW |