OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <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 Loading... | |
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 | |
msw
2015/07/09 17:51:31
But the condition is simple, and changes to ShowWe
gab
2015/07/09 18:05:11
s/that support/that don't support/ ?
grt (UTC plus 2)
2015/07/10 15:43:24
Done.
grt (UTC plus 2)
2015/07/10 15:43:24
Good point. I agree that it's not good to couple t
| |
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 Loading... | |
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(); | |
msw
2015/07/09 17:51:31
Why isn't this needed for StartupURLsOnNewWindow w
grt (UTC plus 2)
2015/07/09 18:59:37
StartupURLsOnNewWindow closes the second browser (
| |
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(); |
gab
2015/07/09 18:05:11
(orthogonal: Wouldn't it be nice to have scoped ob
grt (UTC plus 2)
2015/07/10 15:43:24
Acknowledged.
| |
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); | |
gab
2015/07/09 18:05:11
The initial assignment above uses FindOneOtherBrow
grt (UTC plus 2)
2015/07/10 15:43:24
Comment added.
| |
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 Loading... | |
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 ASSERT_EQ(1, tab_strip->count()); | |
490 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | 598 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), |
491 tab_strip->GetWebContentsAt(0)->GetURL()); | 599 tab_strip->GetWebContentsAt(0)->GetURL()); |
600 } else if (internals::ShowWelcomePageAfterFirstRun()) { | |
601 ASSERT_EQ(2, tab_strip->count()); | |
602 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), | |
603 tab_strip->GetWebContentsAt(0)->GetURL()); | |
604 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | |
605 tab_strip->GetWebContentsAt(1)->GetURL()); | |
492 } else { | 606 } else { |
607 ASSERT_EQ(1, tab_strip->count()); | |
493 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 608 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
494 tab_strip->GetWebContentsAt(0)->GetURL()); | 609 tab_strip->GetWebContentsAt(0)->GetURL()); |
495 } | 610 } |
496 } | 611 } |
497 | 612 |
498 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) { | 613 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) { |
499 first_run::SetShouldShowWelcomePage(); | 614 first_run::SetShouldShowWelcomePage(); |
500 | 615 |
501 // Do a simple non-process-startup browser launch. | 616 // Do a simple non-process-startup browser launch. |
502 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 617 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
503 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, | 618 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, |
504 chrome::startup::IS_FIRST_RUN); | 619 chrome::startup::IS_FIRST_RUN); |
505 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, | 620 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, |
506 browser()->host_desktop_type())); | 621 browser()->host_desktop_type())); |
507 | 622 |
508 // This should have created a new browser window. | 623 // This should have created a new browser window. |
509 Browser* new_browser = FindOneOtherBrowser(browser()); | 624 Browser* new_browser = FindOneOtherBrowser(browser()); |
510 ASSERT_TRUE(new_browser); | 625 ASSERT_TRUE(new_browser); |
511 | 626 |
512 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 627 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
513 EXPECT_EQ(2, tab_strip->count()); | 628 EXPECT_EQ(2, tab_strip->count()); |
514 | 629 |
515 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) { | 630 if (signin::ShouldShowPromoAtStartup(browser()->profile(), true)) { |
516 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | 631 EXPECT_EQ(signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), |
517 tab_strip->GetWebContentsAt(0)->GetURL()); | 632 tab_strip->GetWebContentsAt(GetNTPIndex())->GetURL()); |
518 } else { | 633 } else { |
519 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 634 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
520 tab_strip->GetWebContentsAt(0)->GetURL()); | 635 tab_strip->GetWebContentsAt(GetNTPIndex())->GetURL()); |
521 } | 636 } |
522 EXPECT_EQ(internals::GetWelcomePageURL(), | 637 EXPECT_EQ(internals::GetWelcomePageURL(), |
523 tab_strip->GetWebContentsAt(1)->GetURL()); | 638 tab_strip->GetWebContentsAt(GetWelcomePageIndex())->GetURL()); |
524 } | 639 } |
525 | 640 |
526 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) { | 641 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) { |
527 StartupBrowserCreator browser_creator; | 642 StartupBrowserCreator browser_creator; |
528 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 643 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); |
529 | 644 |
530 // The welcome page should not be shown, even if | 645 // The welcome page should not be shown, even if |
531 // first_run::ShouldShowWelcomePage() says so, when there are already | 646 // first_run::ShouldShowWelcomePage() says so, when there are already |
532 // more than 2 first run tabs. | 647 // more than 2 first run tabs. |
533 first_run::SetShouldShowWelcomePage(); | 648 first_run::SetShouldShowWelcomePage(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
647 // urls1 were opened in a browser for default_profile, and urls2 were opened | 762 // urls1 were opened in a browser for default_profile, and urls2 were opened |
648 // in a browser for other_profile. | 763 // in a browser for other_profile. |
649 Browser* new_browser = NULL; | 764 Browser* new_browser = NULL; |
650 // |browser()| is still around at this point, even though we've closed its | 765 // |browser()| is still around at this point, even though we've closed its |
651 // window. Thus the browser count for default_profile is 2. | 766 // window. Thus the browser count for default_profile is 2. |
652 ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile, | 767 ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile, |
653 browser()->host_desktop_type())); | 768 browser()->host_desktop_type())); |
654 new_browser = FindOneOtherBrowserForProfile(default_profile, browser()); | 769 new_browser = FindOneOtherBrowserForProfile(default_profile, browser()); |
655 ASSERT_TRUE(new_browser); | 770 ASSERT_TRUE(new_browser); |
656 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 771 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
657 ASSERT_EQ(1, tab_strip->count()); | 772 ASSERT_LT(0, tab_strip->count()); |
msw
2015/07/09 17:51:30
nit: not necessary with the checks in each case be
gab
2015/07/09 18:05:11
Constant on RHS for inequalities (also >= 1 makes
grt (UTC plus 2)
2015/07/09 18:59:37
Done.
grt (UTC plus 2)
2015/07/09 18:59:37
tab_strip->GetWebContentsAt(0) on the next line wi
| |
658 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(0)->GetURL()); | 773 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); |
774 if (internals::ShowWelcomePageAfterFirstRun()) { | |
gab
2015/07/09 18:05:12
Add a comment here like:
// The first profile sho
grt (UTC plus 2)
2015/07/09 18:59:37
Done.
| |
775 ASSERT_EQ(2, tab_strip->count()); | |
776 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), web_contents->GetURL()); | |
777 web_contents = tab_strip->GetWebContentsAt(1); | |
gab
2015/07/09 18:05:11
When reading this I first got confused thinking th
grt (UTC plus 2)
2015/07/09 18:59:37
Done.
grt (UTC plus 2)
2015/07/10 15:43:24
i went ahead and removed these web_contents variab
| |
778 EXPECT_EQ(urls1[0], web_contents->GetURL()); | |
779 } else { | |
780 ASSERT_EQ(1, tab_strip->count()); | |
781 EXPECT_EQ(urls1[0], web_contents->GetURL()); | |
782 } | |
659 | 783 |
660 ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile, | 784 ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile, |
661 browser()->host_desktop_type())); | 785 browser()->host_desktop_type())); |
662 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL); | 786 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL); |
663 ASSERT_TRUE(new_browser); | 787 ASSERT_TRUE(new_browser); |
664 tab_strip = new_browser->tab_strip_model(); | 788 tab_strip = new_browser->tab_strip_model(); |
665 ASSERT_EQ(1, tab_strip->count()); | 789 ASSERT_EQ(1, tab_strip->count()); |
666 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); | 790 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); |
667 } | 791 } |
668 | 792 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
867 | 991 |
868 while (SessionRestore::IsRestoring(default_profile) || | 992 while (SessionRestore::IsRestoring(default_profile) || |
869 SessionRestore::IsRestoring(profile_home1) || | 993 SessionRestore::IsRestoring(profile_home1) || |
870 SessionRestore::IsRestoring(profile_home2) || | 994 SessionRestore::IsRestoring(profile_home2) || |
871 SessionRestore::IsRestoring(profile_last) || | 995 SessionRestore::IsRestoring(profile_last) || |
872 SessionRestore::IsRestoring(profile_urls)) | 996 SessionRestore::IsRestoring(profile_urls)) |
873 base::MessageLoop::current()->RunUntilIdle(); | 997 base::MessageLoop::current()->RunUntilIdle(); |
874 | 998 |
875 Browser* new_browser = NULL; | 999 Browser* new_browser = NULL; |
876 // The last open profile (the profile_home1 in this case) will always be | 1000 // The last open profile (the profile_home1 in this case) will always be |
877 // launched, even if it will open just the home page. | 1001 // launched, even if it will open just the home page (and the welcome page on |
gab
2015/07/09 18:05:11
s/home page/new tab page/
grt (UTC plus 2)
2015/07/10 15:43:24
Done.
| |
1002 // relevant platforms). | |
878 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1, original_desktop_type)); | 1003 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1, original_desktop_type)); |
879 new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL); | 1004 new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL); |
880 ASSERT_TRUE(new_browser); | 1005 ASSERT_TRUE(new_browser); |
881 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 1006 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
882 ASSERT_EQ(1, tab_strip->count()); | 1007 ASSERT_LT(0, tab_strip->count()); |
gab
2015/07/09 18:05:12
Redundant.
grt (UTC plus 2)
2015/07/10 15:43:24
removed
| |
883 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 1008 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); |
884 tab_strip->GetWebContentsAt(0)->GetURL()); | 1009 if (internals::ShowWelcomePageAfterFirstRun()) { |
1010 ASSERT_EQ(2, tab_strip->count()); | |
1011 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), web_contents->GetURL()); | |
1012 web_contents = tab_strip->GetWebContentsAt(1); | |
gab
2015/07/09 18:05:12
Same comment as above, suggest using explicit vari
grt (UTC plus 2)
2015/07/10 15:43:24
Done.
| |
1013 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | |
1014 } else { | |
1015 ASSERT_EQ(1, tab_strip->count()); | |
1016 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | |
1017 } | |
885 | 1018 |
886 // profile_urls opened the urls. | 1019 // profile_urls opened the urls. |
887 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, original_desktop_type)); | 1020 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, original_desktop_type)); |
888 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); | 1021 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); |
889 ASSERT_TRUE(new_browser); | 1022 ASSERT_TRUE(new_browser); |
890 tab_strip = new_browser->tab_strip_model(); | 1023 tab_strip = new_browser->tab_strip_model(); |
891 ASSERT_EQ(1, tab_strip->count()); | 1024 ASSERT_EQ(1, tab_strip->count()); |
892 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); | 1025 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); |
893 | 1026 |
894 // profile_last opened the last open pages. | 1027 // profile_last opened the last open pages. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home, | 1113 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home, |
981 last_opened_profiles); | 1114 last_opened_profiles); |
982 | 1115 |
983 // No profiles are getting restored, since they all display the crash info | 1116 // No profiles are getting restored, since they all display the crash info |
984 // bar. | 1117 // bar. |
985 EXPECT_FALSE(SessionRestore::IsRestoring(profile_home)); | 1118 EXPECT_FALSE(SessionRestore::IsRestoring(profile_home)); |
986 EXPECT_FALSE(SessionRestore::IsRestoring(profile_last)); | 1119 EXPECT_FALSE(SessionRestore::IsRestoring(profile_last)); |
987 EXPECT_FALSE(SessionRestore::IsRestoring(profile_urls)); | 1120 EXPECT_FALSE(SessionRestore::IsRestoring(profile_urls)); |
988 | 1121 |
989 // The profile which normally opens the home page displays the new tab page. | 1122 // The profile which normally opens the home page displays the new tab page. |
1123 // The welcome page is also shown for relevant platforms. | |
990 Browser* new_browser = NULL; | 1124 Browser* new_browser = NULL; |
991 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, | 1125 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, |
992 browser()->host_desktop_type())); | 1126 browser()->host_desktop_type())); |
993 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); | 1127 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); |
994 ASSERT_TRUE(new_browser); | 1128 ASSERT_TRUE(new_browser); |
995 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 1129 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
996 ASSERT_EQ(1, tab_strip->count()); | 1130 ASSERT_LT(0, tab_strip->count()); |
gab
2015/07/09 18:05:11
Redundant.
grt (UTC plus 2)
2015/07/10 15:43:24
removed
| |
997 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); | 1131 content::WebContents* web_contents = tab_strip->GetWebContentsAt(0); |
998 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | 1132 if (internals::ShowWelcomePageAfterFirstRun()) { |
1133 ASSERT_EQ(2, tab_strip->count()); | |
1134 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), web_contents->GetURL()); | |
1135 web_contents = tab_strip->GetWebContentsAt(1); | |
gab
2015/07/09 18:05:12
Explicit names.
grt (UTC plus 2)
2015/07/10 15:43:24
Done.
| |
1136 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | |
1137 } else { | |
1138 ASSERT_EQ(1, tab_strip->count()); | |
1139 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL()); | |
1140 } | |
999 EnsureRestoreUIWasShown(web_contents); | 1141 EnsureRestoreUIWasShown(web_contents); |
1000 | 1142 |
1001 // The profile which normally opens last open pages displays the new tab page. | 1143 // The profile which normally opens last open pages displays the new tab page. |
1002 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, | 1144 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, |
1003 browser()->host_desktop_type())); | 1145 browser()->host_desktop_type())); |
1004 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); | 1146 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); |
1005 ASSERT_TRUE(new_browser); | 1147 ASSERT_TRUE(new_browser); |
1006 tab_strip = new_browser->tab_strip_model(); | 1148 tab_strip = new_browser->tab_strip_model(); |
1007 ASSERT_EQ(1, tab_strip->count()); | 1149 ASSERT_EQ(1, tab_strip->count()); |
1008 web_contents = tab_strip->GetWebContentsAt(0); | 1150 web_contents = tab_strip->GetWebContentsAt(0); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1132 browser()->host_desktop_type())); | 1274 browser()->host_desktop_type())); |
1133 | 1275 |
1134 // This should have created a new browser window. | 1276 // This should have created a new browser window. |
1135 Browser* new_browser = FindOneOtherBrowser(browser()); | 1277 Browser* new_browser = FindOneOtherBrowser(browser()); |
1136 ASSERT_TRUE(new_browser); | 1278 ASSERT_TRUE(new_browser); |
1137 | 1279 |
1138 // Verify that the NTP and the welcome page are shown. | 1280 // Verify that the NTP and the welcome page are shown. |
1139 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 1281 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
1140 ASSERT_EQ(2, tab_strip->count()); | 1282 ASSERT_EQ(2, tab_strip->count()); |
1141 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 1283 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
1142 tab_strip->GetWebContentsAt(0)->GetURL()); | 1284 tab_strip->GetWebContentsAt(GetNTPIndex())->GetURL()); |
1143 EXPECT_EQ(internals::GetWelcomePageURL(), | 1285 EXPECT_EQ(internals::GetWelcomePageURL(), |
1144 tab_strip->GetWebContentsAt(1)->GetURL()); | 1286 tab_strip->GetWebContentsAt(GetWelcomePageIndex())->GetURL()); |
1145 } | 1287 } |
1146 | 1288 |
1147 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 1289 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) |
1148 // http://crbug.com/314819 | 1290 // http://crbug.com/314819 |
1149 #define MAYBE_SyncPromoAllowed DISABLED_SyncPromoAllowed | 1291 #define MAYBE_SyncPromoAllowed DISABLED_SyncPromoAllowed |
1150 #else | 1292 #else |
1151 #define MAYBE_SyncPromoAllowed SyncPromoAllowed | 1293 #define MAYBE_SyncPromoAllowed SyncPromoAllowed |
1152 #endif | 1294 #endif |
1153 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1295 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1154 MAYBE_SyncPromoAllowed) { | 1296 MAYBE_SyncPromoAllowed) { |
1297 if (!PlatformSupportsSyncPromo()) | |
1298 return; | |
1155 // Consistently enable the welcome page on all platforms. | 1299 // Consistently enable the welcome page on all platforms. |
1156 first_run::SetShouldShowWelcomePage(); | 1300 first_run::SetShouldShowWelcomePage(); |
1157 | 1301 |
1158 // Simulate the following master_preferences: | 1302 // Simulate the following master_preferences: |
1159 // { | 1303 // { |
1160 // "sync_promo": { | 1304 // "sync_promo": { |
1161 // "show_on_first_run_allowed": true | 1305 // "show_on_first_run_allowed": true |
1162 // } | 1306 // } |
1163 // } | 1307 // } |
1164 StartupBrowserCreator browser_creator; | 1308 StartupBrowserCreator browser_creator; |
(...skipping 21 matching lines...) Expand all Loading... | |
1186 } | 1330 } |
1187 | 1331 |
1188 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 1332 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) |
1189 // http://crbug.com/314819 | 1333 // http://crbug.com/314819 |
1190 #define MAYBE_FirstRunTabsPromoAllowed DISABLED_FirstRunTabsPromoAllowed | 1334 #define MAYBE_FirstRunTabsPromoAllowed DISABLED_FirstRunTabsPromoAllowed |
1191 #else | 1335 #else |
1192 #define MAYBE_FirstRunTabsPromoAllowed FirstRunTabsPromoAllowed | 1336 #define MAYBE_FirstRunTabsPromoAllowed FirstRunTabsPromoAllowed |
1193 #endif | 1337 #endif |
1194 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1338 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1195 MAYBE_FirstRunTabsPromoAllowed) { | 1339 MAYBE_FirstRunTabsPromoAllowed) { |
1340 if (!PlatformSupportsSyncPromo()) | |
1341 return; | |
1196 // Simulate the following master_preferences: | 1342 // Simulate the following master_preferences: |
1197 // { | 1343 // { |
1198 // "first_run_tabs" : [ | 1344 // "first_run_tabs" : [ |
1199 // "files/title1.html" | 1345 // "files/title1.html" |
1200 // ], | 1346 // ], |
1201 // "sync_promo": { | 1347 // "sync_promo": { |
1202 // "show_on_first_run_allowed": true | 1348 // "show_on_first_run_allowed": true |
1203 // } | 1349 // } |
1204 // } | 1350 // } |
1205 StartupBrowserCreator browser_creator; | 1351 StartupBrowserCreator browser_creator; |
(...skipping 23 matching lines...) Expand all Loading... | |
1229 | 1375 |
1230 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 1376 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) |
1231 // http://crbug.com/314819 | 1377 // http://crbug.com/314819 |
1232 #define MAYBE_FirstRunTabsContainSyncPromo \ | 1378 #define MAYBE_FirstRunTabsContainSyncPromo \ |
1233 DISABLED_FirstRunTabsContainSyncPromo | 1379 DISABLED_FirstRunTabsContainSyncPromo |
1234 #else | 1380 #else |
1235 #define MAYBE_FirstRunTabsContainSyncPromo FirstRunTabsContainSyncPromo | 1381 #define MAYBE_FirstRunTabsContainSyncPromo FirstRunTabsContainSyncPromo |
1236 #endif | 1382 #endif |
1237 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1383 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1238 MAYBE_FirstRunTabsContainSyncPromo) { | 1384 MAYBE_FirstRunTabsContainSyncPromo) { |
1385 if (!PlatformSupportsSyncPromo()) | |
1386 return; | |
1239 // Simulate the following master_preferences: | 1387 // Simulate the following master_preferences: |
1240 // { | 1388 // { |
1241 // "first_run_tabs" : [ | 1389 // "first_run_tabs" : [ |
1242 // "files/title1.html", | 1390 // "files/title1.html", |
1243 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" | 1391 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" |
1244 // ], | 1392 // ], |
1245 // "sync_promo": { | 1393 // "sync_promo": { |
1246 // "show_on_first_run_allowed": true | 1394 // "show_on_first_run_allowed": true |
1247 // } | 1395 // } |
1248 // } | 1396 // } |
(...skipping 29 matching lines...) Expand all Loading... | |
1278 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 1426 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) |
1279 // http://crbug.com/314819 | 1427 // http://crbug.com/314819 |
1280 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \ | 1428 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \ |
1281 DISABLED_FirstRunTabsContainNTPSyncPromoAllowed | 1429 DISABLED_FirstRunTabsContainNTPSyncPromoAllowed |
1282 #else | 1430 #else |
1283 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \ | 1431 #define MAYBE_FirstRunTabsContainNTPSyncPromoAllowed \ |
1284 FirstRunTabsContainNTPSyncPromoAllowed | 1432 FirstRunTabsContainNTPSyncPromoAllowed |
1285 #endif | 1433 #endif |
1286 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1434 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1287 MAYBE_FirstRunTabsContainNTPSyncPromoAllowed) { | 1435 MAYBE_FirstRunTabsContainNTPSyncPromoAllowed) { |
1436 if (!PlatformSupportsSyncPromo()) | |
1437 return; | |
1288 // Simulate the following master_preferences: | 1438 // Simulate the following master_preferences: |
1289 // { | 1439 // { |
1290 // "first_run_tabs" : [ | 1440 // "first_run_tabs" : [ |
1291 // "new_tab_page", | 1441 // "new_tab_page", |
1292 // "files/title1.html" | 1442 // "files/title1.html" |
1293 // ], | 1443 // ], |
1294 // "sync_promo": { | 1444 // "sync_promo": { |
1295 // "show_on_first_run_allowed": true | 1445 // "show_on_first_run_allowed": true |
1296 // } | 1446 // } |
1297 // } | 1447 // } |
(...skipping 27 matching lines...) Expand all Loading... | |
1325 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 1475 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) |
1326 // http://crbug.com/314819 | 1476 // http://crbug.com/314819 |
1327 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \ | 1477 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \ |
1328 DISABLED_FirstRunTabsContainNTPSyncPromoForbidden | 1478 DISABLED_FirstRunTabsContainNTPSyncPromoForbidden |
1329 #else | 1479 #else |
1330 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \ | 1480 #define MAYBE_FirstRunTabsContainNTPSyncPromoForbidden \ |
1331 FirstRunTabsContainNTPSyncPromoForbidden | 1481 FirstRunTabsContainNTPSyncPromoForbidden |
1332 #endif | 1482 #endif |
1333 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1483 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1334 MAYBE_FirstRunTabsContainNTPSyncPromoForbidden) { | 1484 MAYBE_FirstRunTabsContainNTPSyncPromoForbidden) { |
1485 if (!PlatformSupportsSyncPromo()) | |
1486 return; | |
1335 // Simulate the following master_preferences: | 1487 // Simulate the following master_preferences: |
1336 // { | 1488 // { |
1337 // "first_run_tabs" : [ | 1489 // "first_run_tabs" : [ |
1338 // "new_tab_page", | 1490 // "new_tab_page", |
1339 // "files/title1.html" | 1491 // "files/title1.html" |
1340 // ], | 1492 // ], |
1341 // "sync_promo": { | 1493 // "sync_promo": { |
1342 // "show_on_first_run_allowed": false | 1494 // "show_on_first_run_allowed": false |
1343 // } | 1495 // } |
1344 // } | 1496 // } |
(...skipping 26 matching lines...) Expand all Loading... | |
1371 | 1523 |
1372 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 1524 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) |
1373 // http://crbug.com/314819 | 1525 // http://crbug.com/314819 |
1374 #define MAYBE_FirstRunTabsSyncPromoForbidden \ | 1526 #define MAYBE_FirstRunTabsSyncPromoForbidden \ |
1375 DISABLED_FirstRunTabsSyncPromoForbidden | 1527 DISABLED_FirstRunTabsSyncPromoForbidden |
1376 #else | 1528 #else |
1377 #define MAYBE_FirstRunTabsSyncPromoForbidden FirstRunTabsSyncPromoForbidden | 1529 #define MAYBE_FirstRunTabsSyncPromoForbidden FirstRunTabsSyncPromoForbidden |
1378 #endif | 1530 #endif |
1379 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1531 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1380 MAYBE_FirstRunTabsSyncPromoForbidden) { | 1532 MAYBE_FirstRunTabsSyncPromoForbidden) { |
1533 if (!PlatformSupportsSyncPromo()) | |
1534 return; | |
1381 // Simulate the following master_preferences: | 1535 // Simulate the following master_preferences: |
1382 // { | 1536 // { |
1383 // "first_run_tabs" : [ | 1537 // "first_run_tabs" : [ |
1384 // "files/title1.html" | 1538 // "files/title1.html" |
1385 // ], | 1539 // ], |
1386 // "sync_promo": { | 1540 // "sync_promo": { |
1387 // "show_on_first_run_allowed": false | 1541 // "show_on_first_run_allowed": false |
1388 // } | 1542 // } |
1389 // } | 1543 // } |
1390 StartupBrowserCreator browser_creator; | 1544 StartupBrowserCreator browser_creator; |
(...skipping 23 matching lines...) Expand all Loading... | |
1414 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 1568 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) |
1415 // http://crbug.com/314819 | 1569 // http://crbug.com/314819 |
1416 #define MAYBE_RestoreOnStartupURLsPolicySpecified \ | 1570 #define MAYBE_RestoreOnStartupURLsPolicySpecified \ |
1417 DISABLED_RestoreOnStartupURLsPolicySpecified | 1571 DISABLED_RestoreOnStartupURLsPolicySpecified |
1418 #else | 1572 #else |
1419 #define MAYBE_RestoreOnStartupURLsPolicySpecified \ | 1573 #define MAYBE_RestoreOnStartupURLsPolicySpecified \ |
1420 RestoreOnStartupURLsPolicySpecified | 1574 RestoreOnStartupURLsPolicySpecified |
1421 #endif | 1575 #endif |
1422 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1576 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1423 MAYBE_RestoreOnStartupURLsPolicySpecified) { | 1577 MAYBE_RestoreOnStartupURLsPolicySpecified) { |
1578 if (!PlatformSupportsSyncPromo()) | |
1579 return; | |
1424 // Simulate the following master_preferences: | 1580 // Simulate the following master_preferences: |
1425 // { | 1581 // { |
1426 // "sync_promo": { | 1582 // "sync_promo": { |
1427 // "show_on_first_run_allowed": true | 1583 // "show_on_first_run_allowed": true |
1428 // } | 1584 // } |
1429 // } | 1585 // } |
1430 StartupBrowserCreator browser_creator; | 1586 StartupBrowserCreator browser_creator; |
1431 browser()->profile()->GetPrefs()->SetBoolean( | 1587 browser()->profile()->GetPrefs()->SetBoolean( |
1432 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1588 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
1433 | 1589 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1466 ASSERT_EQ(1, tab_strip->count()); | 1622 ASSERT_EQ(1, tab_strip->count()); |
1467 EXPECT_EQ("title1.html", | 1623 EXPECT_EQ("title1.html", |
1468 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1624 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
1469 } | 1625 } |
1470 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1626 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
1471 | 1627 |
1472 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1628 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
1473 // defined(ENABLE_CONFIGURATION_POLICY) | 1629 // defined(ENABLE_CONFIGURATION_POLICY) |
1474 | 1630 |
1475 #endif // !defined(OS_CHROMEOS) | 1631 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |