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" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/extensions/extension_browsertest.h" | 13 #include "chrome/browser/extensions/extension_browsertest.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/launch_util.h" | 15 #include "chrome/browser/extensions/launch_util.h" |
16 #include "chrome/browser/first_run/first_run.h" | 16 #include "chrome/browser/first_run/first_run.h" |
17 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
18 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" | 18 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" |
19 #include "chrome/browser/managed_mode/managed_user_service.h" | 19 #include "chrome/browser/managed_mode/managed_user_service.h" |
20 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 20 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
21 #include "chrome/browser/prefs/session_startup_pref.h" | 21 #include "chrome/browser/prefs/session_startup_pref.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_impl.h" | 23 #include "chrome/browser/profiles/profile_impl.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/sessions/session_restore.h" | 25 #include "chrome/browser/sessions/session_restore.h" |
26 #include "chrome/browser/signin/signin_promo.h" | 26 #include "chrome/browser/signin/signin_promo.h" |
27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_commands.h" |
28 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
29 #include "chrome/browser/ui/browser_iterator.h" | 30 #include "chrome/browser/ui/browser_iterator.h" |
30 #include "chrome/browser/ui/browser_list.h" | 31 #include "chrome/browser/ui/browser_list.h" |
31 #include "chrome/browser/ui/browser_list_observer.h" | 32 #include "chrome/browser/ui/browser_list_observer.h" |
32 #include "chrome/browser/ui/browser_window.h" | 33 #include "chrome/browser/ui/browser_window.h" |
33 #include "chrome/browser/ui/host_desktop.h" | 34 #include "chrome/browser/ui/host_desktop.h" |
34 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 35 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
35 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 36 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
36 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 37 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
37 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 ASSERT_TRUE(new_browser); | 650 ASSERT_TRUE(new_browser); |
650 tab_strip = new_browser->tab_strip_model(); | 651 tab_strip = new_browser->tab_strip_model(); |
651 ASSERT_EQ(1, tab_strip->count()); | 652 ASSERT_EQ(1, tab_strip->count()); |
652 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); | 653 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); |
653 } | 654 } |
654 | 655 |
655 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, PRE_UpdateWithTwoProfiles) { | 656 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, PRE_UpdateWithTwoProfiles) { |
656 // Simulate a browser restart by creating the profiles in the PRE_ part. | 657 // Simulate a browser restart by creating the profiles in the PRE_ part. |
657 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 658 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
658 | 659 |
| 660 ASSERT_TRUE(test_server()->Start()); |
| 661 |
659 // Create two profiles. | 662 // Create two profiles. |
660 base::FilePath dest_path = profile_manager->user_data_dir(); | 663 base::FilePath dest_path = profile_manager->user_data_dir(); |
661 | 664 |
662 Profile* profile1 = profile_manager->GetProfile( | 665 Profile* profile1 = profile_manager->GetProfile( |
663 dest_path.Append(FILE_PATH_LITERAL("New Profile 1"))); | 666 dest_path.Append(FILE_PATH_LITERAL("New Profile 1"))); |
664 ASSERT_TRUE(profile1); | 667 ASSERT_TRUE(profile1); |
665 | 668 |
666 Profile* profile2 = profile_manager->GetProfile( | 669 Profile* profile2 = profile_manager->GetProfile( |
667 dest_path.Append(FILE_PATH_LITERAL("New Profile 2"))); | 670 dest_path.Append(FILE_PATH_LITERAL("New Profile 2"))); |
668 ASSERT_TRUE(profile2); | 671 ASSERT_TRUE(profile2); |
669 | 672 |
670 // Use a couple arbitrary URLs. | 673 // Open some urls with the browsers, and close them. |
| 674 Browser* browser1 = new Browser( |
| 675 Browser::CreateParams(Browser::TYPE_TABBED, profile1, |
| 676 browser()->host_desktop_type())); |
| 677 chrome::NewTab(browser1); |
| 678 ui_test_utils::NavigateToURL(browser1, |
| 679 test_server()->GetURL("files/empty.html")); |
| 680 browser1->window()->Close(); |
| 681 |
| 682 Browser* browser2 = new Browser( |
| 683 Browser::CreateParams(Browser::TYPE_TABBED, profile2, |
| 684 browser()->host_desktop_type())); |
| 685 chrome::NewTab(browser2); |
| 686 ui_test_utils::NavigateToURL(browser2, |
| 687 test_server()->GetURL("files/form.html")); |
| 688 browser2->window()->Close(); |
| 689 |
| 690 // Set different startup preferences for the 2 profiles. |
671 std::vector<GURL> urls1; | 691 std::vector<GURL> urls1; |
672 urls1.push_back(ui_test_utils::GetTestUrl( | 692 urls1.push_back(ui_test_utils::GetTestUrl( |
673 base::FilePath(base::FilePath::kCurrentDirectory), | 693 base::FilePath(base::FilePath::kCurrentDirectory), |
674 base::FilePath(FILE_PATH_LITERAL("title1.html")))); | 694 base::FilePath(FILE_PATH_LITERAL("title1.html")))); |
675 std::vector<GURL> urls2; | 695 std::vector<GURL> urls2; |
676 urls2.push_back(ui_test_utils::GetTestUrl( | 696 urls2.push_back(ui_test_utils::GetTestUrl( |
677 base::FilePath(base::FilePath::kCurrentDirectory), | 697 base::FilePath(base::FilePath::kCurrentDirectory), |
678 base::FilePath(FILE_PATH_LITERAL("title2.html")))); | 698 base::FilePath(FILE_PATH_LITERAL("title2.html")))); |
679 | 699 |
680 // Set different startup preferences for the 2 profiles. | 700 // Set different startup preferences for the 2 profiles. |
681 SessionStartupPref pref1(SessionStartupPref::URLS); | 701 SessionStartupPref pref1(SessionStartupPref::URLS); |
682 pref1.urls = urls1; | 702 pref1.urls = urls1; |
683 SessionStartupPref::SetStartupPref(profile1, pref1); | 703 SessionStartupPref::SetStartupPref(profile1, pref1); |
684 SessionStartupPref pref2(SessionStartupPref::URLS); | 704 SessionStartupPref pref2(SessionStartupPref::URLS); |
685 pref2.urls = urls2; | 705 pref2.urls = urls2; |
686 SessionStartupPref::SetStartupPref(profile2, pref2); | 706 SessionStartupPref::SetStartupPref(profile2, pref2); |
687 | 707 |
688 profile1->GetPrefs()->CommitPendingWrite(); | 708 profile1->GetPrefs()->CommitPendingWrite(); |
689 profile2->GetPrefs()->CommitPendingWrite(); | 709 profile2->GetPrefs()->CommitPendingWrite(); |
690 } | 710 } |
691 | 711 |
692 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) { | 712 #if defined (OS_MACOSX) |
| 713 // crbug.com/376184 |
| 714 #define MAYBE_UpdateWithTwoProfiles DISABLED_UpdateWithTwoProfiles |
| 715 #else |
| 716 #define MAYBE_UpdateWithTwoProfiles UpdateWithTwoProfiles |
| 717 #endif |
| 718 |
| 719 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_UpdateWithTwoProfiles) { |
693 #if defined(OS_WIN) && defined(USE_ASH) | 720 #if defined(OS_WIN) && defined(USE_ASH) |
694 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 721 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
695 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 722 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
696 return; | 723 return; |
697 #endif | 724 #endif |
698 | 725 |
699 // Make StartupBrowserCreator::WasRestarted() return true. | 726 // Make StartupBrowserCreator::WasRestarted() return true. |
700 StartupBrowserCreator::was_restarted_read_ = false; | 727 StartupBrowserCreator::was_restarted_read_ = false; |
701 PrefService* pref_service = g_browser_process->local_state(); | 728 PrefService* pref_service = g_browser_process->local_state(); |
702 pref_service->SetBoolean(prefs::kWasRestarted, true); | 729 pref_service->SetBoolean(prefs::kWasRestarted, true); |
(...skipping 30 matching lines...) Expand all Loading... |
733 EXPECT_TRUE(profile1->restored_last_session()); | 760 EXPECT_TRUE(profile1->restored_last_session()); |
734 EXPECT_TRUE(profile2->restored_last_session()); | 761 EXPECT_TRUE(profile2->restored_last_session()); |
735 | 762 |
736 Browser* new_browser = NULL; | 763 Browser* new_browser = NULL; |
737 ASSERT_EQ(1u, chrome::GetBrowserCount(profile1, | 764 ASSERT_EQ(1u, chrome::GetBrowserCount(profile1, |
738 browser()->host_desktop_type())); | 765 browser()->host_desktop_type())); |
739 new_browser = FindOneOtherBrowserForProfile(profile1, NULL); | 766 new_browser = FindOneOtherBrowserForProfile(profile1, NULL); |
740 ASSERT_TRUE(new_browser); | 767 ASSERT_TRUE(new_browser); |
741 TabStripModel* tab_strip = new_browser->tab_strip_model(); | 768 TabStripModel* tab_strip = new_browser->tab_strip_model(); |
742 ASSERT_EQ(1, tab_strip->count()); | 769 ASSERT_EQ(1, tab_strip->count()); |
743 EXPECT_EQ(GURL(content::kAboutBlankURL), | 770 EXPECT_EQ("/files/empty.html", |
744 tab_strip->GetWebContentsAt(0)->GetURL()); | 771 tab_strip->GetWebContentsAt(0)->GetURL().path()); |
745 | 772 |
746 ASSERT_EQ(1u, chrome::GetBrowserCount(profile2, | 773 ASSERT_EQ(1u, chrome::GetBrowserCount(profile2, |
747 browser()->host_desktop_type())); | 774 browser()->host_desktop_type())); |
748 new_browser = FindOneOtherBrowserForProfile(profile2, NULL); | 775 new_browser = FindOneOtherBrowserForProfile(profile2, NULL); |
749 ASSERT_TRUE(new_browser); | 776 ASSERT_TRUE(new_browser); |
750 tab_strip = new_browser->tab_strip_model(); | 777 tab_strip = new_browser->tab_strip_model(); |
751 ASSERT_EQ(1, tab_strip->count()); | 778 ASSERT_EQ(1, tab_strip->count()); |
752 EXPECT_EQ(GURL(content::kAboutBlankURL), | 779 EXPECT_EQ("/files/form.html", |
753 tab_strip->GetWebContentsAt(0)->GetURL()); | 780 tab_strip->GetWebContentsAt(0)->GetURL().path()); |
754 } | 781 } |
755 | 782 |
756 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, | 783 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, |
757 ProfilesWithoutPagesNotLaunched) { | 784 ProfilesWithoutPagesNotLaunched) { |
758 #if defined(OS_WIN) && defined(USE_ASH) | 785 #if defined(OS_WIN) && defined(USE_ASH) |
759 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 786 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
760 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 787 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
761 return; | 788 return; |
762 #endif | 789 #endif |
763 | 790 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 822 |
796 std::vector<GURL> urls; | 823 std::vector<GURL> urls; |
797 urls.push_back(ui_test_utils::GetTestUrl( | 824 urls.push_back(ui_test_utils::GetTestUrl( |
798 base::FilePath(base::FilePath::kCurrentDirectory), | 825 base::FilePath(base::FilePath::kCurrentDirectory), |
799 base::FilePath(FILE_PATH_LITERAL("title1.html")))); | 826 base::FilePath(FILE_PATH_LITERAL("title1.html")))); |
800 | 827 |
801 SessionStartupPref pref_urls(SessionStartupPref::URLS); | 828 SessionStartupPref pref_urls(SessionStartupPref::URLS); |
802 pref_urls.urls = urls; | 829 pref_urls.urls = urls; |
803 SessionStartupPref::SetStartupPref(profile_urls, pref_urls); | 830 SessionStartupPref::SetStartupPref(profile_urls, pref_urls); |
804 | 831 |
805 // Close the browser. | 832 // Open a page with profile_last. |
| 833 Browser* browser_last = new Browser( |
| 834 Browser::CreateParams(Browser::TYPE_TABBED, profile_last, |
| 835 browser()->host_desktop_type())); |
| 836 chrome::NewTab(browser_last); |
| 837 ui_test_utils::NavigateToURL(browser_last, |
| 838 test_server()->GetURL("files/empty.html")); |
| 839 browser_last->window()->Close(); |
| 840 |
| 841 // Close the main browser. |
806 chrome::HostDesktopType original_desktop_type = | 842 chrome::HostDesktopType original_desktop_type = |
807 browser()->host_desktop_type(); | 843 browser()->host_desktop_type(); |
808 browser()->window()->Close(); | 844 browser()->window()->Close(); |
809 | 845 |
810 // Do a simple non-process-startup browser launch. | 846 // Do a simple non-process-startup browser launch. |
811 CommandLine dummy(CommandLine::NO_PROGRAM); | 847 CommandLine dummy(CommandLine::NO_PROGRAM); |
812 | 848 |
813 int return_code; | 849 int return_code; |
814 StartupBrowserCreator browser_creator; | 850 StartupBrowserCreator browser_creator; |
815 std::vector<Profile*> last_opened_profiles; | 851 std::vector<Profile*> last_opened_profiles; |
(...skipping 29 matching lines...) Expand all Loading... |
845 tab_strip = new_browser->tab_strip_model(); | 881 tab_strip = new_browser->tab_strip_model(); |
846 ASSERT_EQ(1, tab_strip->count()); | 882 ASSERT_EQ(1, tab_strip->count()); |
847 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); | 883 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); |
848 | 884 |
849 // profile_last opened the last open pages. | 885 // profile_last opened the last open pages. |
850 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, original_desktop_type)); | 886 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, original_desktop_type)); |
851 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); | 887 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); |
852 ASSERT_TRUE(new_browser); | 888 ASSERT_TRUE(new_browser); |
853 tab_strip = new_browser->tab_strip_model(); | 889 tab_strip = new_browser->tab_strip_model(); |
854 ASSERT_EQ(1, tab_strip->count()); | 890 ASSERT_EQ(1, tab_strip->count()); |
855 EXPECT_EQ(GURL(content::kAboutBlankURL), | 891 EXPECT_EQ("/files/empty.html", |
856 tab_strip->GetWebContentsAt(0)->GetURL()); | 892 tab_strip->GetWebContentsAt(0)->GetURL().path()); |
857 | 893 |
858 // profile_home2 was not launched since it would've only opened the home page. | 894 // profile_home2 was not launched since it would've only opened the home page. |
859 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type)); | 895 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type)); |
860 } | 896 } |
861 | 897 |
862 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { | 898 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { |
863 #if defined(OS_WIN) && defined(USE_ASH) | 899 #if defined(OS_WIN) && defined(USE_ASH) |
864 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 900 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
865 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 901 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
866 return; | 902 return; |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 // Simulate the following master_preferences: | 1213 // Simulate the following master_preferences: |
1178 // { | 1214 // { |
1179 // "first_run_tabs" : [ | 1215 // "first_run_tabs" : [ |
1180 // "files/title1.html", | 1216 // "files/title1.html", |
1181 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" | 1217 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" |
1182 // ], | 1218 // ], |
1183 // "sync_promo": { | 1219 // "sync_promo": { |
1184 // "show_on_first_run_allowed": true | 1220 // "show_on_first_run_allowed": true |
1185 // } | 1221 // } |
1186 // } | 1222 // } |
| 1223 ASSERT_TRUE(test_server()->Start()); |
1187 StartupBrowserCreator browser_creator; | 1224 StartupBrowserCreator browser_creator; |
1188 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 1225 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); |
1189 browser_creator.AddFirstRunTab(signin::GetPromoURL(signin::SOURCE_START_PAGE, | 1226 browser_creator.AddFirstRunTab(signin::GetPromoURL(signin::SOURCE_START_PAGE, |
1190 false)); | 1227 false)); |
1191 browser()->profile()->GetPrefs()->SetBoolean( | 1228 browser()->profile()->GetPrefs()->SetBoolean( |
1192 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1229 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
1193 | 1230 |
1194 // Do a process-startup browser launch. | 1231 // Do a process-startup browser launch. |
1195 CommandLine dummy(CommandLine::NO_PROGRAM); | 1232 CommandLine dummy(CommandLine::NO_PROGRAM); |
1196 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1233 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
(...skipping 29 matching lines...) Expand all Loading... |
1226 // { | 1263 // { |
1227 // "first_run_tabs" : [ | 1264 // "first_run_tabs" : [ |
1228 // "new_tab_page", | 1265 // "new_tab_page", |
1229 // "files/title1.html" | 1266 // "files/title1.html" |
1230 // ], | 1267 // ], |
1231 // "sync_promo": { | 1268 // "sync_promo": { |
1232 // "show_on_first_run_allowed": true | 1269 // "show_on_first_run_allowed": true |
1233 // } | 1270 // } |
1234 // } | 1271 // } |
1235 StartupBrowserCreator browser_creator; | 1272 StartupBrowserCreator browser_creator; |
1236 browser_creator.AddFirstRunTab(GURL("new_tab_page")); | 1273 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); |
1237 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 1274 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); |
1238 browser()->profile()->GetPrefs()->SetBoolean( | 1275 browser()->profile()->GetPrefs()->SetBoolean( |
1239 prefs::kSignInPromoShowOnFirstRunAllowed, true); | 1276 prefs::kSignInPromoShowOnFirstRunAllowed, true); |
1240 | 1277 |
1241 // Do a process-startup browser launch. | 1278 // Do a process-startup browser launch. |
1242 CommandLine dummy(CommandLine::NO_PROGRAM); | 1279 CommandLine dummy(CommandLine::NO_PROGRAM); |
1243 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1280 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
1244 chrome::startup::IS_FIRST_RUN); | 1281 chrome::startup::IS_FIRST_RUN); |
1245 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, | 1282 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, |
1246 browser()->host_desktop_type())); | 1283 browser()->host_desktop_type())); |
(...skipping 26 matching lines...) Expand all Loading... |
1273 // { | 1310 // { |
1274 // "first_run_tabs" : [ | 1311 // "first_run_tabs" : [ |
1275 // "new_tab_page", | 1312 // "new_tab_page", |
1276 // "files/title1.html" | 1313 // "files/title1.html" |
1277 // ], | 1314 // ], |
1278 // "sync_promo": { | 1315 // "sync_promo": { |
1279 // "show_on_first_run_allowed": false | 1316 // "show_on_first_run_allowed": false |
1280 // } | 1317 // } |
1281 // } | 1318 // } |
1282 StartupBrowserCreator browser_creator; | 1319 StartupBrowserCreator browser_creator; |
1283 browser_creator.AddFirstRunTab(GURL("new_tab_page")); | 1320 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); |
1284 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); | 1321 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); |
1285 browser()->profile()->GetPrefs()->SetBoolean( | 1322 browser()->profile()->GetPrefs()->SetBoolean( |
1286 prefs::kSignInPromoShowOnFirstRunAllowed, false); | 1323 prefs::kSignInPromoShowOnFirstRunAllowed, false); |
1287 | 1324 |
1288 // Do a process-startup browser launch. | 1325 // Do a process-startup browser launch. |
1289 CommandLine dummy(CommandLine::NO_PROGRAM); | 1326 CommandLine dummy(CommandLine::NO_PROGRAM); |
1290 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, | 1327 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, |
1291 chrome::startup::IS_FIRST_RUN); | 1328 chrome::startup::IS_FIRST_RUN); |
1292 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, | 1329 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, |
1293 browser()->host_desktop_type())); | 1330 browser()->host_desktop_type())); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 ASSERT_EQ(1, tab_strip->count()); | 1439 ASSERT_EQ(1, tab_strip->count()); |
1403 EXPECT_EQ("title1.html", | 1440 EXPECT_EQ("title1.html", |
1404 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1441 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
1405 } | 1442 } |
1406 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1443 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
1407 | 1444 |
1408 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1445 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
1409 // defined(ENABLE_CONFIGURATION_POLICY) | 1446 // defined(ENABLE_CONFIGURATION_POLICY) |
1410 | 1447 |
1411 #endif // !defined(OS_CHROMEOS) | 1448 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |