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 28 matching lines...) Expand all Loading... | |
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 "components/metrics/metrics_pref_names.h" | 44 #include "components/metrics/metrics_pref_names.h" |
45 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
46 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
47 #include "content/public/test/test_utils.h" | 47 #include "content/public/test/test_utils.h" |
48 #include "extensions/browser/extension_system.h" | 48 #include "extensions/browser/extension_system.h" |
49 #include "net/test/embedded_test_server/embedded_test_server.h" | |
49 #include "testing/gtest/include/gtest/gtest.h" | 50 #include "testing/gtest/include/gtest/gtest.h" |
50 #include "url/gurl.h" | 51 #include "url/gurl.h" |
51 | 52 |
52 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) | 53 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) |
53 #include "base/callback.h" | 54 #include "base/callback.h" |
54 #include "base/run_loop.h" | 55 #include "base/run_loop.h" |
55 #include "base/values.h" | 56 #include "base/values.h" |
56 #include "components/policy/core/browser/browser_policy_connector.h" | 57 #include "components/policy/core/browser/browser_policy_connector.h" |
57 #include "components/policy/core/common/external_data_fetcher.h" | 58 #include "components/policy/core/common/external_data_fetcher.h" |
58 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 59 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 // We don't do non-process-startup browser launches on ChromeOS. | 247 // We don't do non-process-startup browser launches on ChromeOS. |
247 // Session restore for process-startup browser launches is tested | 248 // Session restore for process-startup browser launches is tested |
248 // in session_restore_uitest. | 249 // in session_restore_uitest. |
249 #if !defined(OS_CHROMEOS) | 250 #if !defined(OS_CHROMEOS) |
250 // Verify that startup URLs are honored when the process already exists but has | 251 // Verify that startup URLs are honored when the process already exists but has |
251 // no tabbed browser windows (eg. as if the process is running only due to a | 252 // no tabbed browser windows (eg. as if the process is running only due to a |
252 // background application. | 253 // background application. |
253 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, | 254 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, |
254 StartupURLsOnNewWindowWithNoTabbedBrowsers) { | 255 StartupURLsOnNewWindowWithNoTabbedBrowsers) { |
255 // Use a couple same-site HTTP URLs. | 256 // Use a couple same-site HTTP URLs. |
256 ASSERT_TRUE(test_server()->Start()); | 257 ASSERT_TRUE(embedded_test_server()->Start()); |
257 std::vector<GURL> urls; | 258 std::vector<GURL> urls; |
258 urls.push_back(test_server()->GetURL("files/title1.html")); | 259 urls.push_back(embedded_test_server()->GetURL("/title1.html")); |
259 urls.push_back(test_server()->GetURL("files/title2.html")); | 260 urls.push_back(embedded_test_server()->GetURL("/title2.html")); |
260 | 261 |
261 Profile* profile = browser()->profile(); | 262 Profile* profile = browser()->profile(); |
262 chrome::HostDesktopType host_desktop_type = browser()->host_desktop_type(); | 263 chrome::HostDesktopType host_desktop_type = browser()->host_desktop_type(); |
263 | 264 |
264 // Set the startup preference to open these URLs. | 265 // Set the startup preference to open these URLs. |
265 SessionStartupPref pref(SessionStartupPref::URLS); | 266 SessionStartupPref pref(SessionStartupPref::URLS); |
266 pref.urls = urls; | 267 pref.urls = urls; |
267 SessionStartupPref::SetStartupPref(profile, pref); | 268 SessionStartupPref::SetStartupPref(profile, pref); |
268 | 269 |
269 // Keep the browser process running while browsers are closed. | 270 // Keep the browser process running while browsers are closed. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 EXPECT_FALSE(StartupBrowserCreator::WasRestarted()); | 521 EXPECT_FALSE(StartupBrowserCreator::WasRestarted()); |
521 } | 522 } |
522 | 523 |
523 // Fails on official builds. See http://crbug.com/313856 | 524 // Fails on official builds. See http://crbug.com/313856 |
524 #if defined(GOOGLE_CHROME_BUILD) | 525 #if defined(GOOGLE_CHROME_BUILD) |
525 #define MAYBE_AddFirstRunTab DISABLED_AddFirstRunTab | 526 #define MAYBE_AddFirstRunTab DISABLED_AddFirstRunTab |
526 #else | 527 #else |
527 #define MAYBE_AddFirstRunTab AddFirstRunTab | 528 #define MAYBE_AddFirstRunTab AddFirstRunTab |
528 #endif | 529 #endif |
529 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddFirstRunTab) { | 530 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddFirstRunTab) { |
531 ASSERT_TRUE(embedded_test_server()->Start()); | |
530 StartupBrowserCreator browser_creator; | 532 StartupBrowserCreator browser_creator; |
531 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 533 browser_creator.AddFirstRunTab( |
532 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html")); | 534 embedded_test_server()->GetURL("/title1.html")); |
535 browser_creator.AddFirstRunTab( | |
536 embedded_test_server()->GetURL("/title2.html")); | |
533 | 537 |
534 // Do a simple non-process-startup browser launch. | 538 // Do a simple non-process-startup browser launch. |
535 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 539 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
536 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 540 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
537 chrome::startup::IS_FIRST_RUN); | 541 chrome::startup::IS_FIRST_RUN); |
538 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, | 542 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, |
539 browser()->host_desktop_type())); | 543 browser()->host_desktop_type())); |
540 | 544 |
541 // This should have created a new browser window. | 545 // This should have created a new browser window. |
542 Browser* new_browser = FindOneOtherBrowser(browser()); | 546 Browser* new_browser = FindOneOtherBrowser(browser()); |
(...skipping 10 matching lines...) Expand all Loading... | |
553 | 557 |
554 // Test hard-coded special first run tabs (defined in | 558 // Test hard-coded special first run tabs (defined in |
555 // StartupBrowserCreatorImpl::AddStartupURLs()). | 559 // StartupBrowserCreatorImpl::AddStartupURLs()). |
556 // Fails on official builds. See http://crbug.com/313856 | 560 // Fails on official builds. See http://crbug.com/313856 |
557 #if defined(GOOGLE_CHROME_BUILD) | 561 #if defined(GOOGLE_CHROME_BUILD) |
558 #define MAYBE_AddCustomFirstRunTab DISABLED_AddCustomFirstRunTab | 562 #define MAYBE_AddCustomFirstRunTab DISABLED_AddCustomFirstRunTab |
559 #else | 563 #else |
560 #define MAYBE_AddCustomFirstRunTab AddCustomFirstRunTab | 564 #define MAYBE_AddCustomFirstRunTab AddCustomFirstRunTab |
561 #endif | 565 #endif |
562 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddCustomFirstRunTab) { | 566 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddCustomFirstRunTab) { |
567 ASSERT_TRUE(embedded_test_server()->Start()); | |
563 StartupBrowserCreator browser_creator; | 568 StartupBrowserCreator browser_creator; |
564 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 569 browser_creator.AddFirstRunTab( |
570 embedded_test_server()->GetURL("/title1.html")); | |
565 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); | 571 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); |
566 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html")); | 572 browser_creator.AddFirstRunTab( |
573 embedded_test_server()->GetURL("/title2.html")); | |
567 browser_creator.AddFirstRunTab(GURL("http://welcome_page")); | 574 browser_creator.AddFirstRunTab(GURL("http://welcome_page")); |
568 | 575 |
569 // Do a simple non-process-startup browser launch. | 576 // Do a simple non-process-startup browser launch. |
570 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 577 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
571 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 578 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
572 chrome::startup::IS_FIRST_RUN); | 579 chrome::startup::IS_FIRST_RUN); |
573 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, | 580 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, |
574 browser()->host_desktop_type())); | 581 browser()->host_desktop_type())); |
575 | 582 |
576 // This should have created a new browser window. | 583 // This should have created a new browser window. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 } else { | 660 } else { |
654 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 661 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
655 tab_strip->GetWebContentsAt(0)->GetURL()); | 662 tab_strip->GetWebContentsAt(0)->GetURL()); |
656 } | 663 } |
657 EXPECT_EQ(internals::GetWelcomePageURL(), | 664 EXPECT_EQ(internals::GetWelcomePageURL(), |
658 tab_strip->GetWebContentsAt(1)->GetURL()); | 665 tab_strip->GetWebContentsAt(1)->GetURL()); |
659 } | 666 } |
660 } | 667 } |
661 | 668 |
662 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) { | 669 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) { |
670 ASSERT_TRUE(embedded_test_server()->Start()); | |
663 StartupBrowserCreator browser_creator; | 671 StartupBrowserCreator browser_creator; |
664 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 672 browser_creator.AddFirstRunTab( |
673 embedded_test_server()->GetURL("/title1.html")); | |
665 | 674 |
666 // The welcome page should not be shown, even if | 675 // The welcome page should not be shown, even if |
667 // first_run::ShouldShowWelcomePage() says so, when there are already | 676 // first_run::ShouldShowWelcomePage() says so, when there are already |
668 // more than 2 first run tabs. | 677 // more than 2 first run tabs. |
669 first_run::SetShouldShowWelcomePage(); | 678 first_run::SetShouldShowWelcomePage(); |
670 | 679 |
671 // Do a simple non-process-startup browser launch. | 680 // Do a simple non-process-startup browser launch. |
672 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 681 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
673 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 682 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
674 chrome::startup::IS_FIRST_RUN); | 683 chrome::startup::IS_FIRST_RUN); |
(...skipping 15 matching lines...) Expand all Loading... | |
690 EXPECT_EQ(1, tab_strip->count()); | 699 EXPECT_EQ(1, tab_strip->count()); |
691 EXPECT_EQ("title1.html", | 700 EXPECT_EQ("title1.html", |
692 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 701 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
693 } | 702 } |
694 } | 703 } |
695 | 704 |
696 // The welcome page should still be shown if there are more than 2 first run | 705 // The welcome page should still be shown if there are more than 2 first run |
697 // tabs, but the welcome page was explcitly added to the first run tabs. | 706 // tabs, but the welcome page was explcitly added to the first run tabs. |
698 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, | 707 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, |
699 SyncPromoWithFirstRunTabsIncludingWelcomePage) { | 708 SyncPromoWithFirstRunTabsIncludingWelcomePage) { |
709 ASSERT_TRUE(embedded_test_server()->Start()); | |
700 StartupBrowserCreator browser_creator; | 710 StartupBrowserCreator browser_creator; |
701 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 711 browser_creator.AddFirstRunTab( |
712 embedded_test_server()->GetURL("/title1.html")); | |
702 browser_creator.AddFirstRunTab(GURL("http://welcome_page")); | 713 browser_creator.AddFirstRunTab(GURL("http://welcome_page")); |
703 | 714 |
704 // Do a simple non-process-startup browser launch. | 715 // Do a simple non-process-startup browser launch. |
705 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 716 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
706 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 717 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
707 chrome::startup::IS_FIRST_RUN); | 718 chrome::startup::IS_FIRST_RUN); |
708 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, | 719 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, |
709 browser()->host_desktop_type())); | 720 browser()->host_desktop_type())); |
710 | 721 |
711 // This should have created a new browser window. | 722 // This should have created a new browser window. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 ASSERT_TRUE(new_browser); | 819 ASSERT_TRUE(new_browser); |
809 tab_strip = new_browser->tab_strip_model(); | 820 tab_strip = new_browser->tab_strip_model(); |
810 ASSERT_EQ(1, tab_strip->count()); | 821 ASSERT_EQ(1, tab_strip->count()); |
811 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); | 822 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); |
812 } | 823 } |
813 | 824 |
814 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, PRE_UpdateWithTwoProfiles) { | 825 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, PRE_UpdateWithTwoProfiles) { |
815 // Simulate a browser restart by creating the profiles in the PRE_ part. | 826 // Simulate a browser restart by creating the profiles in the PRE_ part. |
816 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 827 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
817 | 828 |
818 ASSERT_TRUE(test_server()->Start()); | 829 ASSERT_TRUE(embedded_test_server()->Start()); |
819 | 830 |
820 // Create two profiles. | 831 // Create two profiles. |
821 base::FilePath dest_path = profile_manager->user_data_dir(); | 832 base::FilePath dest_path = profile_manager->user_data_dir(); |
822 | 833 |
823 Profile* profile1 = profile_manager->GetProfile( | 834 Profile* profile1 = profile_manager->GetProfile( |
824 dest_path.Append(FILE_PATH_LITERAL("New Profile 1"))); | 835 dest_path.Append(FILE_PATH_LITERAL("New Profile 1"))); |
825 ASSERT_TRUE(profile1); | 836 ASSERT_TRUE(profile1); |
826 | 837 |
827 Profile* profile2 = profile_manager->GetProfile( | 838 Profile* profile2 = profile_manager->GetProfile( |
828 dest_path.Append(FILE_PATH_LITERAL("New Profile 2"))); | 839 dest_path.Append(FILE_PATH_LITERAL("New Profile 2"))); |
829 ASSERT_TRUE(profile2); | 840 ASSERT_TRUE(profile2); |
830 | 841 |
831 // Open some urls with the browsers, and close them. | 842 // Open some urls with the browsers, and close them. |
832 Browser* browser1 = new Browser( | 843 Browser* browser1 = new Browser( |
833 Browser::CreateParams(Browser::TYPE_TABBED, profile1, | 844 Browser::CreateParams(Browser::TYPE_TABBED, profile1, |
834 browser()->host_desktop_type())); | 845 browser()->host_desktop_type())); |
835 chrome::NewTab(browser1); | 846 chrome::NewTab(browser1); |
836 ui_test_utils::NavigateToURL(browser1, | 847 ui_test_utils::NavigateToURL(browser1, |
837 test_server()->GetURL("files/empty.html")); | 848 embedded_test_server()->GetURL("/empty.html")); |
838 CloseBrowserSynchronously(browser1); | 849 CloseBrowserSynchronously(browser1); |
839 | 850 |
840 Browser* browser2 = new Browser( | 851 Browser* browser2 = new Browser( |
841 Browser::CreateParams(Browser::TYPE_TABBED, profile2, | 852 Browser::CreateParams(Browser::TYPE_TABBED, profile2, |
842 browser()->host_desktop_type())); | 853 browser()->host_desktop_type())); |
843 chrome::NewTab(browser2); | 854 chrome::NewTab(browser2); |
844 ui_test_utils::NavigateToURL(browser2, | 855 ui_test_utils::NavigateToURL(browser2, |
845 test_server()->GetURL("files/form.html")); | 856 embedded_test_server()->GetURL("/form.html")); |
846 CloseBrowserSynchronously(browser2); | 857 CloseBrowserSynchronously(browser2); |
847 | 858 |
848 // Set different startup preferences for the 2 profiles. | 859 // Set different startup preferences for the 2 profiles. |
849 std::vector<GURL> urls1; | 860 std::vector<GURL> urls1; |
850 urls1.push_back(ui_test_utils::GetTestUrl( | 861 urls1.push_back(ui_test_utils::GetTestUrl( |
851 base::FilePath(base::FilePath::kCurrentDirectory), | 862 base::FilePath(base::FilePath::kCurrentDirectory), |
852 base::FilePath(FILE_PATH_LITERAL("title1.html")))); | 863 base::FilePath(FILE_PATH_LITERAL("title1.html")))); |
853 std::vector<GURL> urls2; | 864 std::vector<GURL> urls2; |
854 urls2.push_back(ui_test_utils::GetTestUrl( | 865 urls2.push_back(ui_test_utils::GetTestUrl( |
855 base::FilePath(base::FilePath::kCurrentDirectory), | 866 base::FilePath(base::FilePath::kCurrentDirectory), |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
914 EXPECT_TRUE(profile1->restored_last_session()); | 925 EXPECT_TRUE(profile1->restored_last_session()); |
915 EXPECT_TRUE(profile2->restored_last_session()); | 926 EXPECT_TRUE(profile2->restored_last_session()); |
916 | 927 |
917 Browser* new_browser = NULL; | 928 Browser* new_browser = NULL; |
918 ASSERT_EQ(1u, chrome::GetBrowserCount(profile1, | 929 ASSERT_EQ(1u, chrome::GetBrowserCount(profile1, |
919 browser()->host_desktop_type())); | 930 browser()->host_desktop_type())); |
920 new_browser = FindOneOtherBrowserForProfile(profile1, NULL); | 931 new_browser = FindOneOtherBrowserForProfile(profile1, NULL); |
921 ASSERT_TRUE(new_browser); | 932 ASSERT_TRUE(new_browser); |
922 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 933 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
923 ASSERT_EQ(1, tab_strip->count()); | 934 ASSERT_EQ(1, tab_strip->count()); |
924 EXPECT_EQ("/files/empty.html", | 935 EXPECT_EQ("/empty.html", tab_strip->GetWebContentsAt(0)->GetURL().path()); |
925 tab_strip->GetWebContentsAt(0)->GetURL().path()); | |
926 | 936 |
927 ASSERT_EQ(1u, chrome::GetBrowserCount(profile2, | 937 ASSERT_EQ(1u, chrome::GetBrowserCount(profile2, |
928 browser()->host_desktop_type())); | 938 browser()->host_desktop_type())); |
929 new_browser = FindOneOtherBrowserForProfile(profile2, NULL); | 939 new_browser = FindOneOtherBrowserForProfile(profile2, NULL); |
930 ASSERT_TRUE(new_browser); | 940 ASSERT_TRUE(new_browser); |
931 tab_strip = new_browser->tab_strip_model(); | 941 tab_strip = new_browser->tab_strip_model(); |
932 ASSERT_EQ(1, tab_strip->count()); | 942 ASSERT_EQ(1, tab_strip->count()); |
933 EXPECT_EQ("/files/form.html", | 943 EXPECT_EQ("/form.html", tab_strip->GetWebContentsAt(0)->GetURL().path()); |
934 tab_strip->GetWebContentsAt(0)->GetURL().path()); | |
935 } | 944 } |
936 | 945 |
937 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, | 946 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, |
938 ProfilesWithoutPagesNotLaunched) { | 947 ProfilesWithoutPagesNotLaunched) { |
939 #if defined(OS_WIN) && defined(USE_ASH) | 948 #if defined(OS_WIN) && defined(USE_ASH) |
940 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 949 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
941 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 950 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
942 switches::kAshBrowserTests)) | 951 switches::kAshBrowserTests)) |
943 return; | 952 return; |
944 #endif | 953 #endif |
954 embedded_test_server()->Start(); | |
mmenke
2015/11/17 21:54:12
ASSERT_TRUE
svaldez
2015/11/17 22:18:54
Done.
| |
945 | 955 |
946 Profile* default_profile = browser()->profile(); | 956 Profile* default_profile = browser()->profile(); |
947 | 957 |
948 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 958 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
949 | 959 |
950 // Create 4 more profiles. | 960 // Create 4 more profiles. |
951 base::FilePath dest_path1 = profile_manager->user_data_dir().Append( | 961 base::FilePath dest_path1 = profile_manager->user_data_dir().Append( |
952 FILE_PATH_LITERAL("New Profile 1")); | 962 FILE_PATH_LITERAL("New Profile 1")); |
953 base::FilePath dest_path2 = profile_manager->user_data_dir().Append( | 963 base::FilePath dest_path2 = profile_manager->user_data_dir().Append( |
954 FILE_PATH_LITERAL("New Profile 2")); | 964 FILE_PATH_LITERAL("New Profile 2")); |
(...skipping 28 matching lines...) Expand all Loading... | |
983 SessionStartupPref pref_urls(SessionStartupPref::URLS); | 993 SessionStartupPref pref_urls(SessionStartupPref::URLS); |
984 pref_urls.urls = urls; | 994 pref_urls.urls = urls; |
985 SessionStartupPref::SetStartupPref(profile_urls, pref_urls); | 995 SessionStartupPref::SetStartupPref(profile_urls, pref_urls); |
986 | 996 |
987 // Open a page with profile_last. | 997 // Open a page with profile_last. |
988 Browser* browser_last = new Browser( | 998 Browser* browser_last = new Browser( |
989 Browser::CreateParams(Browser::TYPE_TABBED, profile_last, | 999 Browser::CreateParams(Browser::TYPE_TABBED, profile_last, |
990 browser()->host_desktop_type())); | 1000 browser()->host_desktop_type())); |
991 chrome::NewTab(browser_last); | 1001 chrome::NewTab(browser_last); |
992 ui_test_utils::NavigateToURL(browser_last, | 1002 ui_test_utils::NavigateToURL(browser_last, |
993 test_server()->GetURL("files/empty.html")); | 1003 embedded_test_server()->GetURL("/empty.html")); |
994 CloseBrowserAsynchronously(browser_last); | 1004 CloseBrowserAsynchronously(browser_last); |
995 | 1005 |
996 // Close the main browser. | 1006 // Close the main browser. |
997 chrome::HostDesktopType original_desktop_type = | 1007 chrome::HostDesktopType original_desktop_type = |
998 browser()->host_desktop_type(); | 1008 browser()->host_desktop_type(); |
999 CloseBrowserAsynchronously(browser()); | 1009 CloseBrowserAsynchronously(browser()); |
1000 | 1010 |
1001 // Do a simple non-process-startup browser launch. | 1011 // Do a simple non-process-startup browser launch. |
1002 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 1012 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
1003 | 1013 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1046 tab_strip = new_browser->tab_strip_model(); | 1056 tab_strip = new_browser->tab_strip_model(); |
1047 ASSERT_EQ(1, tab_strip->count()); | 1057 ASSERT_EQ(1, tab_strip->count()); |
1048 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); | 1058 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); |
1049 | 1059 |
1050 // profile_last opened the last open pages. | 1060 // profile_last opened the last open pages. |
1051 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, original_desktop_type)); | 1061 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, original_desktop_type)); |
1052 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); | 1062 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); |
1053 ASSERT_TRUE(new_browser); | 1063 ASSERT_TRUE(new_browser); |
1054 tab_strip = new_browser->tab_strip_model(); | 1064 tab_strip = new_browser->tab_strip_model(); |
1055 ASSERT_EQ(1, tab_strip->count()); | 1065 ASSERT_EQ(1, tab_strip->count()); |
1056 EXPECT_EQ("/files/empty.html", | 1066 EXPECT_EQ("/empty.html", tab_strip->GetWebContentsAt(0)->GetURL().path()); |
1057 tab_strip->GetWebContentsAt(0)->GetURL().path()); | |
1058 | 1067 |
1059 // profile_home2 was not launched since it would've only opened the home page. | 1068 // profile_home2 was not launched since it would've only opened the home page. |
1060 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type)); | 1069 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type)); |
1061 } | 1070 } |
1062 | 1071 |
1063 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { | 1072 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { |
1064 #if defined(OS_WIN) && defined(USE_ASH) | 1073 #if defined(OS_WIN) && defined(USE_ASH) |
1065 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 1074 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
1066 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1075 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1067 switches::kAshBrowserTests)) | 1076 switches::kAshBrowserTests)) |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1410 #else | 1419 #else |
1411 #define MAYBE_FirstRunTabsPromoAllowed FirstRunTabsPromoAllowed | 1420 #define MAYBE_FirstRunTabsPromoAllowed FirstRunTabsPromoAllowed |
1412 #endif | 1421 #endif |
1413 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1422 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1414 MAYBE_FirstRunTabsPromoAllowed) { | 1423 MAYBE_FirstRunTabsPromoAllowed) { |
1415 if (!PlatformSupportsSyncPromo()) | 1424 if (!PlatformSupportsSyncPromo()) |
1416 return; | 1425 return; |
1417 // Simulate the following master_preferences: | 1426 // Simulate the following master_preferences: |
1418 // { | 1427 // { |
1419 // "first_run_tabs" : [ | 1428 // "first_run_tabs" : [ |
1420 // "files/title1.html" | 1429 // "/title1.html" |
1421 // ], | 1430 // ], |
1422 // "sync_promo": { | 1431 // "sync_promo": { |
1423 // "show_on_first_run_allowed": true | 1432 // "show_on_first_run_allowed": true |
1424 // } | 1433 // } |
1425 // } | 1434 // } |
1435 ASSERT_TRUE(embedded_test_server()->Start()); | |
1426 StartupBrowserCreator browser_creator; | 1436 StartupBrowserCreator browser_creator; |
1427 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 1437 browser_creator.AddFirstRunTab( |
1438 embedded_test_server()->GetURL("/title1.html")); | |
1428 browser()->profile()->GetPrefs()->SetBoolean( | 1439 browser()->profile()->GetPrefs()->SetBoolean( |
1429 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1440 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
1430 | 1441 |
1431 // Do a process-startup browser launch. | 1442 // Do a process-startup browser launch. |
1432 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 1443 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
1433 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1444 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
1434 chrome::startup::IS_FIRST_RUN); | 1445 chrome::startup::IS_FIRST_RUN); |
1435 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, | 1446 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, |
1436 browser()->host_desktop_type())); | 1447 browser()->host_desktop_type())); |
1437 | 1448 |
(...skipping 17 matching lines...) Expand all Loading... | |
1455 #else | 1466 #else |
1456 #define MAYBE_FirstRunTabsContainSyncPromo FirstRunTabsContainSyncPromo | 1467 #define MAYBE_FirstRunTabsContainSyncPromo FirstRunTabsContainSyncPromo |
1457 #endif | 1468 #endif |
1458 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1469 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1459 MAYBE_FirstRunTabsContainSyncPromo) { | 1470 MAYBE_FirstRunTabsContainSyncPromo) { |
1460 if (!PlatformSupportsSyncPromo()) | 1471 if (!PlatformSupportsSyncPromo()) |
1461 return; | 1472 return; |
1462 // Simulate the following master_preferences: | 1473 // Simulate the following master_preferences: |
1463 // { | 1474 // { |
1464 // "first_run_tabs" : [ | 1475 // "first_run_tabs" : [ |
1465 // "files/title1.html", | 1476 // "/title1.html", |
1466 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" | 1477 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" |
1467 // ], | 1478 // ], |
1468 // "sync_promo": { | 1479 // "sync_promo": { |
1469 // "show_on_first_run_allowed": true | 1480 // "show_on_first_run_allowed": true |
1470 // } | 1481 // } |
1471 // } | 1482 // } |
1472 ASSERT_TRUE(test_server()->Start()); | 1483 ASSERT_TRUE(embedded_test_server()->Start()); |
1473 StartupBrowserCreator browser_creator; | 1484 StartupBrowserCreator browser_creator; |
1474 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 1485 browser_creator.AddFirstRunTab( |
1486 embedded_test_server()->GetURL("/title1.html")); | |
1475 browser_creator.AddFirstRunTab( | 1487 browser_creator.AddFirstRunTab( |
1476 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false)); | 1488 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false)); |
1477 browser()->profile()->GetPrefs()->SetBoolean( | 1489 browser()->profile()->GetPrefs()->SetBoolean( |
1478 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1490 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
1479 | 1491 |
1480 // Do a process-startup browser launch. | 1492 // Do a process-startup browser launch. |
1481 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 1493 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
1482 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1494 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
1483 chrome::startup::IS_FIRST_RUN); | 1495 chrome::startup::IS_FIRST_RUN); |
1484 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, | 1496 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, |
(...skipping 22 matching lines...) Expand all Loading... | |
1507 FirstRunTabsContainNTPSyncPromoAllowed | 1519 FirstRunTabsContainNTPSyncPromoAllowed |
1508 #endif | 1520 #endif |
1509 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1521 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1510 MAYBE_FirstRunTabsContainNTPSyncPromoAllowed) { | 1522 MAYBE_FirstRunTabsContainNTPSyncPromoAllowed) { |
1511 if (!PlatformSupportsSyncPromo()) | 1523 if (!PlatformSupportsSyncPromo()) |
1512 return; | 1524 return; |
1513 // Simulate the following master_preferences: | 1525 // Simulate the following master_preferences: |
1514 // { | 1526 // { |
1515 // "first_run_tabs" : [ | 1527 // "first_run_tabs" : [ |
1516 // "new_tab_page", | 1528 // "new_tab_page", |
1517 // "files/title1.html" | 1529 // "/title1.html" |
1518 // ], | 1530 // ], |
1519 // "sync_promo": { | 1531 // "sync_promo": { |
1520 // "show_on_first_run_allowed": true | 1532 // "show_on_first_run_allowed": true |
1521 // } | 1533 // } |
1522 // } | 1534 // } |
1535 ASSERT_TRUE(embedded_test_server()->Start()); | |
1523 StartupBrowserCreator browser_creator; | 1536 StartupBrowserCreator browser_creator; |
1524 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); | 1537 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); |
1525 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 1538 browser_creator.AddFirstRunTab( |
1539 embedded_test_server()->GetURL("/title1.html")); | |
1526 browser()->profile()->GetPrefs()->SetBoolean( | 1540 browser()->profile()->GetPrefs()->SetBoolean( |
1527 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1541 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
1528 | 1542 |
1529 // Do a process-startup browser launch. | 1543 // Do a process-startup browser launch. |
1530 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 1544 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
1531 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1545 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
1532 chrome::startup::IS_FIRST_RUN); | 1546 chrome::startup::IS_FIRST_RUN); |
1533 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, | 1547 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, |
1534 browser()->host_desktop_type())); | 1548 browser()->host_desktop_type())); |
1535 | 1549 |
(...skipping 20 matching lines...) Expand all Loading... | |
1556 FirstRunTabsContainNTPSyncPromoForbidden | 1570 FirstRunTabsContainNTPSyncPromoForbidden |
1557 #endif | 1571 #endif |
1558 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1572 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1559 MAYBE_FirstRunTabsContainNTPSyncPromoForbidden) { | 1573 MAYBE_FirstRunTabsContainNTPSyncPromoForbidden) { |
1560 if (!PlatformSupportsSyncPromo()) | 1574 if (!PlatformSupportsSyncPromo()) |
1561 return; | 1575 return; |
1562 // Simulate the following master_preferences: | 1576 // Simulate the following master_preferences: |
1563 // { | 1577 // { |
1564 // "first_run_tabs" : [ | 1578 // "first_run_tabs" : [ |
1565 // "new_tab_page", | 1579 // "new_tab_page", |
1566 // "files/title1.html" | 1580 // "/title1.html" |
1567 // ], | 1581 // ], |
1568 // "sync_promo": { | 1582 // "sync_promo": { |
1569 // "show_on_first_run_allowed": false | 1583 // "show_on_first_run_allowed": false |
1570 // } | 1584 // } |
1571 // } | 1585 // } |
1586 ASSERT_TRUE(embedded_test_server()->Start()); | |
1572 StartupBrowserCreator browser_creator; | 1587 StartupBrowserCreator browser_creator; |
1573 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); | 1588 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); |
1574 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 1589 browser_creator.AddFirstRunTab( |
1590 embedded_test_server()->GetURL("/title1.html")); | |
1575 browser()->profile()->GetPrefs()->SetBoolean( | 1591 browser()->profile()->GetPrefs()->SetBoolean( |
1576 prefs::kSignInPromoShowOnFirstRunAllowed, false); | 1592 prefs::kSignInPromoShowOnFirstRunAllowed, false); |
1577 | 1593 |
1578 // Do a process-startup browser launch. | 1594 // Do a process-startup browser launch. |
1579 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 1595 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
1580 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1596 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
1581 chrome::startup::IS_FIRST_RUN); | 1597 chrome::startup::IS_FIRST_RUN); |
1582 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, | 1598 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, |
1583 browser()->host_desktop_type())); | 1599 browser()->host_desktop_type())); |
1584 | 1600 |
(...skipping 18 matching lines...) Expand all Loading... | |
1603 #else | 1619 #else |
1604 #define MAYBE_FirstRunTabsSyncPromoForbidden FirstRunTabsSyncPromoForbidden | 1620 #define MAYBE_FirstRunTabsSyncPromoForbidden FirstRunTabsSyncPromoForbidden |
1605 #endif | 1621 #endif |
1606 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1622 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1607 MAYBE_FirstRunTabsSyncPromoForbidden) { | 1623 MAYBE_FirstRunTabsSyncPromoForbidden) { |
1608 if (!PlatformSupportsSyncPromo()) | 1624 if (!PlatformSupportsSyncPromo()) |
1609 return; | 1625 return; |
1610 // Simulate the following master_preferences: | 1626 // Simulate the following master_preferences: |
1611 // { | 1627 // { |
1612 // "first_run_tabs" : [ | 1628 // "first_run_tabs" : [ |
1613 // "files/title1.html" | 1629 // "/title1.html" |
1614 // ], | 1630 // ], |
1615 // "sync_promo": { | 1631 // "sync_promo": { |
1616 // "show_on_first_run_allowed": false | 1632 // "show_on_first_run_allowed": false |
1617 // } | 1633 // } |
1618 // } | 1634 // } |
1635 ASSERT_TRUE(embedded_test_server()->Start()); | |
1619 StartupBrowserCreator browser_creator; | 1636 StartupBrowserCreator browser_creator; |
1620 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 1637 browser_creator.AddFirstRunTab( |
1638 embedded_test_server()->GetURL("/title1.html")); | |
1621 browser()->profile()->GetPrefs()->SetBoolean( | 1639 browser()->profile()->GetPrefs()->SetBoolean( |
1622 prefs::kSignInPromoShowOnFirstRunAllowed, false); | 1640 prefs::kSignInPromoShowOnFirstRunAllowed, false); |
1623 | 1641 |
1624 // Do a process-startup browser launch. | 1642 // Do a process-startup browser launch. |
1625 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 1643 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
1626 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1644 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
1627 chrome::startup::IS_FIRST_RUN); | 1645 chrome::startup::IS_FIRST_RUN); |
1628 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, | 1646 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, |
1629 browser()->host_desktop_type())); | 1647 browser()->host_desktop_type())); |
1630 | 1648 |
(...skipping 20 matching lines...) Expand all Loading... | |
1651 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, | 1669 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, |
1652 MAYBE_RestoreOnStartupURLsPolicySpecified) { | 1670 MAYBE_RestoreOnStartupURLsPolicySpecified) { |
1653 if (!PlatformSupportsSyncPromo()) | 1671 if (!PlatformSupportsSyncPromo()) |
1654 return; | 1672 return; |
1655 // Simulate the following master_preferences: | 1673 // Simulate the following master_preferences: |
1656 // { | 1674 // { |
1657 // "sync_promo": { | 1675 // "sync_promo": { |
1658 // "show_on_first_run_allowed": true | 1676 // "show_on_first_run_allowed": true |
1659 // } | 1677 // } |
1660 // } | 1678 // } |
1679 ASSERT_TRUE(embedded_test_server()->Start()); | |
1661 StartupBrowserCreator browser_creator; | 1680 StartupBrowserCreator browser_creator; |
1662 browser()->profile()->GetPrefs()->SetBoolean( | 1681 browser()->profile()->GetPrefs()->SetBoolean( |
1663 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1682 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
1664 | 1683 |
1665 // Set the following user policies: | 1684 // Set the following user policies: |
1666 // * RestoreOnStartup = RestoreOnStartupIsURLs | 1685 // * RestoreOnStartup = RestoreOnStartupIsURLs |
1667 // * RestoreOnStartupURLs = [ "files/title1.html" ] | 1686 // * RestoreOnStartupURLs = [ "/title1.html" ] |
1668 policy_map_.Set( | 1687 policy_map_.Set( |
1669 policy::key::kRestoreOnStartup, | 1688 policy::key::kRestoreOnStartup, |
1670 policy::POLICY_LEVEL_MANDATORY, | 1689 policy::POLICY_LEVEL_MANDATORY, |
1671 policy::POLICY_SCOPE_USER, | 1690 policy::POLICY_SCOPE_USER, |
1672 policy::POLICY_SOURCE_CLOUD, | 1691 policy::POLICY_SOURCE_CLOUD, |
1673 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs), | 1692 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs), |
1674 NULL); | 1693 NULL); |
1675 base::ListValue startup_urls; | 1694 base::ListValue startup_urls; |
1676 startup_urls.Append( | 1695 startup_urls.Append(new base::StringValue( |
1677 new base::StringValue(test_server()->GetURL("files/title1.html").spec())); | 1696 embedded_test_server()->GetURL("/title1.html").spec())); |
1678 policy_map_.Set(policy::key::kRestoreOnStartupURLs, | 1697 policy_map_.Set(policy::key::kRestoreOnStartupURLs, |
1679 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, | 1698 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
1680 policy::POLICY_SOURCE_CLOUD, startup_urls.DeepCopy(), | 1699 policy::POLICY_SOURCE_CLOUD, startup_urls.DeepCopy(), |
1681 nullptr); | 1700 nullptr); |
1682 provider_.UpdateChromePolicy(policy_map_); | 1701 provider_.UpdateChromePolicy(policy_map_); |
1683 base::RunLoop().RunUntilIdle(); | 1702 base::RunLoop().RunUntilIdle(); |
1684 | 1703 |
1685 // Do a process-startup browser launch. | 1704 // Do a process-startup browser launch. |
1686 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 1705 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
1687 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1706 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
(...skipping 11 matching lines...) Expand all Loading... | |
1699 ASSERT_EQ(1, tab_strip->count()); | 1718 ASSERT_EQ(1, tab_strip->count()); |
1700 EXPECT_EQ("title1.html", | 1719 EXPECT_EQ("title1.html", |
1701 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1720 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
1702 } | 1721 } |
1703 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1722 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
1704 | 1723 |
1705 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1724 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
1706 // defined(ENABLE_CONFIGURATION_POLICY) | 1725 // defined(ENABLE_CONFIGURATION_POLICY) |
1707 | 1726 |
1708 #endif // !defined(OS_CHROMEOS) | 1727 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |