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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_browsertest.cc

Issue 292713003: Session restore shouldn't care about profile home pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // StartupBrowserCreatorImpl::AddStartupURLs()). 423 // StartupBrowserCreatorImpl::AddStartupURLs()).
423 // Fails on official builds. See http://crbug.com/313856 424 // Fails on official builds. See http://crbug.com/313856
424 #if defined(GOOGLE_CHROME_BUILD) 425 #if defined(GOOGLE_CHROME_BUILD)
425 #define MAYBE_AddCustomFirstRunTab DISABLED_AddCustomFirstRunTab 426 #define MAYBE_AddCustomFirstRunTab DISABLED_AddCustomFirstRunTab
426 #else 427 #else
427 #define MAYBE_AddCustomFirstRunTab AddCustomFirstRunTab 428 #define MAYBE_AddCustomFirstRunTab AddCustomFirstRunTab
428 #endif 429 #endif
429 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddCustomFirstRunTab) { 430 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, MAYBE_AddCustomFirstRunTab) {
430 StartupBrowserCreator browser_creator; 431 StartupBrowserCreator browser_creator;
431 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 432 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
432 browser_creator.AddFirstRunTab(GURL("http://new_tab_page")); 433 browser_creator.AddFirstRunTab(GURL(chrome::kChromeUINewTabURL));
433 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html")); 434 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title2.html"));
434 browser_creator.AddFirstRunTab(GURL("http://welcome_page")); 435 browser_creator.AddFirstRunTab(internals::GetWelcomePageURL());
435 436
436 // Do a simple non-process-startup browser launch. 437 // Do a simple non-process-startup browser launch.
437 CommandLine dummy(CommandLine::NO_PROGRAM); 438 CommandLine dummy(CommandLine::NO_PROGRAM);
438 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 439 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
439 chrome::startup::IS_FIRST_RUN); 440 chrome::startup::IS_FIRST_RUN);
440 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 441 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
441 browser()->host_desktop_type())); 442 browser()->host_desktop_type()));
442 443
443 // This should have created a new browser window. 444 // This should have created a new browser window.
444 Browser* new_browser = FindOneOtherBrowser(browser()); 445 Browser* new_browser = FindOneOtherBrowser(browser());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 543 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
543 } 544 }
544 } 545 }
545 546
546 // The welcome page should still be shown if there are more than 2 first run 547 // The welcome page should still be shown if there are more than 2 first run
547 // tabs, but the welcome page was explcitly added to the first run tabs. 548 // tabs, but the welcome page was explcitly added to the first run tabs.
548 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 549 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
549 SyncPromoWithFirstRunTabsIncludingWelcomePage) { 550 SyncPromoWithFirstRunTabsIncludingWelcomePage) {
550 StartupBrowserCreator browser_creator; 551 StartupBrowserCreator browser_creator;
551 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 552 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
552 browser_creator.AddFirstRunTab(GURL("http://welcome_page")); 553 browser_creator.AddFirstRunTab(internals::GetWelcomePageURL());
553 554
554 // Do a simple non-process-startup browser launch. 555 // Do a simple non-process-startup browser launch.
555 CommandLine dummy(CommandLine::NO_PROGRAM); 556 CommandLine dummy(CommandLine::NO_PROGRAM);
556 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 557 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
557 chrome::startup::IS_FIRST_RUN); 558 chrome::startup::IS_FIRST_RUN);
558 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 559 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
559 browser()->host_desktop_type())); 560 browser()->host_desktop_type()));
560 561
561 // This should have created a new browser window. 562 // This should have created a new browser window.
562 Browser* new_browser = FindOneOtherBrowser(browser()); 563 Browser* new_browser = FindOneOtherBrowser(browser());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 EXPECT_TRUE(profile1->restored_last_session()); 753 EXPECT_TRUE(profile1->restored_last_session());
734 EXPECT_TRUE(profile2->restored_last_session()); 754 EXPECT_TRUE(profile2->restored_last_session());
735 755
736 Browser* new_browser = NULL; 756 Browser* new_browser = NULL;
737 ASSERT_EQ(1u, chrome::GetBrowserCount(profile1, 757 ASSERT_EQ(1u, chrome::GetBrowserCount(profile1,
738 browser()->host_desktop_type())); 758 browser()->host_desktop_type()));
739 new_browser = FindOneOtherBrowserForProfile(profile1, NULL); 759 new_browser = FindOneOtherBrowserForProfile(profile1, NULL);
740 ASSERT_TRUE(new_browser); 760 ASSERT_TRUE(new_browser);
741 TabStripModel* tab_strip = new_browser->tab_strip_model(); 761 TabStripModel* tab_strip = new_browser->tab_strip_model();
742 ASSERT_EQ(1, tab_strip->count()); 762 ASSERT_EQ(1, tab_strip->count());
743 EXPECT_EQ(GURL(content::kAboutBlankURL), 763 EXPECT_EQ("/files/empty.html",
744 tab_strip->GetWebContentsAt(0)->GetURL()); 764 tab_strip->GetWebContentsAt(0)->GetURL().path());
745 765
746 ASSERT_EQ(1u, chrome::GetBrowserCount(profile2, 766 ASSERT_EQ(1u, chrome::GetBrowserCount(profile2,
747 browser()->host_desktop_type())); 767 browser()->host_desktop_type()));
748 new_browser = FindOneOtherBrowserForProfile(profile2, NULL); 768 new_browser = FindOneOtherBrowserForProfile(profile2, NULL);
749 ASSERT_TRUE(new_browser); 769 ASSERT_TRUE(new_browser);
750 tab_strip = new_browser->tab_strip_model(); 770 tab_strip = new_browser->tab_strip_model();
751 ASSERT_EQ(1, tab_strip->count()); 771 ASSERT_EQ(1, tab_strip->count());
752 EXPECT_EQ(GURL(content::kAboutBlankURL), 772 EXPECT_EQ("/files/form.html",
753 tab_strip->GetWebContentsAt(0)->GetURL()); 773 tab_strip->GetWebContentsAt(0)->GetURL().path());
754 } 774 }
755 775
756 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 776 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
757 ProfilesWithoutPagesNotLaunched) { 777 ProfilesWithoutPagesNotLaunched) {
758 #if defined(OS_WIN) && defined(USE_ASH) 778 #if defined(OS_WIN) && defined(USE_ASH)
759 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 779 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
760 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 780 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
761 return; 781 return;
762 #endif 782 #endif
763 783
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 815
796 std::vector<GURL> urls; 816 std::vector<GURL> urls;
797 urls.push_back(ui_test_utils::GetTestUrl( 817 urls.push_back(ui_test_utils::GetTestUrl(
798 base::FilePath(base::FilePath::kCurrentDirectory), 818 base::FilePath(base::FilePath::kCurrentDirectory),
799 base::FilePath(FILE_PATH_LITERAL("title1.html")))); 819 base::FilePath(FILE_PATH_LITERAL("title1.html"))));
800 820
801 SessionStartupPref pref_urls(SessionStartupPref::URLS); 821 SessionStartupPref pref_urls(SessionStartupPref::URLS);
802 pref_urls.urls = urls; 822 pref_urls.urls = urls;
803 SessionStartupPref::SetStartupPref(profile_urls, pref_urls); 823 SessionStartupPref::SetStartupPref(profile_urls, pref_urls);
804 824
805 // Close the browser. 825 // Open a page with profile_last.
826 Browser* browser_last = new Browser(
827 Browser::CreateParams(Browser::TYPE_TABBED, profile_last,
828 browser()->host_desktop_type()));
829 chrome::NewTab(browser_last);
830 ui_test_utils::NavigateToURL(browser_last,
831 test_server()->GetURL("files/empty.html"));
832 browser_last->window()->Close();
833
834 // Close the main browser.
806 chrome::HostDesktopType original_desktop_type = 835 chrome::HostDesktopType original_desktop_type =
807 browser()->host_desktop_type(); 836 browser()->host_desktop_type();
808 browser()->window()->Close(); 837 browser()->window()->Close();
809 838
810 // Do a simple non-process-startup browser launch. 839 // Do a simple non-process-startup browser launch.
811 CommandLine dummy(CommandLine::NO_PROGRAM); 840 CommandLine dummy(CommandLine::NO_PROGRAM);
812 841
813 int return_code; 842 int return_code;
814 StartupBrowserCreator browser_creator; 843 StartupBrowserCreator browser_creator;
815 std::vector<Profile*> last_opened_profiles; 844 std::vector<Profile*> last_opened_profiles;
(...skipping 29 matching lines...) Expand all
845 tab_strip = new_browser->tab_strip_model(); 874 tab_strip = new_browser->tab_strip_model();
846 ASSERT_EQ(1, tab_strip->count()); 875 ASSERT_EQ(1, tab_strip->count());
847 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); 876 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL());
848 877
849 // profile_last opened the last open pages. 878 // profile_last opened the last open pages.
850 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, original_desktop_type)); 879 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, original_desktop_type));
851 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); 880 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
852 ASSERT_TRUE(new_browser); 881 ASSERT_TRUE(new_browser);
853 tab_strip = new_browser->tab_strip_model(); 882 tab_strip = new_browser->tab_strip_model();
854 ASSERT_EQ(1, tab_strip->count()); 883 ASSERT_EQ(1, tab_strip->count());
855 EXPECT_EQ(GURL(content::kAboutBlankURL), 884 EXPECT_EQ("/files/empty.html",
856 tab_strip->GetWebContentsAt(0)->GetURL()); 885 tab_strip->GetWebContentsAt(0)->GetURL().path());
857 886
858 // profile_home2 was not launched since it would've only opened the home page. 887 // 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)); 888 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type));
860 } 889 }
861 890
862 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { 891 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
863 #if defined(OS_WIN) && defined(USE_ASH) 892 #if defined(OS_WIN) && defined(USE_ASH)
864 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 893 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
865 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 894 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
866 return; 895 return;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 // Simulate the following master_preferences: 1206 // Simulate the following master_preferences:
1178 // { 1207 // {
1179 // "first_run_tabs" : [ 1208 // "first_run_tabs" : [
1180 // "files/title1.html", 1209 // "files/title1.html",
1181 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F" 1210 // "chrome://signin/?source=0&next_page=chrome%3A%2F%2Fnewtab%2F"
1182 // ], 1211 // ],
1183 // "sync_promo": { 1212 // "sync_promo": {
1184 // "show_on_first_run_allowed": true 1213 // "show_on_first_run_allowed": true
1185 // } 1214 // }
1186 // } 1215 // }
1216 ASSERT_TRUE(test_server()->Start());
1187 StartupBrowserCreator browser_creator; 1217 StartupBrowserCreator browser_creator;
1188 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 1218 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
1189 browser_creator.AddFirstRunTab(signin::GetPromoURL(signin::SOURCE_START_PAGE, 1219 browser_creator.AddFirstRunTab(signin::GetPromoURL(signin::SOURCE_START_PAGE,
1190 false)); 1220 false));
1191 browser()->profile()->GetPrefs()->SetBoolean( 1221 browser()->profile()->GetPrefs()->SetBoolean(
1192 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1222 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1193 1223
1194 // Do a process-startup browser launch. 1224 // Do a process-startup browser launch.
1195 CommandLine dummy(CommandLine::NO_PROGRAM); 1225 CommandLine dummy(CommandLine::NO_PROGRAM);
1196 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1226 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
(...skipping 29 matching lines...) Expand all
1226 // { 1256 // {
1227 // "first_run_tabs" : [ 1257 // "first_run_tabs" : [
1228 // "new_tab_page", 1258 // "new_tab_page",
1229 // "files/title1.html" 1259 // "files/title1.html"
1230 // ], 1260 // ],
1231 // "sync_promo": { 1261 // "sync_promo": {
1232 // "show_on_first_run_allowed": true 1262 // "show_on_first_run_allowed": true
1233 // } 1263 // }
1234 // } 1264 // }
1235 StartupBrowserCreator browser_creator; 1265 StartupBrowserCreator browser_creator;
1236 browser_creator.AddFirstRunTab(GURL("new_tab_page")); 1266 browser_creator.AddFirstRunTab(GURL(chrome::kChromeUINewTabURL));
1237 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 1267 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
1238 browser()->profile()->GetPrefs()->SetBoolean( 1268 browser()->profile()->GetPrefs()->SetBoolean(
1239 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1269 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1240 1270
1241 // Do a process-startup browser launch. 1271 // Do a process-startup browser launch.
1242 CommandLine dummy(CommandLine::NO_PROGRAM); 1272 CommandLine dummy(CommandLine::NO_PROGRAM);
1243 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1273 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1244 chrome::startup::IS_FIRST_RUN); 1274 chrome::startup::IS_FIRST_RUN);
1245 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1275 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1246 browser()->host_desktop_type())); 1276 browser()->host_desktop_type()));
(...skipping 26 matching lines...) Expand all
1273 // { 1303 // {
1274 // "first_run_tabs" : [ 1304 // "first_run_tabs" : [
1275 // "new_tab_page", 1305 // "new_tab_page",
1276 // "files/title1.html" 1306 // "files/title1.html"
1277 // ], 1307 // ],
1278 // "sync_promo": { 1308 // "sync_promo": {
1279 // "show_on_first_run_allowed": false 1309 // "show_on_first_run_allowed": false
1280 // } 1310 // }
1281 // } 1311 // }
1282 StartupBrowserCreator browser_creator; 1312 StartupBrowserCreator browser_creator;
1283 browser_creator.AddFirstRunTab(GURL("new_tab_page")); 1313 browser_creator.AddFirstRunTab(GURL(chrome::kChromeUINewTabURL));
1284 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html")); 1314 browser_creator.AddFirstRunTab(test_server()->GetURL("files/title1.html"));
1285 browser()->profile()->GetPrefs()->SetBoolean( 1315 browser()->profile()->GetPrefs()->SetBoolean(
1286 prefs::kSignInPromoShowOnFirstRunAllowed, false); 1316 prefs::kSignInPromoShowOnFirstRunAllowed, false);
1287 1317
1288 // Do a process-startup browser launch. 1318 // Do a process-startup browser launch.
1289 CommandLine dummy(CommandLine::NO_PROGRAM); 1319 CommandLine dummy(CommandLine::NO_PROGRAM);
1290 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1320 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1291 chrome::startup::IS_FIRST_RUN); 1321 chrome::startup::IS_FIRST_RUN);
1292 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1322 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1293 browser()->host_desktop_type())); 1323 browser()->host_desktop_type()));
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 ASSERT_EQ(1, tab_strip->count()); 1432 ASSERT_EQ(1, tab_strip->count());
1403 EXPECT_EQ("title1.html", 1433 EXPECT_EQ("title1.html",
1404 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1434 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1405 } 1435 }
1406 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1436 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1407 1437
1408 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1438 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1409 // defined(ENABLE_CONFIGURATION_POLICY) 1439 // defined(ENABLE_CONFIGURATION_POLICY)
1410 1440
1411 #endif // !defined(OS_CHROMEOS) 1441 #endif // !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698