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

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

Issue 1661713002: Remove the rest of HostDesktopType from c/b/ui/browser_finder.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-11
Patch Set: linux adl Created 4 years, 10 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 #include "base/win/windows_version.h" 79 #include "base/win/windows_version.h"
80 #endif 80 #endif
81 81
82 using extensions::Extension; 82 using extensions::Extension;
83 83
84 namespace { 84 namespace {
85 85
86 // Check that there are two browsers. Find the one that is not |browser|. 86 // Check that there are two browsers. Find the one that is not |browser|.
87 Browser* FindOneOtherBrowser(Browser* browser) { 87 Browser* FindOneOtherBrowser(Browser* browser) {
88 // There should only be one other browser. 88 // There should only be one other browser.
89 EXPECT_EQ(2u, chrome::GetBrowserCount(browser->profile(), 89 EXPECT_EQ(2u, chrome::GetBrowserCount(browser->profile()));
90 browser->host_desktop_type()));
91 90
92 // Find the new browser. 91 // Find the new browser.
93 Browser* other_browser = NULL; 92 Browser* other_browser = NULL;
94 for (auto* b : *BrowserList::GetInstance()) { 93 for (auto* b : *BrowserList::GetInstance()) {
95 if (b != browser) 94 if (b != browser)
96 other_browser = b; 95 other_browser = b;
97 } 96 }
98 return other_browser; 97 return other_browser;
99 } 98 }
100 99
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const Extension** out_app_extension) { 168 const Extension** out_app_extension) {
170 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(app_name.c_str()))); 169 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(app_name.c_str())));
171 170
172 ExtensionService* service = extensions::ExtensionSystem::Get( 171 ExtensionService* service = extensions::ExtensionSystem::Get(
173 browser()->profile())->extension_service(); 172 browser()->profile())->extension_service();
174 *out_app_extension = service->GetExtensionById( 173 *out_app_extension = service->GetExtensionById(
175 last_loaded_extension_id(), false); 174 last_loaded_extension_id(), false);
176 ASSERT_TRUE(*out_app_extension); 175 ASSERT_TRUE(*out_app_extension);
177 176
178 // Code that opens a new browser assumes we start with exactly one. 177 // Code that opens a new browser assumes we start with exactly one.
179 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 178 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
180 browser()->host_desktop_type()));
181 } 179 }
182 180
183 void SetAppLaunchPref(const std::string& app_id, 181 void SetAppLaunchPref(const std::string& app_id,
184 extensions::LaunchType launch_type) { 182 extensions::LaunchType launch_type) {
185 extensions::SetLaunchType(browser()->profile(), app_id, launch_type); 183 extensions::SetLaunchType(browser()->profile(), app_id, launch_type);
186 } 184 }
187 185
188 Browser* FindOneOtherBrowserForProfile(Profile* profile, 186 Browser* FindOneOtherBrowserForProfile(Profile* profile,
189 Browser* not_this_browser) { 187 Browser* not_this_browser) {
190 for (auto* browser : *BrowserList::GetInstance()) { 188 for (auto* browser : *BrowserList::GetInstance()) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 { 323 {
326 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 324 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
327 ASSERT_TRUE(launch.Launch(profile, std::vector<GURL>(), false, 325 ASSERT_TRUE(launch.Launch(profile, std::vector<GURL>(), false,
328 host_desktop_type)); 326 host_desktop_type));
329 } 327 }
330 328
331 // Find the new browser and ensure that it has only the specified URLs this 329 // Find the new browser and ensure that it has only the specified URLs this
332 // time. Both the original browser created by the fixture and the one 330 // time. Both the original browser created by the fixture and the one
333 // created above have been closed, so the new browser is the only one 331 // created above have been closed, so the new browser is the only one
334 // remaining. 332 // remaining.
335 new_browser = FindTabbedBrowser(profile, true, host_desktop_type); 333 new_browser = chrome::FindTabbedBrowser(profile, true);
336 ASSERT_TRUE(new_browser); 334 ASSERT_TRUE(new_browser);
337 ASSERT_EQ(static_cast<int>(urls.size()), 335 ASSERT_EQ(static_cast<int>(urls.size()),
338 new_browser->tab_strip_model()->count()); 336 new_browser->tab_strip_model()->count());
339 } 337 }
340 338
341 g_browser_process->ReleaseModule(); 339 g_browser_process->ReleaseModule();
342 } 340 }
343 341
344 // Verify that startup URLs aren't used when the process already exists 342 // Verify that startup URLs aren't used when the process already exists
345 // and has other tabbed browser windows. This is the common case of starting a 343 // and has other tabbed browser windows. This is the common case of starting a
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); 475 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
478 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 476 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
479 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 477 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
480 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 478 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
481 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); 479 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run);
482 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, 480 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false,
483 browser()->host_desktop_type())); 481 browser()->host_desktop_type()));
484 482
485 // When an app shortcut is open and the pref indicates a tab should 483 // When an app shortcut is open and the pref indicates a tab should
486 // open, the tab is open in a new browser window. Expect a new window. 484 // open, the tab is open in a new browser window. Expect a new window.
487 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile(), 485 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile()));
488 browser()->host_desktop_type()));
489 486
490 Browser* new_browser = FindOneOtherBrowser(browser()); 487 Browser* new_browser = FindOneOtherBrowser(browser());
491 ASSERT_TRUE(new_browser); 488 ASSERT_TRUE(new_browser);
492 489
493 // The tab should be in a tabbed window. 490 // The tab should be in a tabbed window.
494 EXPECT_TRUE(new_browser->is_type_tabbed()); 491 EXPECT_TRUE(new_browser->is_type_tabbed());
495 492
496 // The browser's app_name should not include the app's ID: It is in a 493 // The browser's app_name should not include the app's ID: It is in a
497 // normal browser. 494 // normal browser.
498 EXPECT_EQ( 495 EXPECT_EQ(
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 last_opened_profiles.push_back(default_profile); 789 last_opened_profiles.push_back(default_profile);
793 last_opened_profiles.push_back(other_profile); 790 last_opened_profiles.push_back(other_profile);
794 browser_creator.Start(dummy, profile_manager->user_data_dir(), 791 browser_creator.Start(dummy, profile_manager->user_data_dir(),
795 default_profile, last_opened_profiles); 792 default_profile, last_opened_profiles);
796 793
797 // urls1 were opened in a browser for default_profile, and urls2 were opened 794 // urls1 were opened in a browser for default_profile, and urls2 were opened
798 // in a browser for other_profile. 795 // in a browser for other_profile.
799 Browser* new_browser = NULL; 796 Browser* new_browser = NULL;
800 // |browser()| is still around at this point, even though we've closed its 797 // |browser()| is still around at this point, even though we've closed its
801 // window. Thus the browser count for default_profile is 2. 798 // window. Thus the browser count for default_profile is 2.
802 ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile, 799 ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile));
803 browser()->host_desktop_type()));
804 new_browser = FindOneOtherBrowserForProfile(default_profile, browser()); 800 new_browser = FindOneOtherBrowserForProfile(default_profile, browser());
805 ASSERT_TRUE(new_browser); 801 ASSERT_TRUE(new_browser);
806 TabStripModel* tab_strip = new_browser->tab_strip_model(); 802 TabStripModel* tab_strip = new_browser->tab_strip_model();
807 if (IsWindows10OrNewer()) { 803 if (IsWindows10OrNewer()) {
808 // The new browser should have the welcome tab and the URL for the profile. 804 // The new browser should have the welcome tab and the URL for the profile.
809 ASSERT_EQ(2, tab_strip->count()); 805 ASSERT_EQ(2, tab_strip->count());
810 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), 806 EXPECT_EQ(GURL(internals::GetWelcomePageURL()),
811 tab_strip->GetWebContentsAt(0)->GetURL()); 807 tab_strip->GetWebContentsAt(0)->GetURL());
812 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(1)->GetURL()); 808 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(1)->GetURL());
813 } else { 809 } else {
814 // The new browser should have only the desired URL for the profile. 810 // The new browser should have only the desired URL for the profile.
815 ASSERT_EQ(1, tab_strip->count()); 811 ASSERT_EQ(1, tab_strip->count());
816 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(0)->GetURL()); 812 EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(0)->GetURL());
817 } 813 }
818 814
819 ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile, 815 ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile));
820 browser()->host_desktop_type()));
821 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL); 816 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL);
822 ASSERT_TRUE(new_browser); 817 ASSERT_TRUE(new_browser);
823 tab_strip = new_browser->tab_strip_model(); 818 tab_strip = new_browser->tab_strip_model();
824 ASSERT_EQ(1, tab_strip->count()); 819 ASSERT_EQ(1, tab_strip->count());
825 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL()); 820 EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL());
826 } 821 }
827 822
828 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, PRE_UpdateWithTwoProfiles) { 823 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, PRE_UpdateWithTwoProfiles) {
829 // Simulate a browser restart by creating the profiles in the PRE_ part. 824 // Simulate a browser restart by creating the profiles in the PRE_ part.
830 ProfileManager* profile_manager = g_browser_process->profile_manager(); 825 ProfileManager* profile_manager = g_browser_process->profile_manager();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 while (SessionRestore::IsRestoring(profile1) || 917 while (SessionRestore::IsRestoring(profile1) ||
923 SessionRestore::IsRestoring(profile2)) 918 SessionRestore::IsRestoring(profile2))
924 base::MessageLoop::current()->RunUntilIdle(); 919 base::MessageLoop::current()->RunUntilIdle();
925 920
926 // The startup URLs are ignored, and instead the last open sessions are 921 // The startup URLs are ignored, and instead the last open sessions are
927 // restored. 922 // restored.
928 EXPECT_TRUE(profile1->restored_last_session()); 923 EXPECT_TRUE(profile1->restored_last_session());
929 EXPECT_TRUE(profile2->restored_last_session()); 924 EXPECT_TRUE(profile2->restored_last_session());
930 925
931 Browser* new_browser = NULL; 926 Browser* new_browser = NULL;
932 ASSERT_EQ(1u, chrome::GetBrowserCount(profile1, 927 ASSERT_EQ(1u, chrome::GetBrowserCount(profile1));
933 browser()->host_desktop_type()));
934 new_browser = FindOneOtherBrowserForProfile(profile1, NULL); 928 new_browser = FindOneOtherBrowserForProfile(profile1, NULL);
935 ASSERT_TRUE(new_browser); 929 ASSERT_TRUE(new_browser);
936 TabStripModel* tab_strip = new_browser->tab_strip_model(); 930 TabStripModel* tab_strip = new_browser->tab_strip_model();
937 ASSERT_EQ(1, tab_strip->count()); 931 ASSERT_EQ(1, tab_strip->count());
938 EXPECT_EQ("/empty.html", tab_strip->GetWebContentsAt(0)->GetURL().path()); 932 EXPECT_EQ("/empty.html", tab_strip->GetWebContentsAt(0)->GetURL().path());
939 933
940 ASSERT_EQ(1u, chrome::GetBrowserCount(profile2, 934 ASSERT_EQ(1u, chrome::GetBrowserCount(profile2));
941 browser()->host_desktop_type()));
942 new_browser = FindOneOtherBrowserForProfile(profile2, NULL); 935 new_browser = FindOneOtherBrowserForProfile(profile2, NULL);
943 ASSERT_TRUE(new_browser); 936 ASSERT_TRUE(new_browser);
944 tab_strip = new_browser->tab_strip_model(); 937 tab_strip = new_browser->tab_strip_model();
945 ASSERT_EQ(1, tab_strip->count()); 938 ASSERT_EQ(1, tab_strip->count());
946 EXPECT_EQ("/form.html", tab_strip->GetWebContentsAt(0)->GetURL().path()); 939 EXPECT_EQ("/form.html", tab_strip->GetWebContentsAt(0)->GetURL().path());
947 } 940 }
948 941
949 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 942 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
950 ProfilesWithoutPagesNotLaunched) { 943 ProfilesWithoutPagesNotLaunched) {
951 #if defined(OS_WIN) && defined(USE_ASH) 944 #if defined(OS_WIN) && defined(USE_ASH)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 // Open a page with profile_last. 993 // Open a page with profile_last.
1001 Browser* browser_last = new Browser( 994 Browser* browser_last = new Browser(
1002 Browser::CreateParams(Browser::TYPE_TABBED, profile_last, 995 Browser::CreateParams(Browser::TYPE_TABBED, profile_last,
1003 browser()->host_desktop_type())); 996 browser()->host_desktop_type()));
1004 chrome::NewTab(browser_last); 997 chrome::NewTab(browser_last);
1005 ui_test_utils::NavigateToURL(browser_last, 998 ui_test_utils::NavigateToURL(browser_last,
1006 embedded_test_server()->GetURL("/empty.html")); 999 embedded_test_server()->GetURL("/empty.html"));
1007 CloseBrowserAsynchronously(browser_last); 1000 CloseBrowserAsynchronously(browser_last);
1008 1001
1009 // Close the main browser. 1002 // Close the main browser.
1010 chrome::HostDesktopType original_desktop_type =
1011 browser()->host_desktop_type();
1012 CloseBrowserAsynchronously(browser()); 1003 CloseBrowserAsynchronously(browser());
1013 1004
1014 // Do a simple non-process-startup browser launch. 1005 // Do a simple non-process-startup browser launch.
1015 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 1006 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1016 1007
1017 StartupBrowserCreator browser_creator; 1008 StartupBrowserCreator browser_creator;
1018 std::vector<Profile*> last_opened_profiles; 1009 std::vector<Profile*> last_opened_profiles;
1019 last_opened_profiles.push_back(profile_home1); 1010 last_opened_profiles.push_back(profile_home1);
1020 last_opened_profiles.push_back(profile_home2); 1011 last_opened_profiles.push_back(profile_home2);
1021 last_opened_profiles.push_back(profile_last); 1012 last_opened_profiles.push_back(profile_last);
1022 last_opened_profiles.push_back(profile_urls); 1013 last_opened_profiles.push_back(profile_urls);
1023 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home1, 1014 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home1,
1024 last_opened_profiles); 1015 last_opened_profiles);
1025 1016
1026 while (SessionRestore::IsRestoring(default_profile) || 1017 while (SessionRestore::IsRestoring(default_profile) ||
1027 SessionRestore::IsRestoring(profile_home1) || 1018 SessionRestore::IsRestoring(profile_home1) ||
1028 SessionRestore::IsRestoring(profile_home2) || 1019 SessionRestore::IsRestoring(profile_home2) ||
1029 SessionRestore::IsRestoring(profile_last) || 1020 SessionRestore::IsRestoring(profile_last) ||
1030 SessionRestore::IsRestoring(profile_urls)) 1021 SessionRestore::IsRestoring(profile_urls))
1031 base::MessageLoop::current()->RunUntilIdle(); 1022 base::MessageLoop::current()->RunUntilIdle();
1032 1023
1033 Browser* new_browser = NULL; 1024 Browser* new_browser = NULL;
1034 // The last open profile (the profile_home1 in this case) will always be 1025 // The last open profile (the profile_home1 in this case) will always be
1035 // launched, even if it will open just the NTP (and the welcome page on 1026 // launched, even if it will open just the NTP (and the welcome page on
1036 // relevant platforms). 1027 // relevant platforms).
1037 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1, original_desktop_type)); 1028 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1));
1038 new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL); 1029 new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL);
1039 ASSERT_TRUE(new_browser); 1030 ASSERT_TRUE(new_browser);
1040 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1031 TabStripModel* tab_strip = new_browser->tab_strip_model();
1041 if (IsWindows10OrNewer()) { 1032 if (IsWindows10OrNewer()) {
1042 // The new browser should have the welcome tab and the NTP. 1033 // The new browser should have the welcome tab and the NTP.
1043 ASSERT_EQ(2, tab_strip->count()); 1034 ASSERT_EQ(2, tab_strip->count());
1044 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), 1035 EXPECT_EQ(GURL(internals::GetWelcomePageURL()),
1045 tab_strip->GetWebContentsAt(0)->GetURL()); 1036 tab_strip->GetWebContentsAt(0)->GetURL());
1046 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1037 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1047 tab_strip->GetWebContentsAt(1)->GetURL()); 1038 tab_strip->GetWebContentsAt(1)->GetURL());
1048 } else { 1039 } else {
1049 // The new browser should have only the NTP. 1040 // The new browser should have only the NTP.
1050 ASSERT_EQ(1, tab_strip->count()); 1041 ASSERT_EQ(1, tab_strip->count());
1051 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1042 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1052 tab_strip->GetWebContentsAt(0)->GetURL()); 1043 tab_strip->GetWebContentsAt(0)->GetURL());
1053 } 1044 }
1054 1045
1055 // profile_urls opened the urls. 1046 // profile_urls opened the urls.
1056 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, original_desktop_type)); 1047 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls));
1057 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); 1048 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
1058 ASSERT_TRUE(new_browser); 1049 ASSERT_TRUE(new_browser);
1059 tab_strip = new_browser->tab_strip_model(); 1050 tab_strip = new_browser->tab_strip_model();
1060 ASSERT_EQ(1, tab_strip->count()); 1051 ASSERT_EQ(1, tab_strip->count());
1061 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL()); 1052 EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL());
1062 1053
1063 // profile_last opened the last open pages. 1054 // profile_last opened the last open pages.
1064 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, original_desktop_type)); 1055 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last));
1065 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); 1056 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
1066 ASSERT_TRUE(new_browser); 1057 ASSERT_TRUE(new_browser);
1067 tab_strip = new_browser->tab_strip_model(); 1058 tab_strip = new_browser->tab_strip_model();
1068 ASSERT_EQ(1, tab_strip->count()); 1059 ASSERT_EQ(1, tab_strip->count());
1069 EXPECT_EQ("/empty.html", tab_strip->GetWebContentsAt(0)->GetURL().path()); 1060 EXPECT_EQ("/empty.html", tab_strip->GetWebContentsAt(0)->GetURL().path());
1070 1061
1071 // profile_home2 was not launched since it would've only opened the home page. 1062 // profile_home2 was not launched since it would've only opened the home page.
1072 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2, original_desktop_type)); 1063 ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2));
1073 } 1064 }
1074 1065
1075 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { 1066 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
1076 #if defined(OS_WIN) && defined(USE_ASH) 1067 #if defined(OS_WIN) && defined(USE_ASH)
1077 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 1068 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
1078 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1069 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1079 switches::kAshBrowserTests)) 1070 switches::kAshBrowserTests))
1080 return; 1071 return;
1081 #endif 1072 #endif
1082 1073
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 1141
1151 // No profiles are getting restored, since they all display the crash info 1142 // No profiles are getting restored, since they all display the crash info
1152 // bar. 1143 // bar.
1153 EXPECT_FALSE(SessionRestore::IsRestoring(profile_home)); 1144 EXPECT_FALSE(SessionRestore::IsRestoring(profile_home));
1154 EXPECT_FALSE(SessionRestore::IsRestoring(profile_last)); 1145 EXPECT_FALSE(SessionRestore::IsRestoring(profile_last));
1155 EXPECT_FALSE(SessionRestore::IsRestoring(profile_urls)); 1146 EXPECT_FALSE(SessionRestore::IsRestoring(profile_urls));
1156 1147
1157 // The profile which normally opens the home page displays the new tab page. 1148 // The profile which normally opens the home page displays the new tab page.
1158 // The welcome page is also shown for relevant platforms. 1149 // The welcome page is also shown for relevant platforms.
1159 Browser* new_browser = NULL; 1150 Browser* new_browser = NULL;
1160 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home, 1151 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home));
1161 browser()->host_desktop_type()));
1162 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL); 1152 new_browser = FindOneOtherBrowserForProfile(profile_home, NULL);
1163 ASSERT_TRUE(new_browser); 1153 ASSERT_TRUE(new_browser);
1164 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1154 TabStripModel* tab_strip = new_browser->tab_strip_model();
1165 if (IsWindows10OrNewer()) { 1155 if (IsWindows10OrNewer()) {
1166 // The new browser should have the welcome tab and the NTP. 1156 // The new browser should have the welcome tab and the NTP.
1167 ASSERT_EQ(2, tab_strip->count()); 1157 ASSERT_EQ(2, tab_strip->count());
1168 EXPECT_EQ(GURL(internals::GetWelcomePageURL()), 1158 EXPECT_EQ(GURL(internals::GetWelcomePageURL()),
1169 tab_strip->GetWebContentsAt(0)->GetURL()); 1159 tab_strip->GetWebContentsAt(0)->GetURL());
1170 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1160 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1171 tab_strip->GetWebContentsAt(1)->GetURL()); 1161 tab_strip->GetWebContentsAt(1)->GetURL());
1172 } else { 1162 } else {
1173 // The new browser should have only the NTP. 1163 // The new browser should have only the NTP.
1174 ASSERT_EQ(1, tab_strip->count()); 1164 ASSERT_EQ(1, tab_strip->count());
1175 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1165 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1176 tab_strip->GetWebContentsAt(0)->GetURL()); 1166 tab_strip->GetWebContentsAt(0)->GetURL());
1177 } 1167 }
1178 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0)); 1168 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0));
1179 1169
1180 // The profile which normally opens last open pages displays the new tab page. 1170 // The profile which normally opens last open pages displays the new tab page.
1181 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last, 1171 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last));
1182 browser()->host_desktop_type()));
1183 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); 1172 new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
1184 ASSERT_TRUE(new_browser); 1173 ASSERT_TRUE(new_browser);
1185 tab_strip = new_browser->tab_strip_model(); 1174 tab_strip = new_browser->tab_strip_model();
1186 ASSERT_EQ(1, tab_strip->count()); 1175 ASSERT_EQ(1, tab_strip->count());
1187 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1176 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1188 tab_strip->GetWebContentsAt(0)->GetURL()); 1177 tab_strip->GetWebContentsAt(0)->GetURL());
1189 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0)); 1178 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0));
1190 1179
1191 // The profile which normally opens URLs displays the new tab page. 1180 // The profile which normally opens URLs displays the new tab page.
1192 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls, 1181 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls));
1193 browser()->host_desktop_type()));
1194 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); 1182 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
1195 ASSERT_TRUE(new_browser); 1183 ASSERT_TRUE(new_browser);
1196 tab_strip = new_browser->tab_strip_model(); 1184 tab_strip = new_browser->tab_strip_model();
1197 ASSERT_EQ(1, tab_strip->count()); 1185 ASSERT_EQ(1, tab_strip->count());
1198 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 1186 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
1199 tab_strip->GetWebContentsAt(0)->GetURL()); 1187 tab_strip->GetWebContentsAt(0)->GetURL());
1200 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0)); 1188 EnsureRestoreUIWasShown(tab_strip->GetWebContentsAt(0));
1201 1189
1202 #if !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD) 1190 #if !defined(OS_MACOSX) && !defined(GOOGLE_CHROME_BUILD)
1203 // Each profile should have one session restore bubble shown, so we should 1191 // Each profile should have one session restore bubble shown, so we should
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 ASSERT_EQ(1, tab_strip->count()); 1704 ASSERT_EQ(1, tab_strip->count());
1717 EXPECT_EQ("title1.html", 1705 EXPECT_EQ("title1.html",
1718 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1706 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1719 } 1707 }
1720 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1708 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1721 1709
1722 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1710 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1723 // defined(ENABLE_CONFIGURATION_POLICY) 1711 // defined(ENABLE_CONFIGURATION_POLICY)
1724 1712
1725 #endif // !defined(OS_CHROMEOS) 1713 #endif // !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | chrome/browser/ui/startup/startup_browser_creator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698