Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_browsertest.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } // namespace 89 } // namespace
90 90
91 class StartupBrowserCreatorTest : public ExtensionBrowserTest { 91 class StartupBrowserCreatorTest : public ExtensionBrowserTest {
92 protected: 92 protected:
93 StartupBrowserCreatorTest() {} 93 StartupBrowserCreatorTest() {}
94 94
95 bool SetUpUserDataDirectory() override { 95 bool SetUpUserDataDirectory() override {
96 return ExtensionBrowserTest::SetUpUserDataDirectory(); 96 return ExtensionBrowserTest::SetUpUserDataDirectory();
97 } 97 }
98 98
99 void SetUpCommandLine(CommandLine* command_line) override { 99 void SetUpCommandLine(base::CommandLine* command_line) override {
100 ExtensionBrowserTest::SetUpCommandLine(command_line); 100 ExtensionBrowserTest::SetUpCommandLine(command_line);
101 command_line->AppendSwitch(switches::kEnablePanels); 101 command_line->AppendSwitch(switches::kEnablePanels);
102 command_line->AppendSwitchASCII(switches::kHomePage, url::kAboutBlankURL); 102 command_line->AppendSwitchASCII(switches::kHomePage, url::kAboutBlankURL);
103 #if defined(OS_CHROMEOS) 103 #if defined(OS_CHROMEOS)
104 // TODO(nkostylev): Investigate if we can remove this switch. 104 // TODO(nkostylev): Investigate if we can remove this switch.
105 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests); 105 command_line->AppendSwitch(switches::kCreateBrowserOnStartupForTests);
106 #endif 106 #endif
107 } 107 }
108 108
109 // Helper functions return void so that we can ASSERT*(). 109 // Helper functions return void so that we can ASSERT*().
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 OpenURLsPopupObserver observer; 180 OpenURLsPopupObserver observer;
181 BrowserList::AddObserver(&observer); 181 BrowserList::AddObserver(&observer);
182 182
183 Browser* popup = new Browser( 183 Browser* popup = new Browser(
184 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), 184 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(),
185 browser()->host_desktop_type())); 185 browser()->host_desktop_type()));
186 ASSERT_TRUE(popup->is_type_popup()); 186 ASSERT_TRUE(popup->is_type_popup());
187 ASSERT_EQ(popup, observer.added_browser_); 187 ASSERT_EQ(popup, observer.added_browser_);
188 188
189 CommandLine dummy(CommandLine::NO_PROGRAM); 189 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
190 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 190 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
191 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 191 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
192 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 192 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
193 // This should create a new window, but re-use the profile from |popup|. If 193 // This should create a new window, but re-use the profile from |popup|. If
194 // it used a NULL or invalid profile, it would crash. 194 // it used a NULL or invalid profile, it would crash.
195 launch.OpenURLsInBrowser(popup, false, urls, chrome::GetActiveDesktop()); 195 launch.OpenURLsInBrowser(popup, false, urls, chrome::GetActiveDesktop());
196 ASSERT_NE(popup, observer.added_browser_); 196 ASSERT_NE(popup, observer.added_browser_);
197 BrowserList::RemoveObserver(&observer); 197 BrowserList::RemoveObserver(&observer);
198 } 198 }
199 199
(...skipping 14 matching lines...) Expand all
214 214
215 // Set the startup preference to open these URLs. 215 // Set the startup preference to open these URLs.
216 SessionStartupPref pref(SessionStartupPref::URLS); 216 SessionStartupPref pref(SessionStartupPref::URLS);
217 pref.urls = urls; 217 pref.urls = urls;
218 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 218 SessionStartupPref::SetStartupPref(browser()->profile(), pref);
219 219
220 // Close the browser. 220 // Close the browser.
221 browser()->window()->Close(); 221 browser()->window()->Close();
222 222
223 // Do a simple non-process-startup browser launch. 223 // Do a simple non-process-startup browser launch.
224 CommandLine dummy(CommandLine::NO_PROGRAM); 224 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
225 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 225 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
226 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 226 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
227 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 227 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
228 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 228 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
229 browser()->host_desktop_type())); 229 browser()->host_desktop_type()));
230 230
231 // This should have created a new browser window. |browser()| is still 231 // This should have created a new browser window. |browser()| is still
232 // around at this point, even though we've closed its window. 232 // around at this point, even though we've closed its window.
233 Browser* new_browser = FindOneOtherBrowser(browser()); 233 Browser* new_browser = FindOneOtherBrowser(browser());
234 ASSERT_TRUE(new_browser); 234 ASSERT_TRUE(new_browser);
(...skipping 24 matching lines...) Expand all
259 urls.push_back(ui_test_utils::GetTestUrl( 259 urls.push_back(ui_test_utils::GetTestUrl(
260 base::FilePath(base::FilePath::kCurrentDirectory), 260 base::FilePath(base::FilePath::kCurrentDirectory),
261 base::FilePath(FILE_PATH_LITERAL("title2.html")))); 261 base::FilePath(FILE_PATH_LITERAL("title2.html"))));
262 262
263 // Set the startup preference to open these URLs. 263 // Set the startup preference to open these URLs.
264 SessionStartupPref pref(SessionStartupPref::URLS); 264 SessionStartupPref pref(SessionStartupPref::URLS);
265 pref.urls = urls; 265 pref.urls = urls;
266 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 266 SessionStartupPref::SetStartupPref(browser()->profile(), pref);
267 267
268 // Do a simple non-process-startup browser launch. 268 // Do a simple non-process-startup browser launch.
269 CommandLine dummy(CommandLine::NO_PROGRAM); 269 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
270 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 270 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
271 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 271 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
272 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 272 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
273 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 273 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
274 browser()->host_desktop_type())); 274 browser()->host_desktop_type()));
275 275
276 // This should have created a new browser window. 276 // This should have created a new browser window.
277 Browser* new_browser = FindOneOtherBrowser(browser()); 277 Browser* new_browser = FindOneOtherBrowser(browser());
278 ASSERT_TRUE(new_browser); 278 ASSERT_TRUE(new_browser);
279 279
280 // The new browser should have exactly one tab (not the startup URLs). 280 // The new browser should have exactly one tab (not the startup URLs).
281 ASSERT_EQ(1, new_browser->tab_strip_model()->count()); 281 ASSERT_EQ(1, new_browser->tab_strip_model()->count());
282 } 282 }
283 283
284 #if defined(OS_WIN) 284 #if defined(OS_WIN)
285 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ActivateExistingBrowser) { 285 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ActivateExistingBrowser) {
286 // Initially, there should only be one browser open. 286 // Initially, there should only be one browser open.
287 ASSERT_TRUE(browser()); 287 ASSERT_TRUE(browser());
288 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 288 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
289 browser()->host_desktop_type())); 289 browser()->host_desktop_type()));
290 290
291 // Add --activate-existing-profile-browser to the command line and 291 // Add --activate-existing-profile-browser to the command line and
292 // start a new process. 292 // start a new process.
293 CommandLine dummy(CommandLine::NO_PROGRAM); 293 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
294 dummy.AppendSwitch(switches::kActivateExistingProfileBrowser); 294 dummy.AppendSwitch(switches::kActivateExistingProfileBrowser);
295 295
296 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( 296 StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
297 dummy, base::FilePath(), browser()->profile()->GetPath()); 297 dummy, base::FilePath(), browser()->profile()->GetPath());
298 298
299 // This should not have created a new browser window, and should have 299 // This should not have created a new browser window, and should have
300 // activated the existing browser. 300 // activated the existing browser.
301 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 301 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
302 browser()->host_desktop_type())); 302 browser()->host_desktop_type()));
303 } 303 }
304 #endif 304 #endif
305 305
306 // App shortcuts are not implemented on mac os. 306 // App shortcuts are not implemented on mac os.
307 #if !defined(OS_MACOSX) 307 #if !defined(OS_MACOSX)
308 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { 308 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) {
309 // Load an app with launch.container = 'tab'. 309 // Load an app with launch.container = 'tab'.
310 const Extension* extension_app = NULL; 310 const Extension* extension_app = NULL;
311 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); 311 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
312 312
313 // Add --app-id=<extension->id()> to the command line. 313 // Add --app-id=<extension->id()> to the command line.
314 CommandLine command_line(CommandLine::NO_PROGRAM); 314 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
315 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 315 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
316 316
317 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 317 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
318 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 318 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
319 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); 319 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run);
320 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 320 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
321 browser()->host_desktop_type())); 321 browser()->host_desktop_type()));
322 322
323 // No pref was set, so the app should have opened in a tab in a new window. 323 // No pref was set, so the app should have opened in a tab in a new window.
324 // The launch should have created a new browser. 324 // The launch should have created a new browser.
325 Browser* new_browser = FindOneOtherBrowser(browser()); 325 Browser* new_browser = FindOneOtherBrowser(browser());
326 ASSERT_TRUE(new_browser); 326 ASSERT_TRUE(new_browser);
327 327
328 // It should be a standard tabbed window, not an app window. 328 // It should be a standard tabbed window, not an app window.
329 EXPECT_FALSE(new_browser->is_app()); 329 EXPECT_FALSE(new_browser->is_app());
330 EXPECT_TRUE(new_browser->is_type_tabbed()); 330 EXPECT_TRUE(new_browser->is_type_tabbed());
331 } 331 }
332 332
333 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) { 333 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) {
334 const Extension* extension_app = NULL; 334 const Extension* extension_app = NULL;
335 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); 335 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
336 336
337 // Set a pref indicating that the user wants to open this app in a window. 337 // Set a pref indicating that the user wants to open this app in a window.
338 SetAppLaunchPref(extension_app->id(), extensions::LAUNCH_TYPE_WINDOW); 338 SetAppLaunchPref(extension_app->id(), extensions::LAUNCH_TYPE_WINDOW);
339 339
340 CommandLine command_line(CommandLine::NO_PROGRAM); 340 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
341 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 341 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
342 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 342 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
343 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 343 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
344 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); 344 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run);
345 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 345 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
346 browser()->host_desktop_type())); 346 browser()->host_desktop_type()));
347 347
348 // Pref was set to open in a window, so the app should have opened in a 348 // Pref was set to open in a window, so the app should have opened in a
349 // window. The launch should have created a new browser. Find the new 349 // window. The launch should have created a new browser. Find the new
350 // browser. 350 // browser.
(...skipping 10 matching lines...) Expand all
361 } 361 }
362 362
363 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) { 363 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) {
364 // Load an app with launch.container = 'tab'. 364 // Load an app with launch.container = 'tab'.
365 const Extension* extension_app = NULL; 365 const Extension* extension_app = NULL;
366 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); 366 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
367 367
368 // Set a pref indicating that the user wants to open this app in a window. 368 // Set a pref indicating that the user wants to open this app in a window.
369 SetAppLaunchPref(extension_app->id(), extensions::LAUNCH_TYPE_REGULAR); 369 SetAppLaunchPref(extension_app->id(), extensions::LAUNCH_TYPE_REGULAR);
370 370
371 CommandLine command_line(CommandLine::NO_PROGRAM); 371 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
372 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 372 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
373 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 373 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
374 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 374 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
375 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); 375 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run);
376 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 376 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
377 browser()->host_desktop_type())); 377 browser()->host_desktop_type()));
378 378
379 // When an app shortcut is open and the pref indicates a tab should 379 // When an app shortcut is open and the pref indicates a tab should
380 // open, the tab is open in a new browser window. Expect a new window. 380 // open, the tab is open in a new browser window. Expect a new window.
381 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(), 381 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 #define MAYBE_AddFirstRunTab DISABLED_AddFirstRunTab 427 #define MAYBE_AddFirstRunTab DISABLED_AddFirstRunTab
428 #else 428 #else
429 #define MAYBE_AddFirstRunTab AddFirstRunTab 429 #define MAYBE_AddFirstRunTab AddFirstRunTab
430 #endif 430 #endif
431 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddFirstRunTab) { 431 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddFirstRunTab) {
432 StartupBrowserCreator browser_creator; 432 StartupBrowserCreator browser_creator;
433 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 433 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
434 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html")); 434 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html"));
435 435
436 // Do a simple non-process-startup browser launch. 436 // Do a simple non-process-startup browser launch.
437 CommandLine dummy(CommandLine::NO_PROGRAM); 437 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
438 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 438 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
439 chrome::startup::IS_FIRST_RUN); 439 chrome::startup::IS_FIRST_RUN);
440 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 440 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
441 browser()->host_desktop_type())); 441 browser()->host_desktop_type()));
442 442
443 // This should have created a new browser window. 443 // This should have created a new browser window.
444 Browser* new_browser = FindOneOtherBrowser(browser()); 444 Browser* new_browser = FindOneOtherBrowser(browser());
445 ASSERT_TRUE(new_browser); 445 ASSERT_TRUE(new_browser);
446 446
447 TabStripModel* tab_strip = new_browser->tab_strip_model(); 447 TabStripModel* tab_strip = new_browser->tab_strip_model();
(...skipping 14 matching lines...) Expand all
462 #define MAYBE_AddCustomFirstRunTab AddCustomFirstRunTab 462 #define MAYBE_AddCustomFirstRunTab AddCustomFirstRunTab
463 #endif 463 #endif
464 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddCustomFirstRunTab) { 464 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddCustomFirstRunTab) {
465 StartupBrowserCreator browser_creator; 465 StartupBrowserCreator browser_creator;
466 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 466 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
467 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); 467 browser_creator.AddFirstRunTab(GURL("http://new_tab_page"));
468 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html")); 468 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html"));
469 browser_creator.AddFirstRunTab(GURL("http://welcome_page")); 469 browser_creator.AddFirstRunTab(GURL("http://welcome_page"));
470 470
471 // Do a simple non-process-startup browser launch. 471 // Do a simple non-process-startup browser launch.
472 CommandLine dummy(CommandLine::NO_PROGRAM); 472 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
473 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 473 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
474 chrome::startup::IS_FIRST_RUN); 474 chrome::startup::IS_FIRST_RUN);
475 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 475 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
476 browser()->host_desktop_type())); 476 browser()->host_desktop_type()));
477 477
478 // This should have created a new browser window. 478 // This should have created a new browser window.
479 Browser* new_browser = FindOneOtherBrowser(browser()); 479 Browser* new_browser = FindOneOtherBrowser(browser());
480 ASSERT_TRUE(new_browser); 480 ASSERT_TRUE(new_browser);
481 481
482 TabStripModel* tab_strip = new_browser->tab_strip_model(); 482 TabStripModel* tab_strip = new_browser->tab_strip_model();
483 EXPECT_EQ(4, tab_strip->count()); 483 EXPECT_EQ(4, tab_strip->count());
484 484
485 EXPECT_EQ("title1.html", 485 EXPECT_EQ("title1.html",
486 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 486 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
487 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 487 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
488 tab_strip->GetWebContentsAt(1)->GetURL()); 488 tab_strip->GetWebContentsAt(1)->GetURL());
489 EXPECT_EQ("title2.html", 489 EXPECT_EQ("title2.html",
490 tab_strip->GetWebContentsAt(2)->GetURL().ExtractFileName()); 490 tab_strip->GetWebContentsAt(2)->GetURL().ExtractFileName());
491 EXPECT_EQ(internals::GetWelcomePageURL(), 491 EXPECT_EQ(internals::GetWelcomePageURL(),
492 tab_strip->GetWebContentsAt(3)->GetURL()); 492 tab_strip->GetWebContentsAt(3)->GetURL());
493 } 493 }
494 494
495 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoNoWelcomePage) { 495 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoNoWelcomePage) {
496 // Do a simple non-process-startup browser launch. 496 // Do a simple non-process-startup browser launch.
497 CommandLine dummy(CommandLine::NO_PROGRAM); 497 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
498 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, 498 StartupBrowserCreatorImpl launch(base::FilePath(), dummy,
499 chrome::startup::IS_FIRST_RUN); 499 chrome::startup::IS_FIRST_RUN);
500 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 500 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
501 browser()->host_desktop_type())); 501 browser()->host_desktop_type()));
502 502
503 // This should have created a new browser window. 503 // This should have created a new browser window.
504 Browser* new_browser = FindOneOtherBrowser(browser()); 504 Browser* new_browser = FindOneOtherBrowser(browser());
505 ASSERT_TRUE(new_browser); 505 ASSERT_TRUE(new_browser);
506 506
507 TabStripModel* tab_strip = new_browser->tab_strip_model(); 507 TabStripModel* tab_strip = new_browser->tab_strip_model();
508 EXPECT_EQ(1, tab_strip->count()); 508 EXPECT_EQ(1, tab_strip->count());
509 509
510 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) { 510 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) {
511 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), 511 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false),
512 tab_strip->GetWebContentsAt(0)->GetURL()); 512 tab_strip->GetWebContentsAt(0)->GetURL());
513 } else { 513 } else {
514 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 514 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
515 tab_strip->GetWebContentsAt(0)->GetURL()); 515 tab_strip->GetWebContentsAt(0)->GetURL());
516 } 516 }
517 } 517 }
518 518
519 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) { 519 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) {
520 first_run::SetShouldShowWelcomePage(); 520 first_run::SetShouldShowWelcomePage();
521 521
522 // Do a simple non-process-startup browser launch. 522 // Do a simple non-process-startup browser launch.
523 CommandLine dummy(CommandLine::NO_PROGRAM); 523 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
524 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, 524 StartupBrowserCreatorImpl launch(base::FilePath(), dummy,
525 chrome::startup::IS_FIRST_RUN); 525 chrome::startup::IS_FIRST_RUN);
526 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 526 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
527 browser()->host_desktop_type())); 527 browser()->host_desktop_type()));
528 528
529 // This should have created a new browser window. 529 // This should have created a new browser window.
530 Browser* new_browser = FindOneOtherBrowser(browser()); 530 Browser* new_browser = FindOneOtherBrowser(browser());
531 ASSERT_TRUE(new_browser); 531 ASSERT_TRUE(new_browser);
532 532
533 TabStripModel* tab_strip = new_browser->tab_strip_model(); 533 TabStripModel* tab_strip = new_browser->tab_strip_model();
(...skipping 13 matching lines...) Expand all
547 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) { 547 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) {
548 StartupBrowserCreator browser_creator; 548 StartupBrowserCreator browser_creator;
549 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 549 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
550 550
551 // The welcome page should not be shown, even if 551 // The welcome page should not be shown, even if
552 // first_run::ShouldShowWelcomePage() says so, when there are already 552 // first_run::ShouldShowWelcomePage() says so, when there are already
553 // more than 2 first run tabs. 553 // more than 2 first run tabs.
554 first_run::SetShouldShowWelcomePage(); 554 first_run::SetShouldShowWelcomePage();
555 555
556 // Do a simple non-process-startup browser launch. 556 // Do a simple non-process-startup browser launch.
557 CommandLine dummy(CommandLine::NO_PROGRAM); 557 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
558 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 558 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
559 chrome::startup::IS_FIRST_RUN); 559 chrome::startup::IS_FIRST_RUN);
560 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 560 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
561 browser()->host_desktop_type())); 561 browser()->host_desktop_type()));
562 562
563 // This should have created a new browser window. 563 // This should have created a new browser window.
564 Browser* new_browser = FindOneOtherBrowser(browser()); 564 Browser* new_browser = FindOneOtherBrowser(browser());
565 ASSERT_TRUE(new_browser); 565 ASSERT_TRUE(new_browser);
566 566
567 TabStripModel* tab_strip = new_browser->tab_strip_model(); 567 TabStripModel* tab_strip = new_browser->tab_strip_model();
(...skipping 12 matching lines...) Expand all
580 580
581 // The welcome page should still be shown if there are more than 2 first run 581 // The welcome page should still be shown if there are more than 2 first run
582 // tabs, but the welcome page was explcitly added to the first run tabs. 582 // tabs, but the welcome page was explcitly added to the first run tabs.
583 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 583 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
584 SyncPromoWithFirstRunTabsIncludingWelcomePage) { 584 SyncPromoWithFirstRunTabsIncludingWelcomePage) {
585 StartupBrowserCreator browser_creator; 585 StartupBrowserCreator browser_creator;
586 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 586 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
587 browser_creator.AddFirstRunTab(GURL("http://welcome_page")); 587 browser_creator.AddFirstRunTab(GURL("http://welcome_page"));
588 588
589 // Do a simple non-process-startup browser launch. 589 // Do a simple non-process-startup browser launch.
590 CommandLine dummy(CommandLine::NO_PROGRAM); 590 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
591 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 591 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
592 chrome::startup::IS_FIRST_RUN); 592 chrome::startup::IS_FIRST_RUN);
593 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 593 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
594 browser()->host_desktop_type())); 594 browser()->host_desktop_type()));
595 595
596 // This should have created a new browser window. 596 // This should have created a new browser window.
597 Browser* new_browser = FindOneOtherBrowser(browser()); 597 Browser* new_browser = FindOneOtherBrowser(browser());
598 ASSERT_TRUE(new_browser); 598 ASSERT_TRUE(new_browser);
599 599
600 TabStripModel* tab_strip = new_browser->tab_strip_model(); 600 TabStripModel* tab_strip = new_browser->tab_strip_model();
(...skipping 11 matching lines...) Expand all
612 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 612 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
613 EXPECT_EQ(internals::GetWelcomePageURL(), 613 EXPECT_EQ(internals::GetWelcomePageURL(),
614 tab_strip->GetWebContentsAt(1)->GetURL()); 614 tab_strip->GetWebContentsAt(1)->GetURL());
615 } 615 }
616 } 616 }
617 617
618 #if !defined(OS_CHROMEOS) 618 #if !defined(OS_CHROMEOS)
619 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) { 619 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) {
620 #if defined(OS_WIN) && defined(USE_ASH) 620 #if defined(OS_WIN) && defined(USE_ASH)
621 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 621 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
622 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 622 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
623 switches::kAshBrowserTests))
623 return; 624 return;
624 #endif 625 #endif
625 626
626 Profile* default_profile = browser()->profile(); 627 Profile* default_profile = browser()->profile();
627 628
628 ProfileManager* profile_manager = g_browser_process->profile_manager(); 629 ProfileManager* profile_manager = g_browser_process->profile_manager();
629 // Create another profile. 630 // Create another profile.
630 base::FilePath dest_path = profile_manager->user_data_dir(); 631 base::FilePath dest_path = profile_manager->user_data_dir();
631 dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile 1")); 632 dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile 1"));
632 633
(...skipping 15 matching lines...) Expand all
648 pref1.urls = urls1; 649 pref1.urls = urls1;
649 SessionStartupPref::SetStartupPref(default_profile, pref1); 650 SessionStartupPref::SetStartupPref(default_profile, pref1);
650 SessionStartupPref pref2(SessionStartupPref::URLS); 651 SessionStartupPref pref2(SessionStartupPref::URLS);
651 pref2.urls = urls2; 652 pref2.urls = urls2;
652 SessionStartupPref::SetStartupPref(other_profile, pref2); 653 SessionStartupPref::SetStartupPref(other_profile, pref2);
653 654
654 // Close the browser. 655 // Close the browser.
655 browser()->window()->Close(); 656 browser()->window()->Close();
656 657
657 // Do a simple non-process-startup browser launch. 658 // Do a simple non-process-startup browser launch.
658 CommandLine dummy(CommandLine::NO_PROGRAM); 659 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
659 660
660 int return_code; 661 int return_code;
661 StartupBrowserCreator browser_creator; 662 StartupBrowserCreator browser_creator;
662 std::vector<Profile*> last_opened_profiles; 663 std::vector<Profile*> last_opened_profiles;
663 last_opened_profiles.push_back(default_profile); 664 last_opened_profiles.push_back(default_profile);
664 last_opened_profiles.push_back(other_profile); 665 last_opened_profiles.push_back(other_profile);
665 browser_creator.Start(dummy, profile_manager->user_data_dir(), 666 browser_creator.Start(dummy, profile_manager->user_data_dir(),
666 default_profile, last_opened_profiles, &return_code); 667 default_profile, last_opened_profiles, &return_code);
667 668
668 // urls1 were opened in a browser for default_profile, and urls2 were opened 669 // urls1 were opened in a browser for default_profile, and urls2 were opened
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 profile1->GetPrefs()->CommitPendingWrite(); 743 profile1->GetPrefs()->CommitPendingWrite();
743 profile2->GetPrefs()->CommitPendingWrite(); 744 profile2->GetPrefs()->CommitPendingWrite();
744 } 745 }
745 746
746 // See crbug.com/376184 about improvements to this test on Mac. 747 // See crbug.com/376184 about improvements to this test on Mac.
747 // Disabled because it's flaky. http://crbug.com/379579 748 // Disabled because it's flaky. http://crbug.com/379579
748 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 749 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
749 DISABLED_UpdateWithTwoProfiles) { 750 DISABLED_UpdateWithTwoProfiles) {
750 #if defined(OS_WIN) && defined(USE_ASH) 751 #if defined(OS_WIN) && defined(USE_ASH)
751 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 752 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
752 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 753 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
754 switches::kAshBrowserTests))
753 return; 755 return;
754 #endif 756 #endif
755 757
756 // Make StartupBrowserCreator::WasRestarted() return true. 758 // Make StartupBrowserCreator::WasRestarted() return true.
757 StartupBrowserCreator::was_restarted_read_ = false; 759 StartupBrowserCreator::was_restarted_read_ = false;
758 PrefService* pref_service = g_browser_process->local_state(); 760 PrefService* pref_service = g_browser_process->local_state();
759 pref_service->SetBoolean(prefs::kWasRestarted, true); 761 pref_service->SetBoolean(prefs::kWasRestarted, true);
760 762
761 ProfileManager* profile_manager = g_browser_process->profile_manager(); 763 ProfileManager* profile_manager = g_browser_process->profile_manager();
762 764
763 // Open the two profiles. 765 // Open the two profiles.
764 base::FilePath dest_path = profile_manager->user_data_dir(); 766 base::FilePath dest_path = profile_manager->user_data_dir();
765 767
766 Profile* profile1 = profile_manager->GetProfile( 768 Profile* profile1 = profile_manager->GetProfile(
767 dest_path.Append(FILE_PATH_LITERAL("New Profile 1"))); 769 dest_path.Append(FILE_PATH_LITERAL("New Profile 1")));
768 ASSERT_TRUE(profile1); 770 ASSERT_TRUE(profile1);
769 771
770 Profile* profile2 = profile_manager->GetProfile( 772 Profile* profile2 = profile_manager->GetProfile(
771 dest_path.Append(FILE_PATH_LITERAL("New Profile 2"))); 773 dest_path.Append(FILE_PATH_LITERAL("New Profile 2")));
772 ASSERT_TRUE(profile2); 774 ASSERT_TRUE(profile2);
773 775
774 // Simulate a launch after a browser update. 776 // Simulate a launch after a browser update.
775 CommandLine dummy(CommandLine::NO_PROGRAM); 777 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
776 int return_code; 778 int return_code;
777 StartupBrowserCreator browser_creator; 779 StartupBrowserCreator browser_creator;
778 std::vector<Profile*> last_opened_profiles; 780 std::vector<Profile*> last_opened_profiles;
779 last_opened_profiles.push_back(profile1); 781 last_opened_profiles.push_back(profile1);
780 last_opened_profiles.push_back(profile2); 782 last_opened_profiles.push_back(profile2);
781 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile1, 783 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile1,
782 last_opened_profiles, &return_code); 784 last_opened_profiles, &return_code);
783 785
784 while (SessionRestore::IsRestoring(profile1) || 786 while (SessionRestore::IsRestoring(profile1) ||
785 SessionRestore::IsRestoring(profile2)) 787 SessionRestore::IsRestoring(profile2))
(...skipping 21 matching lines...) Expand all
807 tab_strip = new_browser->tab_strip_model(); 809 tab_strip = new_browser->tab_strip_model();
808 ASSERT_EQ(1, tab_strip->count()); 810 ASSERT_EQ(1, tab_strip->count());
809 EXPECT_EQ("/files/form.html", 811 EXPECT_EQ("/files/form.html",
810 tab_strip->GetWebContentsAt(0)->GetURL().path()); 812 tab_strip->GetWebContentsAt(0)->GetURL().path());
811 } 813 }
812 814
813 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 815 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
814 ProfilesWithoutPagesNotLaunched) { 816 ProfilesWithoutPagesNotLaunched) {
815 #if defined(OS_WIN) && defined(USE_ASH) 817 #if defined(OS_WIN) && defined(USE_ASH)
816 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 818 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
817 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 819 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
820 switches::kAshBrowserTests))
818 return; 821 return;
819 #endif 822 #endif
820 823
821 Profile* default_profile = browser()->profile(); 824 Profile* default_profile = browser()->profile();
822 825
823 ProfileManager* profile_manager = g_browser_process->profile_manager(); 826 ProfileManager* profile_manager = g_browser_process->profile_manager();
824 827
825 // Create 4 more profiles. 828 // Create 4 more profiles.
826 base::FilePath dest_path1 = profile_manager->user_data_dir().Append( 829 base::FilePath dest_path1 = profile_manager->user_data_dir().Append(
827 FILE_PATH_LITERAL("New Profile 1")); 830 FILE_PATH_LITERAL("New Profile 1"));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 ui_test_utils::NavigateToURL(browser_last, 870 ui_test_utils::NavigateToURL(browser_last,
868 test_server()->GetURL("files/empty.html")); 871 test_server()->GetURL("files/empty.html"));
869 browser_last->window()->Close(); 872 browser_last->window()->Close();
870 873
871 // Close the main browser. 874 // Close the main browser.
872 chrome::HostDesktopType original_desktop_type = 875 chrome::HostDesktopType original_desktop_type =
873 browser()->host_desktop_type(); 876 browser()->host_desktop_type();
874 browser()->window()->Close(); 877 browser()->window()->Close();
875 878
876 // Do a simple non-process-startup browser launch. 879 // Do a simple non-process-startup browser launch.
877 CommandLine dummy(CommandLine::NO_PROGRAM); 880 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
878 881
879 int return_code; 882 int return_code;
880 StartupBrowserCreator browser_creator; 883 StartupBrowserCreator browser_creator;
881 std::vector<Profile*> last_opened_profiles; 884 std::vector<Profile*> last_opened_profiles;
882 last_opened_profiles.push_back(profile_home1); 885 last_opened_profiles.push_back(profile_home1);
883 last_opened_profiles.push_back(profile_home2); 886 last_opened_profiles.push_back(profile_home2);
884 last_opened_profiles.push_back(profile_last); 887 last_opened_profiles.push_back(profile_last);
885 last_opened_profiles.push_back(profile_urls); 888 last_opened_profiles.push_back(profile_urls);
886 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home1, 889 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home1,
887 last_opened_profiles, &return_code); 890 last_opened_profiles, &return_code);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 EXPECT_EQ("/files/empty.html", 924 EXPECT_EQ("/files/empty.html",
922 tab_strip->GetWebContentsAt(0)->GetURL().path()); 925 tab_strip->GetWebContentsAt(0)->GetURL().path());
923 926
924 // profile_home2 was not launched since it would've only opened the home page. 927 // profile_home2 was not launched since it would've only opened the home page.
925 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type)); 928 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type));
926 } 929 }
927 930
928 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { 931 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
929 #if defined(OS_WIN) && defined(USE_ASH) 932 #if defined(OS_WIN) && defined(USE_ASH)
930 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 933 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
931 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 934 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
935 switches::kAshBrowserTests))
932 return; 936 return;
933 #endif 937 #endif
934 938
935 // After an unclean exit, all profiles will be launched. However, they won't 939 // After an unclean exit, all profiles will be launched. However, they won't
936 // open any pages automatically. 940 // open any pages automatically.
937 941
938 ProfileManager* profile_manager = g_browser_process->profile_manager(); 942 ProfileManager* profile_manager = g_browser_process->profile_manager();
939 943
940 // Create 3 profiles. 944 // Create 3 profiles.
941 base::FilePath dest_path1 = profile_manager->user_data_dir().Append( 945 base::FilePath dest_path1 = profile_manager->user_data_dir().Append(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 // 987 //
984 // On Mac OS X, an infobar is shown to restore the previous session, which 988 // On Mac OS X, an infobar is shown to restore the previous session, which
985 // is tested by function EnsureRestoreUIWasShown. 989 // is tested by function EnsureRestoreUIWasShown.
986 // 990 //
987 // Under a Google Chrome build, it is not tested because a task is posted to 991 // Under a Google Chrome build, it is not tested because a task is posted to
988 // the file thread before the bubble is shown. It is difficult to make sure 992 // the file thread before the bubble is shown. It is difficult to make sure
989 // that the histogram check runs after all threads have finished their tasks. 993 // that the histogram check runs after all threads have finished their tasks.
990 base::HistogramTester histogram_tester; 994 base::HistogramTester histogram_tester;
991 #endif // !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD) 995 #endif // !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD)
992 996
993 CommandLine dummy(CommandLine::NO_PROGRAM); 997 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
994 dummy.AppendSwitchASCII(switches::kTestType, "browser"); 998 dummy.AppendSwitchASCII(switches::kTestType, "browser");
995 int return_code; 999 int return_code;
996 StartupBrowserCreator browser_creator; 1000 StartupBrowserCreator browser_creator;
997 std::vector<Profile*> last_opened_profiles; 1001 std::vector<Profile*> last_opened_profiles;
998 last_opened_profiles.push_back(profile_home); 1002 last_opened_profiles.push_back(profile_home);
999 last_opened_profiles.push_back(profile_last); 1003 last_opened_profiles.push_back(profile_last);
1000 last_opened_profiles.push_back(profile_urls); 1004 last_opened_profiles.push_back(profile_urls);
1001 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home, 1005 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home,
1002 last_opened_profiles, &return_code); 1006 last_opened_profiles, &return_code);
1003 1007
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1047
1044 #if !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD) 1048 #if !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD)
1045 // Each profile should have one session restore bubble shown, so we should 1049 // Each profile should have one session restore bubble shown, so we should
1046 // observe count 3 in bucket 0 (which represents bubble shown). 1050 // observe count 3 in bucket 0 (which represents bubble shown).
1047 histogram_tester.ExpectBucketCount("SessionCrashed.Bubble", 0, 3); 1051 histogram_tester.ExpectBucketCount("SessionCrashed.Bubble", 0, 3);
1048 #endif // !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD) 1052 #endif // !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD)
1049 } 1053 }
1050 1054
1051 class SupervisedUserBrowserCreatorTest : public InProcessBrowserTest { 1055 class SupervisedUserBrowserCreatorTest : public InProcessBrowserTest {
1052 protected: 1056 protected:
1053 void SetUpCommandLine(CommandLine* command_line) override { 1057 void SetUpCommandLine(base::CommandLine* command_line) override {
1054 InProcessBrowserTest::SetUpCommandLine(command_line); 1058 InProcessBrowserTest::SetUpCommandLine(command_line);
1055 command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf"); 1059 command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf");
1056 } 1060 }
1057 }; 1061 };
1058 1062
1059 IN_PROC_BROWSER_TEST_F(SupervisedUserBrowserCreatorTest, 1063 IN_PROC_BROWSER_TEST_F(SupervisedUserBrowserCreatorTest,
1060 StartupSupervisedUserProfile) { 1064 StartupSupervisedUserProfile) {
1061 StartupBrowserCreator browser_creator; 1065 StartupBrowserCreator browser_creator;
1062 1066
1063 // Do a simple non-process-startup browser launch. 1067 // Do a simple non-process-startup browser launch.
1064 CommandLine dummy(CommandLine::NO_PROGRAM); 1068 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1065 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1069 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1066 chrome::startup::IS_FIRST_RUN); 1070 chrome::startup::IS_FIRST_RUN);
1067 content::WindowedNotificationObserver observer( 1071 content::WindowedNotificationObserver observer(
1068 content::NOTIFICATION_LOAD_STOP, 1072 content::NOTIFICATION_LOAD_STOP,
1069 content::NotificationService::AllSources()); 1073 content::NotificationService::AllSources());
1070 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 1074 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
1071 browser()->host_desktop_type())); 1075 browser()->host_desktop_type()));
1072 1076
1073 // This should have created a new browser window. 1077 // This should have created a new browser window.
1074 Browser* new_browser = FindOneOtherBrowser(browser()); 1078 Browser* new_browser = FindOneOtherBrowser(browser());
(...skipping 10 matching lines...) Expand all
1085 // the sync promo exist there. 1089 // the sync promo exist there.
1086 #if !defined(OS_CHROMEOS) 1090 #if !defined(OS_CHROMEOS)
1087 1091
1088 // On a branded Linux build, policy is required to suppress the first-run 1092 // On a branded Linux build, policy is required to suppress the first-run
1089 // dialog. 1093 // dialog.
1090 #if !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || \ 1094 #if !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || \
1091 defined(ENABLE_CONFIGURATION_POLICY) 1095 defined(ENABLE_CONFIGURATION_POLICY)
1092 1096
1093 class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest { 1097 class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest {
1094 protected: 1098 protected:
1095 void SetUpCommandLine(CommandLine* command_line) override; 1099 void SetUpCommandLine(base::CommandLine* command_line) override;
1096 void SetUpInProcessBrowserTestFixture() override; 1100 void SetUpInProcessBrowserTestFixture() override;
1097 1101
1098 #if defined(ENABLE_CONFIGURATION_POLICY) 1102 #if defined(ENABLE_CONFIGURATION_POLICY)
1099 policy::MockConfigurationPolicyProvider provider_; 1103 policy::MockConfigurationPolicyProvider provider_;
1100 policy::PolicyMap policy_map_; 1104 policy::PolicyMap policy_map_;
1101 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1105 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1102 }; 1106 };
1103 1107
1104 void StartupBrowserCreatorFirstRunTest::SetUpCommandLine( 1108 void StartupBrowserCreatorFirstRunTest::SetUpCommandLine(
1105 CommandLine* command_line) { 1109 base::CommandLine* command_line) {
1106 command_line->AppendSwitch(switches::kForceFirstRun); 1110 command_line->AppendSwitch(switches::kForceFirstRun);
1107 } 1111 }
1108 1112
1109 void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() { 1113 void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() {
1110 #if defined(ENABLE_CONFIGURATION_POLICY) 1114 #if defined(ENABLE_CONFIGURATION_POLICY)
1111 #if defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) 1115 #if defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD)
1112 // Set a policy that prevents the first-run dialog from being shown. 1116 // Set a policy that prevents the first-run dialog from being shown.
1113 policy_map_.Set(policy::key::kMetricsReportingEnabled, 1117 policy_map_.Set(policy::key::kMetricsReportingEnabled,
1114 policy::POLICY_LEVEL_MANDATORY, 1118 policy::POLICY_LEVEL_MANDATORY,
1115 policy::POLICY_SCOPE_USER, 1119 policy::POLICY_SCOPE_USER,
(...skipping 23 matching lines...) Expand all
1139 // { 1143 // {
1140 // "sync_promo": { 1144 // "sync_promo": {
1141 // "show_on_first_run_allowed": false 1145 // "show_on_first_run_allowed": false
1142 // } 1146 // }
1143 // } 1147 // }
1144 StartupBrowserCreator browser_creator; 1148 StartupBrowserCreator browser_creator;
1145 browser()->profile()->GetPrefs()->SetBoolean( 1149 browser()->profile()->GetPrefs()->SetBoolean(
1146 prefs::kSignInPromoShowOnFirstRunAllowed, false); 1150 prefs::kSignInPromoShowOnFirstRunAllowed, false);
1147 1151
1148 // Do a process-startup browser launch. 1152 // Do a process-startup browser launch.
1149 CommandLine dummy(CommandLine::NO_PROGRAM); 1153 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1150 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1154 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1151 chrome::startup::IS_FIRST_RUN); 1155 chrome::startup::IS_FIRST_RUN);
1152 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1156 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1153 browser()->host_desktop_type())); 1157 browser()->host_desktop_type()));
1154 1158
1155 // This should have created a new browser window. 1159 // This should have created a new browser window.
1156 Browser* new_browser = FindOneOtherBrowser(browser()); 1160 Browser* new_browser = FindOneOtherBrowser(browser());
1157 ASSERT_TRUE(new_browser); 1161 ASSERT_TRUE(new_browser);
1158 1162
1159 // Verify that the NTP and the welcome page are shown. 1163 // Verify that the NTP and the welcome page are shown.
(...skipping 20 matching lines...) Expand all
1180 // { 1184 // {
1181 // "sync_promo": { 1185 // "sync_promo": {
1182 // "show_on_first_run_allowed": true 1186 // "show_on_first_run_allowed": true
1183 // } 1187 // }
1184 // } 1188 // }
1185 StartupBrowserCreator browser_creator; 1189 StartupBrowserCreator browser_creator;
1186 browser()->profile()->GetPrefs()->SetBoolean( 1190 browser()->profile()->GetPrefs()->SetBoolean(
1187 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1191 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1188 1192
1189 // Do a process-startup browser launch. 1193 // Do a process-startup browser launch.
1190 CommandLine dummy(CommandLine::NO_PROGRAM); 1194 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1191 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1195 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1192 chrome::startup::IS_FIRST_RUN); 1196 chrome::startup::IS_FIRST_RUN);
1193 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1197 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1194 browser()->host_desktop_type())); 1198 browser()->host_desktop_type()));
1195 1199
1196 // This should have created a new browser window. 1200 // This should have created a new browser window.
1197 Browser* new_browser = FindOneOtherBrowser(browser()); 1201 Browser* new_browser = FindOneOtherBrowser(browser());
1198 ASSERT_TRUE(new_browser); 1202 ASSERT_TRUE(new_browser);
1199 1203
1200 // Verify that the sync promo and the welcome page are shown. 1204 // Verify that the sync promo and the welcome page are shown.
(...skipping 21 matching lines...) Expand all
1222 // "sync_promo": { 1226 // "sync_promo": {
1223 // "show_on_first_run_allowed": true 1227 // "show_on_first_run_allowed": true
1224 // } 1228 // }
1225 // } 1229 // }
1226 StartupBrowserCreator browser_creator; 1230 StartupBrowserCreator browser_creator;
1227 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 1231 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
1228 browser()->profile()->GetPrefs()->SetBoolean( 1232 browser()->profile()->GetPrefs()->SetBoolean(
1229 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1233 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1230 1234
1231 // Do a process-startup browser launch. 1235 // Do a process-startup browser launch.
1232 CommandLine dummy(CommandLine::NO_PROGRAM); 1236 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1233 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1237 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1234 chrome::startup::IS_FIRST_RUN); 1238 chrome::startup::IS_FIRST_RUN);
1235 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1239 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1236 browser()->host_desktop_type())); 1240 browser()->host_desktop_type()));
1237 1241
1238 // This should have created a new browser window. 1242 // This should have created a new browser window.
1239 Browser* new_browser = FindOneOtherBrowser(browser()); 1243 Browser* new_browser = FindOneOtherBrowser(browser());
1240 ASSERT_TRUE(new_browser); 1244 ASSERT_TRUE(new_browser);
1241 1245
1242 // Verify that the first-run tab is shown and the sync promo has been added. 1246 // Verify that the first-run tab is shown and the sync promo has been added.
(...skipping 26 matching lines...) Expand all
1269 // } 1273 // }
1270 ASSERT_TRUE(test_server()->Start()); 1274 ASSERT_TRUE(test_server()->Start());
1271 StartupBrowserCreator browser_creator; 1275 StartupBrowserCreator browser_creator;
1272 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 1276 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
1273 browser_creator.AddFirstRunTab( 1277 browser_creator.AddFirstRunTab(
1274 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false)); 1278 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false));
1275 browser()->profile()->GetPrefs()->SetBoolean( 1279 browser()->profile()->GetPrefs()->SetBoolean(
1276 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1280 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1277 1281
1278 // Do a process-startup browser launch. 1282 // Do a process-startup browser launch.
1279 CommandLine dummy(CommandLine::NO_PROGRAM); 1283 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1280 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1284 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1281 chrome::startup::IS_FIRST_RUN); 1285 chrome::startup::IS_FIRST_RUN);
1282 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1286 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1283 browser()->host_desktop_type())); 1287 browser()->host_desktop_type()));
1284 1288
1285 // This should have created a new browser window. 1289 // This should have created a new browser window.
1286 Browser* new_browser = FindOneOtherBrowser(browser()); 1290 Browser* new_browser = FindOneOtherBrowser(browser());
1287 ASSERT_TRUE(new_browser); 1291 ASSERT_TRUE(new_browser);
1288 1292
1289 // Verify that the first-run tabs are shown and no sync promo has been added 1293 // Verify that the first-run tabs are shown and no sync promo has been added
(...skipping 26 matching lines...) Expand all
1316 // "show_on_first_run_allowed": true 1320 // "show_on_first_run_allowed": true
1317 // } 1321 // }
1318 // } 1322 // }
1319 StartupBrowserCreator browser_creator; 1323 StartupBrowserCreator browser_creator;
1320 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); 1324 browser_creator.AddFirstRunTab(GURL("http://new_tab_page"));
1321 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 1325 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
1322 browser()->profile()->GetPrefs()->SetBoolean( 1326 browser()->profile()->GetPrefs()->SetBoolean(
1323 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1327 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1324 1328
1325 // Do a process-startup browser launch. 1329 // Do a process-startup browser launch.
1326 CommandLine dummy(CommandLine::NO_PROGRAM); 1330 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1327 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1331 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1328 chrome::startup::IS_FIRST_RUN); 1332 chrome::startup::IS_FIRST_RUN);
1329 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1333 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1330 browser()->host_desktop_type())); 1334 browser()->host_desktop_type()));
1331 1335
1332 // This should have created a new browser window. 1336 // This should have created a new browser window.
1333 Browser* new_browser = FindOneOtherBrowser(browser()); 1337 Browser* new_browser = FindOneOtherBrowser(browser());
1334 ASSERT_TRUE(new_browser); 1338 ASSERT_TRUE(new_browser);
1335 1339
1336 // Verify that the first-run tabs are shown but the NTP that they contain has 1340 // Verify that the first-run tabs are shown but the NTP that they contain has
(...skipping 26 matching lines...) Expand all
1363 // "show_on_first_run_allowed": false 1367 // "show_on_first_run_allowed": false
1364 // } 1368 // }
1365 // } 1369 // }
1366 StartupBrowserCreator browser_creator; 1370 StartupBrowserCreator browser_creator;
1367 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); 1371 browser_creator.AddFirstRunTab(GURL("http://new_tab_page"));
1368 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 1372 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
1369 browser()->profile()->GetPrefs()->SetBoolean( 1373 browser()->profile()->GetPrefs()->SetBoolean(
1370 prefs::kSignInPromoShowOnFirstRunAllowed, false); 1374 prefs::kSignInPromoShowOnFirstRunAllowed, false);
1371 1375
1372 // Do a process-startup browser launch. 1376 // Do a process-startup browser launch.
1373 CommandLine dummy(CommandLine::NO_PROGRAM); 1377 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1374 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1378 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1375 chrome::startup::IS_FIRST_RUN); 1379 chrome::startup::IS_FIRST_RUN);
1376 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1380 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1377 browser()->host_desktop_type())); 1381 browser()->host_desktop_type()));
1378 1382
1379 // This should have created a new browser window. 1383 // This should have created a new browser window.
1380 Browser* new_browser = FindOneOtherBrowser(browser()); 1384 Browser* new_browser = FindOneOtherBrowser(browser());
1381 ASSERT_TRUE(new_browser); 1385 ASSERT_TRUE(new_browser);
1382 1386
1383 // Verify that the first-run tabs are shown, the NTP that they contain has not 1387 // Verify that the first-run tabs are shown, the NTP that they contain has not
(...skipping 23 matching lines...) Expand all
1407 // "sync_promo": { 1411 // "sync_promo": {
1408 // "show_on_first_run_allowed": false 1412 // "show_on_first_run_allowed": false
1409 // } 1413 // }
1410 // } 1414 // }
1411 StartupBrowserCreator browser_creator; 1415 StartupBrowserCreator browser_creator;
1412 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 1416 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
1413 browser()->profile()->GetPrefs()->SetBoolean( 1417 browser()->profile()->GetPrefs()->SetBoolean(
1414 prefs::kSignInPromoShowOnFirstRunAllowed, false); 1418 prefs::kSignInPromoShowOnFirstRunAllowed, false);
1415 1419
1416 // Do a process-startup browser launch. 1420 // Do a process-startup browser launch.
1417 CommandLine dummy(CommandLine::NO_PROGRAM); 1421 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1418 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1422 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1419 chrome::startup::IS_FIRST_RUN); 1423 chrome::startup::IS_FIRST_RUN);
1420 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1424 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1421 browser()->host_desktop_type())); 1425 browser()->host_desktop_type()));
1422 1426
1423 // This should have created a new browser window. 1427 // This should have created a new browser window.
1424 Browser* new_browser = FindOneOtherBrowser(browser()); 1428 Browser* new_browser = FindOneOtherBrowser(browser());
1425 ASSERT_TRUE(new_browser); 1429 ASSERT_TRUE(new_browser);
1426 1430
1427 // Verify that the first-run tab is shown and no sync promo has been added. 1431 // Verify that the first-run tab is shown and no sync promo has been added.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 base::ListValue startup_urls; 1468 base::ListValue startup_urls;
1465 startup_urls.Append( 1469 startup_urls.Append(
1466 new base::StringValue(test_server()->GetURL("files/title1.html").spec())); 1470 new base::StringValue(test_server()->GetURL("files/title1.html").spec()));
1467 policy_map_.Set(policy::key::kRestoreOnStartupURLs, 1471 policy_map_.Set(policy::key::kRestoreOnStartupURLs,
1468 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, 1472 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
1469 startup_urls.DeepCopy(), NULL); 1473 startup_urls.DeepCopy(), NULL);
1470 provider_.UpdateChromePolicy(policy_map_); 1474 provider_.UpdateChromePolicy(policy_map_);
1471 base::RunLoop().RunUntilIdle(); 1475 base::RunLoop().RunUntilIdle();
1472 1476
1473 // Do a process-startup browser launch. 1477 // Do a process-startup browser launch.
1474 CommandLine dummy(CommandLine::NO_PROGRAM); 1478 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1475 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1479 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1476 chrome::startup::IS_FIRST_RUN); 1480 chrome::startup::IS_FIRST_RUN);
1477 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1481 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1478 browser()->host_desktop_type())); 1482 browser()->host_desktop_type()));
1479 1483
1480 // This should have created a new browser window. 1484 // This should have created a new browser window.
1481 Browser* new_browser = FindOneOtherBrowser(browser()); 1485 Browser* new_browser = FindOneOtherBrowser(browser());
1482 ASSERT_TRUE(new_browser); 1486 ASSERT_TRUE(new_browser);
1483 1487
1484 // Verify that the URL specified through policy is shown and no sync promo has 1488 // Verify that the URL specified through policy is shown and no sync promo has
1485 // been added. 1489 // been added.
1486 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1490 TabStripModel* tab_strip = new_browser->tab_strip_model();
1487 ASSERT_EQ(1, tab_strip->count()); 1491 ASSERT_EQ(1, tab_strip->count());
1488 EXPECT_EQ("title1.html", 1492 EXPECT_EQ("title1.html",
1489 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1493 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1490 } 1494 }
1491 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1495 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1492 1496
1493 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1497 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1494 // defined(ENABLE_CONFIGURATION_POLICY) 1498 // defined(ENABLE_CONFIGURATION_POLICY)
1495 1499
1496 #endif // !defined(OS_CHROMEOS) 1500 #endif // !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | chrome/browser/ui/startup/startup_browser_creator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698