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

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

Issue 1226643002: Welcome page changes for Windows 10 and over. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix chromeos build Created 5 years, 5 months 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 24 matching lines...) Expand all
35 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" 35 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
36 #include "chrome/browser/ui/tabs/tab_strip_model.h" 36 #include "chrome/browser/ui/tabs/tab_strip_model.h"
37 #include "chrome/common/chrome_switches.h" 37 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/extensions/extension_constants.h" 38 #include "chrome/common/extensions/extension_constants.h"
39 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
40 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
41 #include "chrome/test/base/in_process_browser_test.h" 41 #include "chrome/test/base/in_process_browser_test.h"
42 #include "chrome/test/base/test_switches.h" 42 #include "chrome/test/base/test_switches.h"
43 #include "chrome/test/base/ui_test_utils.h" 43 #include "chrome/test/base/ui_test_utils.h"
44 #include "content/public/browser/web_contents.h" 44 #include "content/public/browser/web_contents.h"
45 #include "content/public/test/test_utils.h"
45 #include "extensions/browser/extension_system.h" 46 #include "extensions/browser/extension_system.h"
46 #include "testing/gtest/include/gtest/gtest.h" 47 #include "testing/gtest/include/gtest/gtest.h"
47 #include "url/gurl.h" 48 #include "url/gurl.h"
48 49
49 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) 50 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS)
50 #include "base/callback.h" 51 #include "base/callback.h"
51 #include "base/run_loop.h" 52 #include "base/run_loop.h"
52 #include "base/values.h" 53 #include "base/values.h"
53 #include "components/policy/core/browser/browser_policy_connector.h" 54 #include "components/policy/core/browser/browser_policy_connector.h"
54 #include "components/policy/core/common/external_data_fetcher.h" 55 #include "components/policy/core/common/external_data_fetcher.h"
55 #include "components/policy/core/common/mock_configuration_policy_provider.h" 56 #include "components/policy/core/common/mock_configuration_policy_provider.h"
56 #include "components/policy/core/common/policy_map.h" 57 #include "components/policy/core/common/policy_map.h"
57 #include "components/policy/core/common/policy_types.h" 58 #include "components/policy/core/common/policy_types.h"
58 #include "policy/policy_constants.h" 59 #include "policy/policy_constants.h"
59 #include "testing/gmock/include/gmock/gmock.h" 60 #include "testing/gmock/include/gmock/gmock.h"
60 61
61 using testing::_; 62 using testing::_;
62 using testing::Return; 63 using testing::Return;
63 #endif // defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) 64 #endif // defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS)
64 65
65 #if defined(ENABLE_SUPERVISED_USERS) 66 #if defined(ENABLE_SUPERVISED_USERS)
66 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" 67 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h"
67 #include "chrome/browser/supervised_user/supervised_user_service.h" 68 #include "chrome/browser/supervised_user/supervised_user_service.h"
68 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" 69 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
69 #endif 70 #endif
70 71
72 #if defined(OS_WIN)
73 #include "base/win/windows_version.h"
74 #endif
75
71 using extensions::Extension; 76 using extensions::Extension;
72 77
73 namespace { 78 namespace {
74 79
75 // Check that there are two browsers. Find the one that is not |browser|. 80 // Check that there are two browsers. Find the one that is not |browser|.
76 Browser* FindOneOtherBrowser(Browser* browser) { 81 Browser* FindOneOtherBrowser(Browser* browser) {
77 // There should only be one other browser. 82 // There should only be one other browser.
78 EXPECT_EQ(2u, chrome::GetBrowserCount(browser->profile(), 83 EXPECT_EQ(2u, chrome::GetBrowserCount(browser->profile(),
79 browser->host_desktop_type())); 84 browser->host_desktop_type()));
80 85
81 // Find the new browser. 86 // Find the new browser.
82 Browser* other_browser = NULL; 87 Browser* other_browser = NULL;
83 for (chrome::BrowserIterator it; !it.done() && !other_browser; it.Next()) { 88 for (chrome::BrowserIterator it; !it.done() && !other_browser; it.Next()) {
84 if (*it != browser) 89 if (*it != browser)
85 other_browser = *it; 90 other_browser = *it;
86 } 91 }
87 return other_browser; 92 return other_browser;
88 } 93 }
89 94
95 bool IsWindows10OrNewer() {
96 #if defined(OS_WIN)
97 return base::win::GetVersion() >= base::win::VERSION_WIN10;
98 #else
99 return false;
100 #endif
101 }
102
90 } // namespace 103 } // namespace
91 104
92 class StartupBrowserCreatorTest : public ExtensionBrowserTest { 105 class StartupBrowserCreatorTest : public ExtensionBrowserTest {
93 protected: 106 protected:
94 StartupBrowserCreatorTest() {} 107 StartupBrowserCreatorTest() {}
95 108
96 bool SetUpUserDataDirectory() override { 109 bool SetUpUserDataDirectory() override {
97 return ExtensionBrowserTest::SetUpUserDataDirectory(); 110 return ExtensionBrowserTest::SetUpUserDataDirectory();
98 } 111 }
99 112
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // no tabbed browser windows (eg. as if the process is running only due to a 217 // no tabbed browser windows (eg. as if the process is running only due to a
205 // background application. 218 // background application.
206 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 219 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
207 StartupURLsOnNewWindowWithNoTabbedBrowsers) { 220 StartupURLsOnNewWindowWithNoTabbedBrowsers) {
208 // Use a couple same-site HTTP URLs. 221 // Use a couple same-site HTTP URLs.
209 ASSERT_TRUE(test_server()->Start()); 222 ASSERT_TRUE(test_server()->Start());
210 std::vector<GURL> urls; 223 std::vector<GURL> urls;
211 urls.push_back(test_server()->GetURL("files/title1.html")); 224 urls.push_back(test_server()->GetURL("files/title1.html"));
212 urls.push_back(test_server()->GetURL("files/title2.html")); 225 urls.push_back(test_server()->GetURL("files/title2.html"));
213 226
227 Profile* profile = browser()->profile();
228 chrome::HostDesktopType host_desktop_type = browser()->host_desktop_type();
229
214 // Set the startup preference to open these URLs. 230 // Set the startup preference to open these URLs.
215 SessionStartupPref pref(SessionStartupPref::URLS); 231 SessionStartupPref pref(SessionStartupPref::URLS);
216 pref.urls = urls; 232 pref.urls = urls;
217 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 233 SessionStartupPref::SetStartupPref(profile, pref);
234
235 // Keep the browser process running while browsers are closed.
236 g_browser_process->AddRefModule();
218 237
219 // Close the browser. 238 // Close the browser.
220 browser()->window()->Close(); 239 browser()->window()->Close();
221 240
222 // Do a simple non-process-startup browser launch. 241 // Do a simple non-process-startup browser launch.
223 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 242 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
224 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 243 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
225 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 244 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
226 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 245 {
227 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 246 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
228 browser()->host_desktop_type())); 247 ASSERT_TRUE(
248 launch.Launch(profile, std::vector<GURL>(), false, host_desktop_type));
249 }
229 250
230 // This should have created a new browser window. |browser()| is still 251 // This should have created a new browser window. |browser()| is still
231 // around at this point, even though we've closed its window. 252 // around at this point, even though we've closed its window.
232 Browser* new_browser = FindOneOtherBrowser(browser()); 253 Browser* new_browser = FindOneOtherBrowser(browser());
233 ASSERT_TRUE(new_browser); 254 ASSERT_TRUE(new_browser);
234 255
235 // The new browser should have one tab for each URL. 256 std::vector<GURL> expected_urls(urls);
257 if (IsWindows10OrNewer())
258 expected_urls.insert(expected_urls.begin(), internals::GetWelcomePageURL());
259
236 TabStripModel* tab_strip = new_browser->tab_strip_model(); 260 TabStripModel* tab_strip = new_browser->tab_strip_model();
237 ASSERT_EQ(static_cast<int>(urls.size()), tab_strip->count()); 261 ASSERT_EQ(static_cast<int>(expected_urls.size()), tab_strip->count());
238 for (size_t i=0; i < urls.size(); i++) { 262 for (size_t i = 0; i < expected_urls.size(); i++)
239 EXPECT_EQ(urls[i], tab_strip->GetWebContentsAt(i)->GetURL()); 263 EXPECT_EQ(expected_urls[i], tab_strip->GetWebContentsAt(i)->GetURL());
264
265 // The two non-welcome tabs, despite having the same site, should be in
msw 2015/07/13 19:16:06 nit: s/non-welcome/test_server/
grt (UTC plus 2) 2015/07/13 19:29:53 Done.
266 // different SiteInstances.
267 EXPECT_NE(
268 tab_strip->GetWebContentsAt(tab_strip->count() - 2)->GetSiteInstance(),
269 tab_strip->GetWebContentsAt(tab_strip->count() - 1)->GetSiteInstance());
270
271 // Test that the welcome page is not shown the second time through if it was
272 // above.
273 if (IsWindows10OrNewer()) {
274 // Close the browser opened above.
275 {
276 content::WindowedNotificationObserver observer(
277 chrome::NOTIFICATION_BROWSER_CLOSED,
278 content::Source<Browser>(new_browser));
279 new_browser->window()->Close();
280 observer.Wait();
281 }
282
283 {
284 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
285 ASSERT_TRUE(launch.Launch(profile, std::vector<GURL>(), false,
286 host_desktop_type));
287 }
288
289 // Find the new browser and ensure that it has only the specified URLs this
290 // time. Both the original browser created by the fixture and the one
291 // created above have been closed, so the new browser is the only one
292 // remaining.
293 new_browser = FindTabbedBrowser(profile, true, host_desktop_type);
294 ASSERT_TRUE(new_browser);
295 ASSERT_EQ(static_cast<int>(urls.size()),
296 new_browser->tab_strip_model()->count());
240 } 297 }
241 298
242 // The two tabs, despite having the same site, should be in different 299 g_browser_process->ReleaseModule();
243 // SiteInstances.
244 EXPECT_NE(tab_strip->GetWebContentsAt(0)->GetSiteInstance(),
245 tab_strip->GetWebContentsAt(1)->GetSiteInstance());
246 } 300 }
247 301
248 // Verify that startup URLs aren't used when the process already exists 302 // Verify that startup URLs aren't used when the process already exists
249 // and has other tabbed browser windows. This is the common case of starting a 303 // and has other tabbed browser windows. This is the common case of starting a
250 // new browser. 304 // new browser.
251 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 305 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
252 StartupURLsOnNewWindow) { 306 StartupURLsOnNewWindow) {
253 // Use a couple arbitrary URLs. 307 // Use a couple arbitrary URLs.
254 std::vector<GURL> urls; 308 std::vector<GURL> urls;
255 urls.push_back(ui_test_utils::GetTestUrl( 309 urls.push_back(ui_test_utils::GetTestUrl(
256 base::FilePath(base::FilePath::kCurrentDirectory), 310 base::FilePath(base::FilePath::kCurrentDirectory),
257 base::FilePath(FILE_PATH_LITERAL("title1.html")))); 311 base::FilePath(FILE_PATH_LITERAL("title1.html"))));
258 urls.push_back(ui_test_utils::GetTestUrl( 312 urls.push_back(ui_test_utils::GetTestUrl(
259 base::FilePath(base::FilePath::kCurrentDirectory), 313 base::FilePath(base::FilePath::kCurrentDirectory),
260 base::FilePath(FILE_PATH_LITERAL("title2.html")))); 314 base::FilePath(FILE_PATH_LITERAL("title2.html"))));
261 315
262 // Set the startup preference to open these URLs. 316 // Set the startup preference to open these URLs.
263 SessionStartupPref pref(SessionStartupPref::URLS); 317 SessionStartupPref pref(SessionStartupPref::URLS);
264 pref.urls = urls; 318 pref.urls = urls;
265 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 319 SessionStartupPref::SetStartupPref(browser()->profile(), pref);
266 320
267 // Do a simple non-process-startup browser launch. 321 // Do a simple non-process-startup browser launch.
268 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 322 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
269 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 323 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
270 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 324 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
271 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 325 {
272 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 326 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
273 browser()->host_desktop_type())); 327 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
328 browser()->host_desktop_type()));
329 }
274 330
275 // This should have created a new browser window. 331 // This should have created a new browser window.
276 Browser* new_browser = FindOneOtherBrowser(browser()); 332 Browser* new_browser = FindOneOtherBrowser(browser());
277 ASSERT_TRUE(new_browser); 333 ASSERT_TRUE(new_browser);
278 334
279 // The new browser should have exactly one tab (not the startup URLs). 335 if (IsWindows10OrNewer()) {
280 ASSERT_EQ(1, new_browser->tab_strip_model()->count()); 336 // The new browser should have two tabs (not the startup URLs).
337 ASSERT_EQ(2, new_browser->tab_strip_model()->count());
338 } else {
339 // The new browser should have exactly one tab (not the startup URLs).
340 ASSERT_EQ(1, new_browser->tab_strip_model()->count());
341 }
342
343 // Test that the welcome page is not shown the second time through if it was
344 // above.
345 if (!IsWindows10OrNewer()) {
346 // Close the browser opened above.
347 {
348 content::WindowedNotificationObserver observer(
349 chrome::NOTIFICATION_BROWSER_CLOSED,
350 content::Source<Browser>(new_browser));
351 new_browser->window()->Close();
352 observer.Wait();
353 }
354
355 {
356 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
357 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(),
358 false, browser()->host_desktop_type()));
359 }
360
361 // Find the new browser and ensure that it has only the one tab this time.
362 new_browser = FindOneOtherBrowser(browser());
363 ASSERT_TRUE(new_browser);
364 ASSERT_EQ(1, new_browser->tab_strip_model()->count());
365 }
281 } 366 }
282 367
283 // App shortcuts are not implemented on mac os. 368 // App shortcuts are not implemented on mac os.
284 #if !defined(OS_MACOSX) 369 #if !defined(OS_MACOSX)
285 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { 370 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) {
286 // Load an app with launch.container = 'tab'. 371 // Load an app with launch.container = 'tab'.
287 const Extension* extension_app = NULL; 372 const Extension* extension_app = NULL;
288 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); 373 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
289 374
290 // Add --app-id=<extension->id()> to the command line. 375 // Add --app-id=<extension->id()> to the command line.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, 562 StartupBrowserCreatorImpl launch(base::FilePath(), dummy,
478 chrome::startup::IS_FIRST_RUN); 563 chrome::startup::IS_FIRST_RUN);
479 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 564 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
480 browser()->host_desktop_type())); 565 browser()->host_desktop_type()));
481 566
482 // This should have created a new browser window. 567 // This should have created a new browser window.
483 Browser* new_browser = FindOneOtherBrowser(browser()); 568 Browser* new_browser = FindOneOtherBrowser(browser());
484 ASSERT_TRUE(new_browser); 569 ASSERT_TRUE(new_browser);
485 570
486 TabStripModel* tab_strip = new_browser->tab_strip_model(); 571 TabStripModel* tab_strip = new_browser->tab_strip_model();
487 EXPECT_EQ(1, tab_strip->count());
488 572
489 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) { 573 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) {
574 // The browser should show only the promo.
575 ASSERT_EQ(1, tab_strip->count());
490 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), 576 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false),
491 tab_strip->GetWebContentsAt(0)->GetURL()); 577 tab_strip->GetWebContentsAt(0)->GetURL());
578 } else if (IsWindows10OrNewer()) {
579 // The browser should show the welcome page and the NTP.
580 ASSERT_EQ(2, tab_strip->count());
581 EXPECT_EQ(GURL(internals::GetWelcomePageURL()),
582 tab_strip->GetWebContentsAt(0)->GetURL());
583 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
584 tab_strip->GetWebContentsAt(1)->GetURL());
492 } else { 585 } else {
586 // The browser should show only the NTP.
587 ASSERT_EQ(1, tab_strip->count());
493 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 588 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
494 tab_strip->GetWebContentsAt(0)->GetURL()); 589 tab_strip->GetWebContentsAt(0)->GetURL());
495 } 590 }
496 } 591 }
497 592
498 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) { 593 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) {
499 first_run::SetShouldShowWelcomePage(); 594 first_run::SetShouldShowWelcomePage();
500 595
501 // Do a simple non-process-startup browser launch. 596 // Do a simple non-process-startup browser launch.
502 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 597 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
503 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, 598 StartupBrowserCreatorImpl launch(base::FilePath(), dummy,
504 chrome::startup::IS_FIRST_RUN); 599 chrome::startup::IS_FIRST_RUN);
505 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 600 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
506 browser()->host_desktop_type())); 601 browser()->host_desktop_type()));
507 602
508 // This should have created a new browser window. 603 // This should have created a new browser window.
509 Browser* new_browser = FindOneOtherBrowser(browser()); 604 Browser* new_browser = FindOneOtherBrowser(browser());
510 ASSERT_TRUE(new_browser); 605 ASSERT_TRUE(new_browser);
511 606
512 TabStripModel* tab_strip = new_browser->tab_strip_model(); 607 TabStripModel* tab_strip = new_browser->tab_strip_model();
513 EXPECT_EQ(2, tab_strip->count()); 608 EXPECT_EQ(2, tab_strip->count());
514 609
515 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) { 610 if (IsWindows10OrNewer()) {
516 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), 611 EXPECT_EQ(internals::GetWelcomePageURL(),
517 tab_strip->GetWebContentsAt(0)->GetURL()); 612 tab_strip->GetWebContentsAt(0)->GetURL());
613 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
614 tab_strip->GetWebContentsAt(1)->GetURL());
518 } else { 615 } else {
519 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 616 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) {
520 tab_strip->GetWebContentsAt(0)->GetURL()); 617 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false),
618 tab_strip->GetWebContentsAt(0)->GetURL());
619 } else {
620 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
621 tab_strip->GetWebContentsAt(0)->GetURL());
622 }
623 EXPECT_EQ(internals::GetWelcomePageURL(),
624 tab_strip->GetWebContentsAt(1)->GetURL());
521 } 625 }
522 EXPECT_EQ(internals::GetWelcomePageURL(),
523 tab_strip->GetWebContentsAt(1)->GetURL());
524 } 626 }
525 627
526 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) { 628 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) {
527 StartupBrowserCreator browser_creator; 629 StartupBrowserCreator browser_creator;
528 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 630 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
529 631
530 // The welcome page should not be shown, even if 632 // The welcome page should not be shown, even if
531 // first_run::ShouldShowWelcomePage() says so, when there are already 633 // first_run::ShouldShowWelcomePage() says so, when there are already
532 // more than 2 first run tabs. 634 // more than 2 first run tabs.
533 first_run::SetShouldShowWelcomePage(); 635 first_run::SetShouldShowWelcomePage();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 // urls1 were opened in a browser for default_profile, and urls2 were opened 749 // urls1 were opened in a browser for default_profile, and urls2 were opened
648 // in a browser for other_profile. 750 // in a browser for other_profile.
649 Browser* new_browser = NULL; 751 Browser* new_browser = NULL;
650 // |browser()| is still around at this point, even though we've closed its 752 // |browser()| is still around at this point, even though we've closed its
651 // window. Thus the browser count for default_profile is 2. 753 // window. Thus the browser count for default_profile is 2.
652 ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile, 754 ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile,
653 browser()->host_desktop_type())); 755 browser()->host_desktop_type()));
654 new_browser = FindOneOtherBrowserForProfile(default_profile, browser()); 756 new_browser = FindOneOtherBrowserForProfile(default_profile, browser());
655 ASSERT_TRUE(new_browser); 757 ASSERT_TRUE(new_browser);
656 TabStripModel* tab_strip = new_browser->tab_strip_model(); 758 TabStripModel* tab_strip = new_browser->tab_strip_model();
657 ASSERT_EQ(1, tab_strip->count()); 759 if (IsWindows10OrNewer()) {
658 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(0)->GetURL()); 760 // The new browser should have the welcome tab and the URL for the profile.
761 ASSERT_EQ(2, tab_strip->count());
762 EXPECT_EQ(GURL(internals::GetWelcomePageURL()),
763 tab_strip->GetWebContentsAt(0)->GetURL());
764 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(1)->GetURL());
765 } else {
766 // The new browser should have only the desired URL for the profile.
767 ASSERT_EQ(1, tab_strip->count());
768 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(0)->GetURL());
769 }
659 770
660 ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile, 771 ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile,
661 browser()->host_desktop_type())); 772 browser()->host_desktop_type()));
662 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL); 773 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL);
663 ASSERT_TRUE(new_browser); 774 ASSERT_TRUE(new_browser);
664 tab_strip = new_browser->tab_strip_model(); 775 tab_strip = new_browser->tab_strip_model();
665 ASSERT_EQ(1, tab_strip->count()); 776 ASSERT_EQ(1, tab_strip->count());
666 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); 777 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL());
667 } 778 }
668 779
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 978
868 while (SessionRestore::IsRestoring(default_profile) || 979 while (SessionRestore::IsRestoring(default_profile) ||
869 SessionRestore::IsRestoring(profile_home1) || 980 SessionRestore::IsRestoring(profile_home1) ||
870 SessionRestore::IsRestoring(profile_home2) || 981 SessionRestore::IsRestoring(profile_home2) ||
871 SessionRestore::IsRestoring(profile_last) || 982 SessionRestore::IsRestoring(profile_last) ||
872 SessionRestore::IsRestoring(profile_urls)) 983 SessionRestore::IsRestoring(profile_urls))
873 base::MessageLoop::current()->RunUntilIdle(); 984 base::MessageLoop::current()->RunUntilIdle();
874 985
875 Browser* new_browser = NULL; 986 Browser* new_browser = NULL;
876 // The last open profile (the profile_home1 in this case) will always be 987 // The last open profile (the profile_home1 in this case) will always be
877 // launched, even if it will open just the home page. 988 // launched, even if it will open just the NTP (and the welcome page on
989 // relevant platforms).
878 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1, original_desktop_type)); 990 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1, original_desktop_type));
879 new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL); 991 new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL);
880 ASSERT_TRUE(new_browser); 992 ASSERT_TRUE(new_browser);
881 TabStripModel* tab_strip = new_browser->tab_strip_model(); 993 TabStripModel* tab_strip = new_browser->tab_strip_model();
882 ASSERT_EQ(1, tab_strip->count()); 994 if (IsWindows10OrNewer()) {
883 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 995 // The new browser should have the welcome tab and the NTP.
884 tab_strip->GetWebContentsAt(0)->GetURL()); 996 ASSERT_EQ(2, tab_strip->count());
997 EXPECT_EQ(GURL(internals::GetWelcomePageURL()),
998 tab_strip->GetWebContentsAt(0)->GetURL());
999 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1000 tab_strip->GetWebContentsAt(1)->GetURL());
1001 } else {
1002 // The new browser should have only the NTP.
1003 ASSERT_EQ(1, tab_strip->count());
1004 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1005 tab_strip->GetWebContentsAt(0)->GetURL());
1006 }
885 1007
886 // profile_urls opened the urls. 1008 // profile_urls opened the urls.
887 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, original_desktop_type)); 1009 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, original_desktop_type));
888 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); 1010 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
889 ASSERT_TRUE(new_browser); 1011 ASSERT_TRUE(new_browser);
890 tab_strip = new_browser->tab_strip_model(); 1012 tab_strip = new_browser->tab_strip_model();
891 ASSERT_EQ(1, tab_strip->count()); 1013 ASSERT_EQ(1, tab_strip->count());
892 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); 1014 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL());
893 1015
894 // profile_last opened the last open pages. 1016 // profile_last opened the last open pages.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home, 1102 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home,
981 last_opened_profiles); 1103 last_opened_profiles);
982 1104
983 // No profiles are getting restored, since they all display the crash info 1105 // No profiles are getting restored, since they all display the crash info
984 // bar. 1106 // bar.
985 EXPECT_FALSE(SessionRestore::IsRestoring(profile_home)); 1107 EXPECT_FALSE(SessionRestore::IsRestoring(profile_home));
986 EXPECT_FALSE(SessionRestore::IsRestoring(profile_last)); 1108 EXPECT_FALSE(SessionRestore::IsRestoring(profile_last));
987 EXPECT_FALSE(SessionRestore::IsRestoring(profile_urls)); 1109 EXPECT_FALSE(SessionRestore::IsRestoring(profile_urls));
988 1110
989 // The profile which normally opens the home page displays the new tab page. 1111 // The profile which normally opens the home page displays the new tab page.
1112 // The welcome page is also shown for relevant platforms.
990 Browser* new_browser = NULL; 1113 Browser* new_browser = NULL;
991 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, 1114 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home,
992 browser()->host_desktop_type())); 1115 browser()->host_desktop_type()));
993 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); 1116 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL);
994 ASSERT_TRUE(new_browser); 1117 ASSERT_TRUE(new_browser);
995 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1118 TabStripModel* tab_strip = new_browser->tab_strip_model();
996 ASSERT_EQ(1, tab_strip->count()); 1119 if (IsWindows10OrNewer()) {
997 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); 1120 // The new browser should have the welcome tab and the NTP.
998 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); 1121 ASSERT_EQ(2, tab_strip->count());
999 EnsureRestoreUIWasShown(web_contents); 1122 EXPECT_EQ(GURL(internals::GetWelcomePageURL()),
1123 tab_strip->GetWebContentsAt(0)->GetURL());
1124 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1125 tab_strip->GetWebContentsAt(1)->GetURL());
1126 } else {
1127 // The new browser should have only the NTP.
1128 ASSERT_EQ(1, tab_strip->count());
1129 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1130 tab_strip->GetWebContentsAt(0)->GetURL());
1131 }
1132 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0));
1000 1133
1001 // The profile which normally opens last open pages displays the new tab page. 1134 // The profile which normally opens last open pages displays the new tab page.
1002 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, 1135 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last,
1003 browser()->host_desktop_type())); 1136 browser()->host_desktop_type()));
1004 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); 1137 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
1005 ASSERT_TRUE(new_browser); 1138 ASSERT_TRUE(new_browser);
1006 tab_strip = new_browser->tab_strip_model(); 1139 tab_strip = new_browser->tab_strip_model();
1007 ASSERT_EQ(1, tab_strip->count()); 1140 ASSERT_EQ(1, tab_strip->count());
1008 web_contents = tab_strip->GetWebContentsAt(0); 1141 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1009 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); 1142 tab_strip->GetWebContentsAt(0)->GetURL());
1010 EnsureRestoreUIWasShown(web_contents); 1143 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0));
1011 1144
1012 // The profile which normally opens URLs displays the new tab page. 1145 // The profile which normally opens URLs displays the new tab page.
1013 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, 1146 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls,
1014 browser()->host_desktop_type())); 1147 browser()->host_desktop_type()));
1015 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); 1148 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
1016 ASSERT_TRUE(new_browser); 1149 ASSERT_TRUE(new_browser);
1017 tab_strip = new_browser->tab_strip_model(); 1150 tab_strip = new_browser->tab_strip_model();
1018 ASSERT_EQ(1, tab_strip->count()); 1151 ASSERT_EQ(1, tab_strip->count());
1019 web_contents = tab_strip->GetWebContentsAt(0); 1152 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1020 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); 1153 tab_strip->GetWebContentsAt(0)->GetURL());
1021 EnsureRestoreUIWasShown(web_contents); 1154 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0));
1022 1155
1023 #if !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD) 1156 #if !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD)
1024 // Each profile should have one session restore bubble shown, so we should 1157 // Each profile should have one session restore bubble shown, so we should
1025 // observe count 3 in bucket 0 (which represents bubble shown). 1158 // observe count 3 in bucket 0 (which represents bubble shown).
1026 histogram_tester.ExpectBucketCount("SessionCrashed.Bubble", 0, 3); 1159 histogram_tester.ExpectBucketCount("SessionCrashed.Bubble", 0, 3);
1027 #endif // !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD) 1160 #endif // !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD)
1028 } 1161 }
1029 1162
1030 class SupervisedUserBrowserCreatorTest : public InProcessBrowserTest { 1163 class SupervisedUserBrowserCreatorTest : public InProcessBrowserTest {
1031 protected: 1164 protected:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 // On a branded Linux build, policy is required to suppress the first-run 1200 // On a branded Linux build, policy is required to suppress the first-run
1068 // dialog. 1201 // dialog.
1069 #if !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || \ 1202 #if !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || \
1070 defined(ENABLE_CONFIGURATION_POLICY) 1203 defined(ENABLE_CONFIGURATION_POLICY)
1071 1204
1072 class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest { 1205 class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest {
1073 protected: 1206 protected:
1074 void SetUpCommandLine(base::CommandLine* command_line) override; 1207 void SetUpCommandLine(base::CommandLine* command_line) override;
1075 void SetUpInProcessBrowserTestFixture() override; 1208 void SetUpInProcessBrowserTestFixture() override;
1076 1209
1210 // Returns true if the platform supports showing the sync promo on first run.
1211 static bool PlatformSupportsSyncPromo() {
1212 return !IsWindows10OrNewer();
1213 }
1214
1077 #if defined(ENABLE_CONFIGURATION_POLICY) 1215 #if defined(ENABLE_CONFIGURATION_POLICY)
1078 policy::MockConfigurationPolicyProvider provider_; 1216 policy::MockConfigurationPolicyProvider provider_;
1079 policy::PolicyMap policy_map_; 1217 policy::PolicyMap policy_map_;
1080 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1218 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1081 }; 1219 };
1082 1220
1083 void StartupBrowserCreatorFirstRunTest::SetUpCommandLine( 1221 void StartupBrowserCreatorFirstRunTest::SetUpCommandLine(
1084 base::CommandLine* command_line) { 1222 base::CommandLine* command_line) {
1085 command_line->AppendSwitch(switches::kForceFirstRun); 1223 command_line->AppendSwitch(switches::kForceFirstRun);
1086 } 1224 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1269 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1132 browser()->host_desktop_type())); 1270 browser()->host_desktop_type()));
1133 1271
1134 // This should have created a new browser window. 1272 // This should have created a new browser window.
1135 Browser* new_browser = FindOneOtherBrowser(browser()); 1273 Browser* new_browser = FindOneOtherBrowser(browser());
1136 ASSERT_TRUE(new_browser); 1274 ASSERT_TRUE(new_browser);
1137 1275
1138 // Verify that the NTP and the welcome page are shown. 1276 // Verify that the NTP and the welcome page are shown.
1139 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1277 TabStripModel* tab_strip = new_browser->tab_strip_model();
1140 ASSERT_EQ(2, tab_strip->count()); 1278 ASSERT_EQ(2, tab_strip->count());
1141 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1279 if (IsWindows10OrNewer()) {
1142 tab_strip->GetWebContentsAt(0)->GetURL()); 1280 EXPECT_EQ(internals::GetWelcomePageURL(),
1143 EXPECT_EQ(internals::GetWelcomePageURL(), 1281 tab_strip->GetWebContentsAt(0)->GetURL());
1144 tab_strip->GetWebContentsAt(1)->GetURL()); 1282 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1283 tab_strip->GetWebContentsAt(1)->GetURL());
1284 } else {
1285 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1286 tab_strip->GetWebContentsAt(0)->GetURL());
1287 EXPECT_EQ(internals::GetWelcomePageURL(),
1288 tab_strip->GetWebContentsAt(1)->GetURL());
1289 }
1145 } 1290 }
1146 1291
1147 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1292 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1148 // http://crbug.com/314819 1293 // http://crbug.com/314819
1149 #define MAYBE_SyncPromoAllowed DISABLED_SyncPromoAllowed 1294 #define MAYBE_SyncPromoAllowed DISABLED_SyncPromoAllowed
1150 #else 1295 #else
1151 #define MAYBE_SyncPromoAllowed SyncPromoAllowed 1296 #define MAYBE_SyncPromoAllowed SyncPromoAllowed
1152 #endif 1297 #endif
1153 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1298 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1154 MAYBE_SyncPromoAllowed) { 1299 MAYBE_SyncPromoAllowed) {
1300 if (!PlatformSupportsSyncPromo())
1301 return;
1155 // Consistently enable the welcome page on all platforms. 1302 // Consistently enable the welcome page on all platforms.
1156 first_run::SetShouldShowWelcomePage(); 1303 first_run::SetShouldShowWelcomePage();
1157 1304
1158 // Simulate the following master_preferences: 1305 // Simulate the following master_preferences:
1159 // { 1306 // {
1160 // "sync_promo": { 1307 // "sync_promo": {
1161 // "show_on_first_run_allowed": true 1308 // "show_on_first_run_allowed": true
1162 // } 1309 // }
1163 // } 1310 // }
1164 StartupBrowserCreator browser_creator; 1311 StartupBrowserCreator browser_creator;
(...skipping 21 matching lines...) Expand all
1186 } 1333 }
1187 1334
1188 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1335 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1189 // http://crbug.com/314819 1336 // http://crbug.com/314819
1190 #define MAYBE_FirstRunTabsPromoAllowed DISABLED_FirstRunTabsPromoAllowed 1337 #define MAYBE_FirstRunTabsPromoAllowed DISABLED_FirstRunTabsPromoAllowed
1191 #else 1338 #else
1192 #define MAYBE_FirstRunTabsPromoAllowed FirstRunTabsPromoAllowed 1339 #define MAYBE_FirstRunTabsPromoAllowed FirstRunTabsPromoAllowed
1193 #endif 1340 #endif
1194 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1341 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1195 MAYBE_FirstRunTabsPromoAllowed) { 1342 MAYBE_FirstRunTabsPromoAllowed) {
1343 if (!PlatformSupportsSyncPromo())
1344 return;
1196 // Simulate the following master_preferences: 1345 // Simulate the following master_preferences:
1197 // { 1346 // {
1198 // "first_run_tabs" : [ 1347 // "first_run_tabs" : [
1199 // "files/title1.html" 1348 // "files/title1.html"
1200 // ], 1349 // ],
1201 // "sync_promo": { 1350 // "sync_promo": {
1202 // "show_on_first_run_allowed": true 1351 // "show_on_first_run_allowed": true
1203 // } 1352 // }
1204 // } 1353 // }
1205 StartupBrowserCreator browser_creator; 1354 StartupBrowserCreator browser_creator;
(...skipping 23 matching lines...) Expand all
1229 1378
1230 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1379 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1231 // http://crbug.com/314819 1380 // http://crbug.com/314819
1232 #define MAYBE_FirstRunTabsContainSyncPromo \ 1381 #define MAYBE_FirstRunTabsContainSyncPromo \
1233 DISABLED_FirstRunTabsContainSyncPromo 1382 DISABLED_FirstRunTabsContainSyncPromo
1234 #else 1383 #else
1235 #define MAYBE_FirstRunTabsContainSyncPromo FirstRunTabsContainSyncPromo 1384 #define MAYBE_FirstRunTabsContainSyncPromo FirstRunTabsContainSyncPromo
1236 #endif 1385 #endif
1237 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1386 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1238 MAYBE_FirstRunTabsContainSyncPromo) { 1387 MAYBE_FirstRunTabsContainSyncPromo) {
1388 if (!PlatformSupportsSyncPromo())
1389 return;
1239 // Simulate the following master_preferences: 1390 // Simulate the following master_preferences:
1240 // { 1391 // {
1241 // "first_run_tabs" : [ 1392 // "first_run_tabs" : [
1242 // "files/title1.html", 1393 // "files/title1.html",
1243 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" 1394 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F"
1244 // ], 1395 // ],
1245 // "sync_promo": { 1396 // "sync_promo": {
1246 // "show_on_first_run_allowed": true 1397 // "show_on_first_run_allowed": true
1247 // } 1398 // }
1248 // } 1399 // }
(...skipping 29 matching lines...) Expand all
1278 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1429 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1279 // http://crbug.com/314819 1430 // http://crbug.com/314819
1280 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \ 1431 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \
1281 DISABLED_FirstRunTabsContainNTPSyncPromoAllowed 1432 DISABLED_FirstRunTabsContainNTPSyncPromoAllowed
1282 #else 1433 #else
1283 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \ 1434 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \
1284 FirstRunTabsContainNTPSyncPromoAllowed 1435 FirstRunTabsContainNTPSyncPromoAllowed
1285 #endif 1436 #endif
1286 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1437 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1287 MAYBE_FirstRunTabsContainNTPSyncPromoAllowed) { 1438 MAYBE_FirstRunTabsContainNTPSyncPromoAllowed) {
1439 if (!PlatformSupportsSyncPromo())
1440 return;
1288 // Simulate the following master_preferences: 1441 // Simulate the following master_preferences:
1289 // { 1442 // {
1290 // "first_run_tabs" : [ 1443 // "first_run_tabs" : [
1291 // "new_tab_page", 1444 // "new_tab_page",
1292 // "files/title1.html" 1445 // "files/title1.html"
1293 // ], 1446 // ],
1294 // "sync_promo": { 1447 // "sync_promo": {
1295 // "show_on_first_run_allowed": true 1448 // "show_on_first_run_allowed": true
1296 // } 1449 // }
1297 // } 1450 // }
(...skipping 27 matching lines...) Expand all
1325 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1478 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1326 // http://crbug.com/314819 1479 // http://crbug.com/314819
1327 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \ 1480 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \
1328 DISABLED_FirstRunTabsContainNTPSyncPromoForbidden 1481 DISABLED_FirstRunTabsContainNTPSyncPromoForbidden
1329 #else 1482 #else
1330 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \ 1483 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \
1331 FirstRunTabsContainNTPSyncPromoForbidden 1484 FirstRunTabsContainNTPSyncPromoForbidden
1332 #endif 1485 #endif
1333 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1486 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1334 MAYBE_FirstRunTabsContainNTPSyncPromoForbidden) { 1487 MAYBE_FirstRunTabsContainNTPSyncPromoForbidden) {
1488 if (!PlatformSupportsSyncPromo())
1489 return;
1335 // Simulate the following master_preferences: 1490 // Simulate the following master_preferences:
1336 // { 1491 // {
1337 // "first_run_tabs" : [ 1492 // "first_run_tabs" : [
1338 // "new_tab_page", 1493 // "new_tab_page",
1339 // "files/title1.html" 1494 // "files/title1.html"
1340 // ], 1495 // ],
1341 // "sync_promo": { 1496 // "sync_promo": {
1342 // "show_on_first_run_allowed": false 1497 // "show_on_first_run_allowed": false
1343 // } 1498 // }
1344 // } 1499 // }
(...skipping 26 matching lines...) Expand all
1371 1526
1372 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1527 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1373 // http://crbug.com/314819 1528 // http://crbug.com/314819
1374 #define MAYBE_FirstRunTabsSyncPromoForbidden \ 1529 #define MAYBE_FirstRunTabsSyncPromoForbidden \
1375 DISABLED_FirstRunTabsSyncPromoForbidden 1530 DISABLED_FirstRunTabsSyncPromoForbidden
1376 #else 1531 #else
1377 #define MAYBE_FirstRunTabsSyncPromoForbidden FirstRunTabsSyncPromoForbidden 1532 #define MAYBE_FirstRunTabsSyncPromoForbidden FirstRunTabsSyncPromoForbidden
1378 #endif 1533 #endif
1379 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1534 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1380 MAYBE_FirstRunTabsSyncPromoForbidden) { 1535 MAYBE_FirstRunTabsSyncPromoForbidden) {
1536 if (!PlatformSupportsSyncPromo())
1537 return;
1381 // Simulate the following master_preferences: 1538 // Simulate the following master_preferences:
1382 // { 1539 // {
1383 // "first_run_tabs" : [ 1540 // "first_run_tabs" : [
1384 // "files/title1.html" 1541 // "files/title1.html"
1385 // ], 1542 // ],
1386 // "sync_promo": { 1543 // "sync_promo": {
1387 // "show_on_first_run_allowed": false 1544 // "show_on_first_run_allowed": false
1388 // } 1545 // }
1389 // } 1546 // }
1390 StartupBrowserCreator browser_creator; 1547 StartupBrowserCreator browser_creator;
(...skipping 23 matching lines...) Expand all
1414 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1571 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1415 // http://crbug.com/314819 1572 // http://crbug.com/314819
1416 #define MAYBE_RestoreOnStartupURLsPolicySpecified \ 1573 #define MAYBE_RestoreOnStartupURLsPolicySpecified \
1417 DISABLED_RestoreOnStartupURLsPolicySpecified 1574 DISABLED_RestoreOnStartupURLsPolicySpecified
1418 #else 1575 #else
1419 #define MAYBE_RestoreOnStartupURLsPolicySpecified \ 1576 #define MAYBE_RestoreOnStartupURLsPolicySpecified \
1420 RestoreOnStartupURLsPolicySpecified 1577 RestoreOnStartupURLsPolicySpecified
1421 #endif 1578 #endif
1422 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1579 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1423 MAYBE_RestoreOnStartupURLsPolicySpecified) { 1580 MAYBE_RestoreOnStartupURLsPolicySpecified) {
1581 if (!PlatformSupportsSyncPromo())
1582 return;
1424 // Simulate the following master_preferences: 1583 // Simulate the following master_preferences:
1425 // { 1584 // {
1426 // "sync_promo": { 1585 // "sync_promo": {
1427 // "show_on_first_run_allowed": true 1586 // "show_on_first_run_allowed": true
1428 // } 1587 // }
1429 // } 1588 // }
1430 StartupBrowserCreator browser_creator; 1589 StartupBrowserCreator browser_creator;
1431 browser()->profile()->GetPrefs()->SetBoolean( 1590 browser()->profile()->GetPrefs()->SetBoolean(
1432 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1591 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1433 1592
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 ASSERT_EQ(1, tab_strip->count()); 1625 ASSERT_EQ(1, tab_strip->count());
1467 EXPECT_EQ("title1.html", 1626 EXPECT_EQ("title1.html",
1468 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1627 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1469 } 1628 }
1470 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1629 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1471 1630
1472 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1631 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1473 // defined(ENABLE_CONFIGURATION_POLICY) 1632 // defined(ENABLE_CONFIGURATION_POLICY)
1474 1633
1475 #endif // !defined(OS_CHROMEOS) 1634 #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.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698