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

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

Issue 1662783002: Remove HostDesktopType from Browser::CreateParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-12
Patch Set: remove desktop_type_ in bookmark_bubble_sign_in_delegate 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 // Note that in our testing we do not ever query the BrowserList for the "last 227 // Note that in our testing we do not ever query the BrowserList for the "last
228 // active" browser. That's because the browsers are set as "active" by 228 // active" browser. That's because the browsers are set as "active" by
229 // platform UI toolkit messages, and those messages are not sent during unit 229 // platform UI toolkit messages, and those messages are not sent during unit
230 // testing sessions. 230 // testing sessions.
231 231
232 OpenURLsPopupObserver observer; 232 OpenURLsPopupObserver observer;
233 BrowserList::AddObserver(&observer); 233 BrowserList::AddObserver(&observer);
234 234
235 Browser* popup = new Browser( 235 Browser* popup = new Browser(
236 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile(), 236 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile()));
237 browser()->host_desktop_type()));
238 ASSERT_TRUE(popup->is_type_popup()); 237 ASSERT_TRUE(popup->is_type_popup());
239 ASSERT_EQ(popup, observer.added_browser_); 238 ASSERT_EQ(popup, observer.added_browser_);
240 239
241 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 240 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
242 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 241 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
243 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; 242 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
244 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); 243 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
245 // This should create a new window, but re-use the profile from |popup|. If 244 // This should create a new window, but re-use the profile from |popup|. If
246 // it used a NULL or invalid profile, it would crash. 245 // it used a NULL or invalid profile, it would crash.
247 launch.OpenURLsInBrowser(popup, false, urls, chrome::GetActiveDesktop()); 246 launch.OpenURLsInBrowser(popup, false, urls, chrome::GetActiveDesktop());
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 830
832 Profile* profile1 = profile_manager->GetProfile( 831 Profile* profile1 = profile_manager->GetProfile(
833 dest_path.Append(FILE_PATH_LITERAL("New Profile 1"))); 832 dest_path.Append(FILE_PATH_LITERAL("New Profile 1")));
834 ASSERT_TRUE(profile1); 833 ASSERT_TRUE(profile1);
835 834
836 Profile* profile2 = profile_manager->GetProfile( 835 Profile* profile2 = profile_manager->GetProfile(
837 dest_path.Append(FILE_PATH_LITERAL("New Profile 2"))); 836 dest_path.Append(FILE_PATH_LITERAL("New Profile 2")));
838 ASSERT_TRUE(profile2); 837 ASSERT_TRUE(profile2);
839 838
840 // Open some urls with the browsers, and close them. 839 // Open some urls with the browsers, and close them.
841 Browser* browser1 = new Browser( 840 Browser* browser1 =
842 Browser::CreateParams(Browser::TYPE_TABBED, profile1, 841 new Browser(Browser::CreateParams(Browser::TYPE_TABBED, profile1));
843 browser()->host_desktop_type()));
844 chrome::NewTab(browser1); 842 chrome::NewTab(browser1);
845 ui_test_utils::NavigateToURL(browser1, 843 ui_test_utils::NavigateToURL(browser1,
846 embedded_test_server()->GetURL("/empty.html")); 844 embedded_test_server()->GetURL("/empty.html"));
847 CloseBrowserSynchronously(browser1); 845 CloseBrowserSynchronously(browser1);
848 846
849 Browser* browser2 = new Browser( 847 Browser* browser2 = new Browser(
850 Browser::CreateParams(Browser::TYPE_TABBED, profile2, 848 Browser::CreateParams(Browser::TYPE_TABBED, profile2));
851 browser()->host_desktop_type()));
852 chrome::NewTab(browser2); 849 chrome::NewTab(browser2);
853 ui_test_utils::NavigateToURL(browser2, 850 ui_test_utils::NavigateToURL(browser2,
854 embedded_test_server()->GetURL("/form.html")); 851 embedded_test_server()->GetURL("/form.html"));
855 CloseBrowserSynchronously(browser2); 852 CloseBrowserSynchronously(browser2);
856 853
857 // Set different startup preferences for the 2 profiles. 854 // Set different startup preferences for the 2 profiles.
858 std::vector<GURL> urls1; 855 std::vector<GURL> urls1;
859 urls1.push_back(ui_test_utils::GetTestUrl( 856 urls1.push_back(ui_test_utils::GetTestUrl(
860 base::FilePath(base::FilePath::kCurrentDirectory), 857 base::FilePath(base::FilePath::kCurrentDirectory),
861 base::FilePath(FILE_PATH_LITERAL("title1.html")))); 858 base::FilePath(FILE_PATH_LITERAL("title1.html"))));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 urls.push_back(ui_test_utils::GetTestUrl( 982 urls.push_back(ui_test_utils::GetTestUrl(
986 base::FilePath(base::FilePath::kCurrentDirectory), 983 base::FilePath(base::FilePath::kCurrentDirectory),
987 base::FilePath(FILE_PATH_LITERAL("title1.html")))); 984 base::FilePath(FILE_PATH_LITERAL("title1.html"))));
988 985
989 SessionStartupPref pref_urls(SessionStartupPref::URLS); 986 SessionStartupPref pref_urls(SessionStartupPref::URLS);
990 pref_urls.urls = urls; 987 pref_urls.urls = urls;
991 SessionStartupPref::SetStartupPref(profile_urls, pref_urls); 988 SessionStartupPref::SetStartupPref(profile_urls, pref_urls);
992 989
993 // Open a page with profile_last. 990 // Open a page with profile_last.
994 Browser* browser_last = new Browser( 991 Browser* browser_last = new Browser(
995 Browser::CreateParams(Browser::TYPE_TABBED, profile_last, 992 Browser::CreateParams(Browser::TYPE_TABBED, profile_last));
996 browser()->host_desktop_type()));
997 chrome::NewTab(browser_last); 993 chrome::NewTab(browser_last);
998 ui_test_utils::NavigateToURL(browser_last, 994 ui_test_utils::NavigateToURL(browser_last,
999 embedded_test_server()->GetURL("/empty.html")); 995 embedded_test_server()->GetURL("/empty.html"));
1000 CloseBrowserAsynchronously(browser_last); 996 CloseBrowserAsynchronously(browser_last);
1001 997
1002 // Close the main browser. 998 // Close the main browser.
1003 CloseBrowserAsynchronously(browser()); 999 CloseBrowserAsynchronously(browser());
1004 1000
1005 // Do a simple non-process-startup browser launch. 1001 // Do a simple non-process-startup browser launch.
1006 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 1002 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 ASSERT_EQ(1, tab_strip->count()); 1700 ASSERT_EQ(1, tab_strip->count());
1705 EXPECT_EQ("title1.html", 1701 EXPECT_EQ("title1.html",
1706 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1702 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1707 } 1703 }
1708 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1704 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1709 1705
1710 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1706 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1711 // defined(ENABLE_CONFIGURATION_POLICY) 1707 // defined(ENABLE_CONFIGURATION_POLICY)
1712 1708
1713 #endif // !defined(OS_CHROMEOS) 1709 #endif // !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698