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

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

Issue 1336823003: Move chrome::HostDesktopType to ui::HostDesktopType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base_session_service_delegate_impl
Patch Set: Fix build on Mac and CrOS Created 5 years, 3 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 <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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // background application. 218 // background application.
219 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 219 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
220 StartupURLsOnNewWindowWithNoTabbedBrowsers) { 220 StartupURLsOnNewWindowWithNoTabbedBrowsers) {
221 // Use a couple same-site HTTP URLs. 221 // Use a couple same-site HTTP URLs.
222 ASSERT_TRUE(test_server()->Start()); 222 ASSERT_TRUE(test_server()->Start());
223 std::vector<GURL> urls; 223 std::vector<GURL> urls;
224 urls.push_back(test_server()->GetURL("files/title1.html")); 224 urls.push_back(test_server()->GetURL("files/title1.html"));
225 urls.push_back(test_server()->GetURL("files/title2.html")); 225 urls.push_back(test_server()->GetURL("files/title2.html"));
226 226
227 Profile* profile = browser()->profile(); 227 Profile* profile = browser()->profile();
228 chrome::HostDesktopType host_desktop_type = browser()->host_desktop_type(); 228 ui::HostDesktopType host_desktop_type = browser()->host_desktop_type();
229 229
230 // Set the startup preference to open these URLs. 230 // Set the startup preference to open these URLs.
231 SessionStartupPref pref(SessionStartupPref::URLS); 231 SessionStartupPref pref(SessionStartupPref::URLS);
232 pref.urls = urls; 232 pref.urls = urls;
233 SessionStartupPref::SetStartupPref(profile, pref); 233 SessionStartupPref::SetStartupPref(profile, pref);
234 234
235 // Keep the browser process running while browsers are closed. 235 // Keep the browser process running while browsers are closed.
236 g_browser_process->AddRefModule(); 236 g_browser_process->AddRefModule();
237 237
238 // Close the browser. 238 // Close the browser.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 { 283 {
284 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 284 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
285 ASSERT_TRUE(launch.Launch(profile, std::vector<GURL>(), false, 285 ASSERT_TRUE(launch.Launch(profile, std::vector<GURL>(), false,
286 host_desktop_type)); 286 host_desktop_type));
287 } 287 }
288 288
289 // Find the new browser and ensure that it has only the specified URLs this 289 // Find the new browser and ensure that it has only the specified URLs this
290 // time. Both the original browser created by the fixture and the one 290 // time. Both the original browser created by the fixture and the one
291 // created above have been closed, so the new browser is the only one 291 // created above have been closed, so the new browser is the only one
292 // remaining. 292 // remaining.
293 new_browser = FindTabbedBrowser(profile, true, host_desktop_type); 293 new_browser = chrome::FindTabbedBrowser(profile, true, host_desktop_type);
294 ASSERT_TRUE(new_browser); 294 ASSERT_TRUE(new_browser);
295 ASSERT_EQ(static_cast<int>(urls.size()), 295 ASSERT_EQ(static_cast<int>(urls.size()),
296 new_browser->tab_strip_model()->count()); 296 new_browser->tab_strip_model()->count());
297 } 297 }
298 298
299 g_browser_process->ReleaseModule(); 299 g_browser_process->ReleaseModule();
300 } 300 }
301 301
302 // Verify that startup URLs aren't used when the process already exists 302 // Verify that startup URLs aren't used when the process already exists
303 // and has other tabbed browser windows. This is the common case of starting a 303 // and has other tabbed browser windows. This is the common case of starting a
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 // Open a page with profile_last. 953 // Open a page with profile_last.
954 Browser* browser_last = new Browser( 954 Browser* browser_last = new Browser(
955 Browser::CreateParams(Browser::TYPE_TABBED, profile_last, 955 Browser::CreateParams(Browser::TYPE_TABBED, profile_last,
956 browser()->host_desktop_type())); 956 browser()->host_desktop_type()));
957 chrome::NewTab(browser_last); 957 chrome::NewTab(browser_last);
958 ui_test_utils::NavigateToURL(browser_last, 958 ui_test_utils::NavigateToURL(browser_last,
959 test_server()->GetURL("files/empty.html")); 959 test_server()->GetURL("files/empty.html"));
960 CloseBrowserAsynchronously(browser_last); 960 CloseBrowserAsynchronously(browser_last);
961 961
962 // Close the main browser. 962 // Close the main browser.
963 chrome::HostDesktopType original_desktop_type = 963 ui::HostDesktopType original_desktop_type = browser()->host_desktop_type();
964 browser()->host_desktop_type();
965 CloseBrowserAsynchronously(browser()); 964 CloseBrowserAsynchronously(browser());
966 965
967 // Do a simple non-process-startup browser launch. 966 // Do a simple non-process-startup browser launch.
968 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 967 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
969 968
970 StartupBrowserCreator browser_creator; 969 StartupBrowserCreator browser_creator;
971 std::vector<Profile*> last_opened_profiles; 970 std::vector<Profile*> last_opened_profiles;
972 last_opened_profiles.push_back(profile_home1); 971 last_opened_profiles.push_back(profile_home1);
973 last_opened_profiles.push_back(profile_home2); 972 last_opened_profiles.push_back(profile_home2);
974 last_opened_profiles.push_back(profile_last); 973 last_opened_profiles.push_back(profile_last);
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 ASSERT_EQ(1, tab_strip->count()); 1625 ASSERT_EQ(1, tab_strip->count());
1627 EXPECT_EQ("title1.html", 1626 EXPECT_EQ("title1.html",
1628 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1627 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1629 } 1628 }
1630 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1629 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1631 1630
1632 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1631 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1633 // defined(ENABLE_CONFIGURATION_POLICY) 1632 // defined(ENABLE_CONFIGURATION_POLICY)
1634 1633
1635 #endif // !defined(OS_CHROMEOS) 1634 #endif // !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698