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

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: partial comments 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 // Returns true if the platform supports showing the sync promo on first run.
96 bool PlatformSupportsSyncPromo() {
97 // Presently, this is exactly the same set of platforms that support
98 // re-showing the welcome page outside of first run.
99 return !internals::ShowWelcomePageAfterFirstRun();
100 }
101
102 // Returns the index of the welcome page for normal first-run startup.
103 // Ordinarily it is the second tab. It is the first tab for platforms that do
104 // not show the sync promo on first run.
105 int GetWelcomePageIndex() {
106 return PlatformSupportsSyncPromo() ? 1 : 0;
107 }
108
109 // Returns the index of the NTP/sync promo for normal first-run startup.
110 // Ordinarily it is the first tab. It is the second tab for platforms that do
111 // not show the sync promo on first run.
112 int GetNTPIndex() {
113 return PlatformSupportsSyncPromo() ? 0 : 1;
114 }
115
90 } // namespace 116 } // namespace
91 117
92 class StartupBrowserCreatorTest : public ExtensionBrowserTest { 118 class StartupBrowserCreatorTest : public ExtensionBrowserTest {
93 protected: 119 protected:
94 StartupBrowserCreatorTest() {} 120 StartupBrowserCreatorTest() {}
95 121
96 bool SetUpUserDataDirectory() override { 122 bool SetUpUserDataDirectory() override {
97 return ExtensionBrowserTest::SetUpUserDataDirectory(); 123 return ExtensionBrowserTest::SetUpUserDataDirectory();
98 } 124 }
99 125
(...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 230 // no tabbed browser windows (eg. as if the process is running only due to a
205 // background application. 231 // background application.
206 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 232 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
207 StartupURLsOnNewWindowWithNoTabbedBrowsers) { 233 StartupURLsOnNewWindowWithNoTabbedBrowsers) {
208 // Use a couple same-site HTTP URLs. 234 // Use a couple same-site HTTP URLs.
209 ASSERT_TRUE(test_server()->Start()); 235 ASSERT_TRUE(test_server()->Start());
210 std::vector<GURL> urls; 236 std::vector<GURL> urls;
211 urls.push_back(test_server()->GetURL("files/title1.html")); 237 urls.push_back(test_server()->GetURL("files/title1.html"));
212 urls.push_back(test_server()->GetURL("files/title2.html")); 238 urls.push_back(test_server()->GetURL("files/title2.html"));
213 239
240 Profile* profile = browser()->profile();
241 chrome::HostDesktopType host_desktop_type = browser()->host_desktop_type();
242
214 // Set the startup preference to open these URLs. 243 // Set the startup preference to open these URLs.
215 SessionStartupPref pref(SessionStartupPref::URLS); 244 SessionStartupPref pref(SessionStartupPref::URLS);
216 pref.urls = urls; 245 pref.urls = urls;
217 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 246 SessionStartupPref::SetStartupPref(profile, pref);
247
248 // Keep the browser process running while browsers are closed.
249 g_browser_process->AddRefModule();
218 250
219 // Close the browser. 251 // Close the browser.
220 browser()->window()->Close(); 252 browser()->window()->Close();
221 253
222 // Do a simple non-process-startup browser launch. 254 // Do a simple non-process-startup browser launch.
223 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 255 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
224 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 256 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
225 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 257 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
226 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 258 {
227 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 259 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
228 browser()->host_desktop_type())); 260 ASSERT_TRUE(
261 launch.Launch(profile, std::vector<GURL>(), false, host_desktop_type));
262 }
229 263
230 // This should have created a new browser window. |browser()| is still 264 // This should have created a new browser window. |browser()| is still
231 // around at this point, even though we've closed its window. 265 // around at this point, even though we've closed its window.
232 Browser* new_browser = FindOneOtherBrowser(browser()); 266 Browser* new_browser = FindOneOtherBrowser(browser());
233 ASSERT_TRUE(new_browser); 267 ASSERT_TRUE(new_browser);
234 268
235 // The new browser should have one tab for each URL. 269 if (internals::ShowWelcomePageAfterFirstRun()) {
236 TabStripModel* tab_strip = new_browser->tab_strip_model(); 270 // The new browser should have the welcome tab and one tab for each URL.
237 ASSERT_EQ(static_cast<int>(urls.size()), tab_strip->count()); 271 TabStripModel* tab_strip = new_browser->tab_strip_model();
238 for (size_t i=0; i < urls.size(); i++) { 272 ASSERT_EQ(static_cast<int>(urls.size()) + 1, tab_strip->count());
239 EXPECT_EQ(urls[i], tab_strip->GetWebContentsAt(i)->GetURL()); 273 EXPECT_EQ(internals::GetWelcomePageURL(),
274 tab_strip->GetWebContentsAt(0)->GetURL());
275 for (size_t i = 0; i < urls.size(); i++) {
276 EXPECT_EQ(urls[i], tab_strip->GetWebContentsAt(i + 1)->GetURL());
277 }
278 } else {
279 // The new browser should have one tab for each URL.
280 TabStripModel* tab_strip = new_browser->tab_strip_model();
281 ASSERT_EQ(static_cast<int>(urls.size()), tab_strip->count());
282 for (size_t i = 0; i < urls.size(); i++) {
283 EXPECT_EQ(urls[i], tab_strip->GetWebContentsAt(i)->GetURL());
284 }
285
286 // The two tabs, despite having the same site, should be in different
287 // SiteInstances.
288 EXPECT_NE(tab_strip->GetWebContentsAt(0)->GetSiteInstance(),
289 tab_strip->GetWebContentsAt(1)->GetSiteInstance());
240 } 290 }
241 291
242 // The two tabs, despite having the same site, should be in different 292 // The test is complete if the welcome page wasn't included above.
243 // SiteInstances. 293 if (!internals::ShowWelcomePageAfterFirstRun()) {
244 EXPECT_NE(tab_strip->GetWebContentsAt(0)->GetSiteInstance(), 294 g_browser_process->ReleaseModule();
245 tab_strip->GetWebContentsAt(1)->GetSiteInstance()); 295 return;
296 }
297
298 // Close the browser opened above.
299 {
300 content::WindowedNotificationObserver observer(
301 chrome::NOTIFICATION_BROWSER_CLOSED,
302 content::Source<Browser>(new_browser));
303 new_browser->window()->Close();
304 observer.Wait();
305 }
306
307 // Try again to ensure that the welcome page isn't shown the second time.
308 {
309 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
310 ASSERT_TRUE(
311 launch.Launch(profile, std::vector<GURL>(), false, host_desktop_type));
312 }
313
314 // Find the new browser and ensure that it has only the expected URLs this
315 // time.
316 new_browser = FindTabbedBrowser(profile, true, host_desktop_type);
317 ASSERT_TRUE(new_browser);
318 ASSERT_EQ(static_cast<int>(urls.size()),
319 new_browser->tab_strip_model()->count());
320
321 g_browser_process->ReleaseModule();
246 } 322 }
247 323
248 // Verify that startup URLs aren't used when the process already exists 324 // 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 325 // and has other tabbed browser windows. This is the common case of starting a
250 // new browser. 326 // new browser.
251 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 327 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
252 StartupURLsOnNewWindow) { 328 StartupURLsOnNewWindow) {
253 // Use a couple arbitrary URLs. 329 // Use a couple arbitrary URLs.
254 std::vector<GURL> urls; 330 std::vector<GURL> urls;
255 urls.push_back(ui_test_utils::GetTestUrl( 331 urls.push_back(ui_test_utils::GetTestUrl(
256 base::FilePath(base::FilePath::kCurrentDirectory), 332 base::FilePath(base::FilePath::kCurrentDirectory),
257 base::FilePath(FILE_PATH_LITERAL("title1.html")))); 333 base::FilePath(FILE_PATH_LITERAL("title1.html"))));
258 urls.push_back(ui_test_utils::GetTestUrl( 334 urls.push_back(ui_test_utils::GetTestUrl(
259 base::FilePath(base::FilePath::kCurrentDirectory), 335 base::FilePath(base::FilePath::kCurrentDirectory),
260 base::FilePath(FILE_PATH_LITERAL("title2.html")))); 336 base::FilePath(FILE_PATH_LITERAL("title2.html"))));
261 337
262 // Set the startup preference to open these URLs. 338 // Set the startup preference to open these URLs.
263 SessionStartupPref pref(SessionStartupPref::URLS); 339 SessionStartupPref pref(SessionStartupPref::URLS);
264 pref.urls = urls; 340 pref.urls = urls;
265 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 341 SessionStartupPref::SetStartupPref(browser()->profile(), pref);
266 342
267 // Do a simple non-process-startup browser launch. 343 // Do a simple non-process-startup browser launch.
268 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 344 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
269 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 345 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
270 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 346 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
271 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 347 {
272 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 348 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
273 browser()->host_desktop_type())); 349 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
350 browser()->host_desktop_type()));
351 }
274 352
275 // This should have created a new browser window. 353 // This should have created a new browser window.
276 Browser* new_browser = FindOneOtherBrowser(browser()); 354 Browser* new_browser = FindOneOtherBrowser(browser());
277 ASSERT_TRUE(new_browser); 355 ASSERT_TRUE(new_browser);
278 356
279 // The new browser should have exactly one tab (not the startup URLs). 357 if (internals::ShowWelcomePageAfterFirstRun()) {
358 // The new browser should have two tabs (not the startup URLs).
359 ASSERT_EQ(2, new_browser->tab_strip_model()->count());
360 } else {
361 // The new browser should have exactly one tab (not the startup URLs).
362 ASSERT_EQ(1, new_browser->tab_strip_model()->count());
363 }
364
365 // The test is complete if the welcome page wasn't included above.
366 if (!internals::ShowWelcomePageAfterFirstRun())
367 return;
368
369 // Close the browser opened above.
370 {
371 content::WindowedNotificationObserver observer(
372 chrome::NOTIFICATION_BROWSER_CLOSED,
373 content::Source<Browser>(new_browser));
374 new_browser->window()->Close();
375 observer.Wait();
376 }
377
378 // Try again to ensure that the welcome page isn't shown the second time.
379 {
380 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
381 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
382 browser()->host_desktop_type()));
383 }
384
385 // Find the new browser and ensure that it has only the one tab this time.
386 new_browser = FindOneOtherBrowser(browser());
387 ASSERT_TRUE(new_browser);
280 ASSERT_EQ(1, new_browser->tab_strip_model()->count()); 388 ASSERT_EQ(1, new_browser->tab_strip_model()->count());
281 } 389 }
282 390
283 // App shortcuts are not implemented on mac os. 391 // App shortcuts are not implemented on mac os.
284 #if !defined(OS_MACOSX) 392 #if !defined(OS_MACOSX)
285 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { 393 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) {
286 // Load an app with launch.container = 'tab'. 394 // Load an app with launch.container = 'tab'.
287 const Extension* extension_app = NULL; 395 const Extension* extension_app = NULL;
288 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); 396 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
289 397
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, 585 StartupBrowserCreatorImpl launch(base::FilePath(), dummy,
478 chrome::startup::IS_FIRST_RUN); 586 chrome::startup::IS_FIRST_RUN);
479 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 587 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
480 browser()->host_desktop_type())); 588 browser()->host_desktop_type()));
481 589
482 // This should have created a new browser window. 590 // This should have created a new browser window.
483 Browser* new_browser = FindOneOtherBrowser(browser()); 591 Browser* new_browser = FindOneOtherBrowser(browser());
484 ASSERT_TRUE(new_browser); 592 ASSERT_TRUE(new_browser);
485 593
486 TabStripModel* tab_strip = new_browser->tab_strip_model(); 594 TabStripModel* tab_strip = new_browser->tab_strip_model();
487 EXPECT_EQ(1, tab_strip->count());
488 595
489 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) { 596 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) {
597 // The browser should show only the promo.
598 ASSERT_EQ(1, tab_strip->count());
490 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), 599 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false),
491 tab_strip->GetWebContentsAt(0)->GetURL()); 600 tab_strip->GetWebContentsAt(0)->GetURL());
601 } else if (internals::ShowWelcomePageAfterFirstRun()) {
602 // The browser should show the welcome page and the NTP.
603 ASSERT_EQ(2, tab_strip->count());
604 EXPECT_EQ(GURL(internals::GetWelcomePageURL()),
605 tab_strip->GetWebContentsAt(0)->GetURL());
606 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
607 tab_strip->GetWebContentsAt(1)->GetURL());
492 } else { 608 } else {
609 // The browser should show only the NTP.
610 ASSERT_EQ(1, tab_strip->count());
493 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 611 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
494 tab_strip->GetWebContentsAt(0)->GetURL()); 612 tab_strip->GetWebContentsAt(0)->GetURL());
495 } 613 }
496 } 614 }
497 615
498 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) { 616 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) {
499 first_run::SetShouldShowWelcomePage(); 617 first_run::SetShouldShowWelcomePage();
500 618
501 // Do a simple non-process-startup browser launch. 619 // Do a simple non-process-startup browser launch.
502 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 620 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
503 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, 621 StartupBrowserCreatorImpl launch(base::FilePath(), dummy,
504 chrome::startup::IS_FIRST_RUN); 622 chrome::startup::IS_FIRST_RUN);
505 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 623 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
506 browser()->host_desktop_type())); 624 browser()->host_desktop_type()));
507 625
508 // This should have created a new browser window. 626 // This should have created a new browser window.
509 Browser* new_browser = FindOneOtherBrowser(browser()); 627 Browser* new_browser = FindOneOtherBrowser(browser());
510 ASSERT_TRUE(new_browser); 628 ASSERT_TRUE(new_browser);
511 629
512 TabStripModel* tab_strip = new_browser->tab_strip_model(); 630 TabStripModel* tab_strip = new_browser->tab_strip_model();
513 EXPECT_EQ(2, tab_strip->count()); 631 EXPECT_EQ(2, tab_strip->count());
514 632
515 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) { 633 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) {
516 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), 634 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false),
517 tab_strip->GetWebContentsAt(0)->GetURL()); 635 tab_strip->GetWebContentsAt(GetNTPIndex())->GetURL());
518 } else { 636 } else {
519 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 637 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
520 tab_strip->GetWebContentsAt(0)->GetURL()); 638 tab_strip->GetWebContentsAt(GetNTPIndex())->GetURL());
521 } 639 }
522 EXPECT_EQ(internals::GetWelcomePageURL(), 640 EXPECT_EQ(internals::GetWelcomePageURL(),
523 tab_strip->GetWebContentsAt(1)->GetURL()); 641 tab_strip->GetWebContentsAt(GetWelcomePageIndex())->GetURL());
524 } 642 }
525 643
526 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) { 644 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) {
527 StartupBrowserCreator browser_creator; 645 StartupBrowserCreator browser_creator;
528 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 646 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
529 647
530 // The welcome page should not be shown, even if 648 // The welcome page should not be shown, even if
531 // first_run::ShouldShowWelcomePage() says so, when there are already 649 // first_run::ShouldShowWelcomePage() says so, when there are already
532 // more than 2 first run tabs. 650 // more than 2 first run tabs.
533 first_run::SetShouldShowWelcomePage(); 651 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 765 // urls1 were opened in a browser for default_profile, and urls2 were opened
648 // in a browser for other_profile. 766 // in a browser for other_profile.
649 Browser* new_browser = NULL; 767 Browser* new_browser = NULL;
650 // |browser()| is still around at this point, even though we've closed its 768 // |browser()| is still around at this point, even though we've closed its
651 // window. Thus the browser count for default_profile is 2. 769 // window. Thus the browser count for default_profile is 2.
652 ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile, 770 ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile,
653 browser()->host_desktop_type())); 771 browser()->host_desktop_type()));
654 new_browser = FindOneOtherBrowserForProfile(default_profile, browser()); 772 new_browser = FindOneOtherBrowserForProfile(default_profile, browser());
655 ASSERT_TRUE(new_browser); 773 ASSERT_TRUE(new_browser);
656 TabStripModel* tab_strip = new_browser->tab_strip_model(); 774 TabStripModel* tab_strip = new_browser->tab_strip_model();
657 ASSERT_EQ(1, tab_strip->count()); 775 if (internals::ShowWelcomePageAfterFirstRun()) {
658 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(0)->GetURL()); 776 // The new browser should have the welcome tab and the URL for the profile.
777 ASSERT_EQ(2, tab_strip->count());
778 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0);
779 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), web_contents->GetURL());
780 web_contents = tab_strip->GetWebContentsAt(1);
781 EXPECT_EQ(urls1[0], web_contents->GetURL());
782 } else {
783 // The new browser should have only the desired URL for the profile.
784 ASSERT_EQ(1, tab_strip->count());
785 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0);
786 EXPECT_EQ(urls1[0], web_contents->GetURL());
787 }
659 788
660 ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile, 789 ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile,
661 browser()->host_desktop_type())); 790 browser()->host_desktop_type()));
662 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL); 791 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL);
663 ASSERT_TRUE(new_browser); 792 ASSERT_TRUE(new_browser);
664 tab_strip = new_browser->tab_strip_model(); 793 tab_strip = new_browser->tab_strip_model();
665 ASSERT_EQ(1, tab_strip->count()); 794 ASSERT_EQ(1, tab_strip->count());
666 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); 795 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL());
667 } 796 }
668 797
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 996
868 while (SessionRestore::IsRestoring(default_profile) || 997 while (SessionRestore::IsRestoring(default_profile) ||
869 SessionRestore::IsRestoring(profile_home1) || 998 SessionRestore::IsRestoring(profile_home1) ||
870 SessionRestore::IsRestoring(profile_home2) || 999 SessionRestore::IsRestoring(profile_home2) ||
871 SessionRestore::IsRestoring(profile_last) || 1000 SessionRestore::IsRestoring(profile_last) ||
872 SessionRestore::IsRestoring(profile_urls)) 1001 SessionRestore::IsRestoring(profile_urls))
873 base::MessageLoop::current()->RunUntilIdle(); 1002 base::MessageLoop::current()->RunUntilIdle();
874 1003
875 Browser* new_browser = NULL; 1004 Browser* new_browser = NULL;
876 // The last open profile (the profile_home1 in this case) will always be 1005 // The last open profile (the profile_home1 in this case) will always be
877 // launched, even if it will open just the home page. 1006 // launched, even if it will open just the home page (and the welcome page on
1007 // relevant platforms).
878 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1, original_desktop_type)); 1008 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1, original_desktop_type));
879 new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL); 1009 new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL);
880 ASSERT_TRUE(new_browser); 1010 ASSERT_TRUE(new_browser);
881 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1011 TabStripModel* tab_strip = new_browser->tab_strip_model();
882 ASSERT_EQ(1, tab_strip->count()); 1012 if (internals::ShowWelcomePageAfterFirstRun()) {
883 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1013 // The new browser should have the welcome tab and the NTP.
884 tab_strip->GetWebContentsAt(0)->GetURL()); 1014 ASSERT_EQ(2, tab_strip->count());
1015 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0);
1016 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), web_contents->GetURL());
1017 web_contents = tab_strip->GetWebContentsAt(1);
1018 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
1019 } else {
1020 // The new browser should have only the NTP.
1021 ASSERT_EQ(1, tab_strip->count());
1022 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0);
1023 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
1024 }
885 1025
886 // profile_urls opened the urls. 1026 // profile_urls opened the urls.
887 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, original_desktop_type)); 1027 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, original_desktop_type));
888 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); 1028 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
889 ASSERT_TRUE(new_browser); 1029 ASSERT_TRUE(new_browser);
890 tab_strip = new_browser->tab_strip_model(); 1030 tab_strip = new_browser->tab_strip_model();
891 ASSERT_EQ(1, tab_strip->count()); 1031 ASSERT_EQ(1, tab_strip->count());
892 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); 1032 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL());
893 1033
894 // profile_last opened the last open pages. 1034 // 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, 1120 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home,
981 last_opened_profiles); 1121 last_opened_profiles);
982 1122
983 // No profiles are getting restored, since they all display the crash info 1123 // No profiles are getting restored, since they all display the crash info
984 // bar. 1124 // bar.
985 EXPECT_FALSE(SessionRestore::IsRestoring(profile_home)); 1125 EXPECT_FALSE(SessionRestore::IsRestoring(profile_home));
986 EXPECT_FALSE(SessionRestore::IsRestoring(profile_last)); 1126 EXPECT_FALSE(SessionRestore::IsRestoring(profile_last));
987 EXPECT_FALSE(SessionRestore::IsRestoring(profile_urls)); 1127 EXPECT_FALSE(SessionRestore::IsRestoring(profile_urls));
988 1128
989 // The profile which normally opens the home page displays the new tab page. 1129 // The profile which normally opens the home page displays the new tab page.
1130 // The welcome page is also shown for relevant platforms.
990 Browser* new_browser = NULL; 1131 Browser* new_browser = NULL;
991 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, 1132 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home,
992 browser()->host_desktop_type())); 1133 browser()->host_desktop_type()));
993 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); 1134 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL);
994 ASSERT_TRUE(new_browser); 1135 ASSERT_TRUE(new_browser);
995 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1136 TabStripModel* tab_strip = new_browser->tab_strip_model();
996 ASSERT_EQ(1, tab_strip->count()); 1137 content::WebContents* web_contents = nullptr;
997 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); 1138 if (internals::ShowWelcomePageAfterFirstRun()) {
998 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); 1139 // The new browser should have the welcome tab and the NTP.
1140 ASSERT_EQ(2, tab_strip->count());
1141 web_contents = tab_strip->GetWebContentsAt(0);
1142 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), web_contents->GetURL());
1143 web_contents = tab_strip->GetWebContentsAt(1);
1144 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
1145 } else {
1146 // The new browser should have only the NTP.
1147 ASSERT_EQ(1, tab_strip->count());
1148 web_contents = tab_strip->GetWebContentsAt(0);
1149 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
1150 }
999 EnsureRestoreUIWasShown(web_contents); 1151 EnsureRestoreUIWasShown(web_contents);
1000 1152
1001 // The profile which normally opens last open pages displays the new tab page. 1153 // The profile which normally opens last open pages displays the new tab page.
1002 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, 1154 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last,
1003 browser()->host_desktop_type())); 1155 browser()->host_desktop_type()));
1004 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); 1156 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
1005 ASSERT_TRUE(new_browser); 1157 ASSERT_TRUE(new_browser);
1006 tab_strip = new_browser->tab_strip_model(); 1158 tab_strip = new_browser->tab_strip_model();
1007 ASSERT_EQ(1, tab_strip->count()); 1159 ASSERT_EQ(1, tab_strip->count());
1008 web_contents = tab_strip->GetWebContentsAt(0); 1160 web_contents = tab_strip->GetWebContentsAt(0);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 browser()->host_desktop_type())); 1284 browser()->host_desktop_type()));
1133 1285
1134 // This should have created a new browser window. 1286 // This should have created a new browser window.
1135 Browser* new_browser = FindOneOtherBrowser(browser()); 1287 Browser* new_browser = FindOneOtherBrowser(browser());
1136 ASSERT_TRUE(new_browser); 1288 ASSERT_TRUE(new_browser);
1137 1289
1138 // Verify that the NTP and the welcome page are shown. 1290 // Verify that the NTP and the welcome page are shown.
1139 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1291 TabStripModel* tab_strip = new_browser->tab_strip_model();
1140 ASSERT_EQ(2, tab_strip->count()); 1292 ASSERT_EQ(2, tab_strip->count());
1141 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1293 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1142 tab_strip->GetWebContentsAt(0)->GetURL()); 1294 tab_strip->GetWebContentsAt(GetNTPIndex())->GetURL());
1143 EXPECT_EQ(internals::GetWelcomePageURL(), 1295 EXPECT_EQ(internals::GetWelcomePageURL(),
1144 tab_strip->GetWebContentsAt(1)->GetURL()); 1296 tab_strip->GetWebContentsAt(GetWelcomePageIndex())->GetURL());
1145 } 1297 }
1146 1298
1147 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1299 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1148 // http://crbug.com/314819 1300 // http://crbug.com/314819
1149 #define MAYBE_SyncPromoAllowed DISABLED_SyncPromoAllowed 1301 #define MAYBE_SyncPromoAllowed DISABLED_SyncPromoAllowed
1150 #else 1302 #else
1151 #define MAYBE_SyncPromoAllowed SyncPromoAllowed 1303 #define MAYBE_SyncPromoAllowed SyncPromoAllowed
1152 #endif 1304 #endif
1153 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1305 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1154 MAYBE_SyncPromoAllowed) { 1306 MAYBE_SyncPromoAllowed) {
1307 if (!PlatformSupportsSyncPromo())
1308 return;
1155 // Consistently enable the welcome page on all platforms. 1309 // Consistently enable the welcome page on all platforms.
1156 first_run::SetShouldShowWelcomePage(); 1310 first_run::SetShouldShowWelcomePage();
1157 1311
1158 // Simulate the following master_preferences: 1312 // Simulate the following master_preferences:
1159 // { 1313 // {
1160 // "sync_promo": { 1314 // "sync_promo": {
1161 // "show_on_first_run_allowed": true 1315 // "show_on_first_run_allowed": true
1162 // } 1316 // }
1163 // } 1317 // }
1164 StartupBrowserCreator browser_creator; 1318 StartupBrowserCreator browser_creator;
(...skipping 21 matching lines...) Expand all
1186 } 1340 }
1187 1341
1188 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1342 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1189 // http://crbug.com/314819 1343 // http://crbug.com/314819
1190 #define MAYBE_FirstRunTabsPromoAllowed DISABLED_FirstRunTabsPromoAllowed 1344 #define MAYBE_FirstRunTabsPromoAllowed DISABLED_FirstRunTabsPromoAllowed
1191 #else 1345 #else
1192 #define MAYBE_FirstRunTabsPromoAllowed FirstRunTabsPromoAllowed 1346 #define MAYBE_FirstRunTabsPromoAllowed FirstRunTabsPromoAllowed
1193 #endif 1347 #endif
1194 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1348 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1195 MAYBE_FirstRunTabsPromoAllowed) { 1349 MAYBE_FirstRunTabsPromoAllowed) {
1350 if (!PlatformSupportsSyncPromo())
1351 return;
1196 // Simulate the following master_preferences: 1352 // Simulate the following master_preferences:
1197 // { 1353 // {
1198 // "first_run_tabs" : [ 1354 // "first_run_tabs" : [
1199 // "files/title1.html" 1355 // "files/title1.html"
1200 // ], 1356 // ],
1201 // "sync_promo": { 1357 // "sync_promo": {
1202 // "show_on_first_run_allowed": true 1358 // "show_on_first_run_allowed": true
1203 // } 1359 // }
1204 // } 1360 // }
1205 StartupBrowserCreator browser_creator; 1361 StartupBrowserCreator browser_creator;
(...skipping 23 matching lines...) Expand all
1229 1385
1230 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1386 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1231 // http://crbug.com/314819 1387 // http://crbug.com/314819
1232 #define MAYBE_FirstRunTabsContainSyncPromo \ 1388 #define MAYBE_FirstRunTabsContainSyncPromo \
1233 DISABLED_FirstRunTabsContainSyncPromo 1389 DISABLED_FirstRunTabsContainSyncPromo
1234 #else 1390 #else
1235 #define MAYBE_FirstRunTabsContainSyncPromo FirstRunTabsContainSyncPromo 1391 #define MAYBE_FirstRunTabsContainSyncPromo FirstRunTabsContainSyncPromo
1236 #endif 1392 #endif
1237 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1393 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1238 MAYBE_FirstRunTabsContainSyncPromo) { 1394 MAYBE_FirstRunTabsContainSyncPromo) {
1395 if (!PlatformSupportsSyncPromo())
1396 return;
1239 // Simulate the following master_preferences: 1397 // Simulate the following master_preferences:
1240 // { 1398 // {
1241 // "first_run_tabs" : [ 1399 // "first_run_tabs" : [
1242 // "files/title1.html", 1400 // "files/title1.html",
1243 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" 1401 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F"
1244 // ], 1402 // ],
1245 // "sync_promo": { 1403 // "sync_promo": {
1246 // "show_on_first_run_allowed": true 1404 // "show_on_first_run_allowed": true
1247 // } 1405 // }
1248 // } 1406 // }
(...skipping 29 matching lines...) Expand all
1278 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1436 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1279 // http://crbug.com/314819 1437 // http://crbug.com/314819
1280 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \ 1438 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \
1281 DISABLED_FirstRunTabsContainNTPSyncPromoAllowed 1439 DISABLED_FirstRunTabsContainNTPSyncPromoAllowed
1282 #else 1440 #else
1283 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \ 1441 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \
1284 FirstRunTabsContainNTPSyncPromoAllowed 1442 FirstRunTabsContainNTPSyncPromoAllowed
1285 #endif 1443 #endif
1286 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1444 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1287 MAYBE_FirstRunTabsContainNTPSyncPromoAllowed) { 1445 MAYBE_FirstRunTabsContainNTPSyncPromoAllowed) {
1446 if (!PlatformSupportsSyncPromo())
1447 return;
1288 // Simulate the following master_preferences: 1448 // Simulate the following master_preferences:
1289 // { 1449 // {
1290 // "first_run_tabs" : [ 1450 // "first_run_tabs" : [
1291 // "new_tab_page", 1451 // "new_tab_page",
1292 // "files/title1.html" 1452 // "files/title1.html"
1293 // ], 1453 // ],
1294 // "sync_promo": { 1454 // "sync_promo": {
1295 // "show_on_first_run_allowed": true 1455 // "show_on_first_run_allowed": true
1296 // } 1456 // }
1297 // } 1457 // }
(...skipping 27 matching lines...) Expand all
1325 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1485 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1326 // http://crbug.com/314819 1486 // http://crbug.com/314819
1327 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \ 1487 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \
1328 DISABLED_FirstRunTabsContainNTPSyncPromoForbidden 1488 DISABLED_FirstRunTabsContainNTPSyncPromoForbidden
1329 #else 1489 #else
1330 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \ 1490 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \
1331 FirstRunTabsContainNTPSyncPromoForbidden 1491 FirstRunTabsContainNTPSyncPromoForbidden
1332 #endif 1492 #endif
1333 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1493 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1334 MAYBE_FirstRunTabsContainNTPSyncPromoForbidden) { 1494 MAYBE_FirstRunTabsContainNTPSyncPromoForbidden) {
1495 if (!PlatformSupportsSyncPromo())
1496 return;
1335 // Simulate the following master_preferences: 1497 // Simulate the following master_preferences:
1336 // { 1498 // {
1337 // "first_run_tabs" : [ 1499 // "first_run_tabs" : [
1338 // "new_tab_page", 1500 // "new_tab_page",
1339 // "files/title1.html" 1501 // "files/title1.html"
1340 // ], 1502 // ],
1341 // "sync_promo": { 1503 // "sync_promo": {
1342 // "show_on_first_run_allowed": false 1504 // "show_on_first_run_allowed": false
1343 // } 1505 // }
1344 // } 1506 // }
(...skipping 26 matching lines...) Expand all
1371 1533
1372 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1534 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1373 // http://crbug.com/314819 1535 // http://crbug.com/314819
1374 #define MAYBE_FirstRunTabsSyncPromoForbidden \ 1536 #define MAYBE_FirstRunTabsSyncPromoForbidden \
1375 DISABLED_FirstRunTabsSyncPromoForbidden 1537 DISABLED_FirstRunTabsSyncPromoForbidden
1376 #else 1538 #else
1377 #define MAYBE_FirstRunTabsSyncPromoForbidden FirstRunTabsSyncPromoForbidden 1539 #define MAYBE_FirstRunTabsSyncPromoForbidden FirstRunTabsSyncPromoForbidden
1378 #endif 1540 #endif
1379 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1541 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1380 MAYBE_FirstRunTabsSyncPromoForbidden) { 1542 MAYBE_FirstRunTabsSyncPromoForbidden) {
1543 if (!PlatformSupportsSyncPromo())
1544 return;
1381 // Simulate the following master_preferences: 1545 // Simulate the following master_preferences:
1382 // { 1546 // {
1383 // "first_run_tabs" : [ 1547 // "first_run_tabs" : [
1384 // "files/title1.html" 1548 // "files/title1.html"
1385 // ], 1549 // ],
1386 // "sync_promo": { 1550 // "sync_promo": {
1387 // "show_on_first_run_allowed": false 1551 // "show_on_first_run_allowed": false
1388 // } 1552 // }
1389 // } 1553 // }
1390 StartupBrowserCreator browser_creator; 1554 StartupBrowserCreator browser_creator;
(...skipping 23 matching lines...) Expand all
1414 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) 1578 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
1415 // http://crbug.com/314819 1579 // http://crbug.com/314819
1416 #define MAYBE_RestoreOnStartupURLsPolicySpecified \ 1580 #define MAYBE_RestoreOnStartupURLsPolicySpecified \
1417 DISABLED_RestoreOnStartupURLsPolicySpecified 1581 DISABLED_RestoreOnStartupURLsPolicySpecified
1418 #else 1582 #else
1419 #define MAYBE_RestoreOnStartupURLsPolicySpecified \ 1583 #define MAYBE_RestoreOnStartupURLsPolicySpecified \
1420 RestoreOnStartupURLsPolicySpecified 1584 RestoreOnStartupURLsPolicySpecified
1421 #endif 1585 #endif
1422 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, 1586 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest,
1423 MAYBE_RestoreOnStartupURLsPolicySpecified) { 1587 MAYBE_RestoreOnStartupURLsPolicySpecified) {
1588 if (!PlatformSupportsSyncPromo())
1589 return;
1424 // Simulate the following master_preferences: 1590 // Simulate the following master_preferences:
1425 // { 1591 // {
1426 // "sync_promo": { 1592 // "sync_promo": {
1427 // "show_on_first_run_allowed": true 1593 // "show_on_first_run_allowed": true
1428 // } 1594 // }
1429 // } 1595 // }
1430 StartupBrowserCreator browser_creator; 1596 StartupBrowserCreator browser_creator;
1431 browser()->profile()->GetPrefs()->SetBoolean( 1597 browser()->profile()->GetPrefs()->SetBoolean(
1432 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1598 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1433 1599
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 ASSERT_EQ(1, tab_strip->count()); 1632 ASSERT_EQ(1, tab_strip->count());
1467 EXPECT_EQ("title1.html", 1633 EXPECT_EQ("title1.html",
1468 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1634 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1469 } 1635 }
1470 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1636 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1471 1637
1472 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1638 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1473 // defined(ENABLE_CONFIGURATION_POLICY) 1639 // defined(ENABLE_CONFIGURATION_POLICY)
1474 1640
1475 #endif // !defined(OS_CHROMEOS) 1641 #endif // !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698