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