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

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

Issue 10332117: Revert 136573 - Extract StartupTabs and startup types from StartupBrowserCreator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/first_run/first_run.h" 11 #include "chrome/browser/first_run/first_run.h"
12 #include "chrome/browser/infobars/infobar_tab_helper.h" 12 #include "chrome/browser/infobars/infobar_tab_helper.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/prefs/session_startup_pref.h" 14 #include "chrome/browser/prefs/session_startup_pref.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_impl.h" 16 #include "chrome/browser/profiles/profile_impl.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/sessions/session_restore.h" 18 #include "chrome/browser/sessions/session_restore.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_list.h" 20 #include "chrome/browser/ui/browser_list.h"
21 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/startup/startup_browser_creator.h" 22 #include "chrome/browser/ui/startup/startup_browser_creator.h"
23 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
25 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
27 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
28 #include "chrome/test/base/in_process_browser_test.h" 27 #include "chrome/test/base/in_process_browser_test.h"
29 #include "chrome/test/base/ui_test_utils.h" 28 #include "chrome/test/base/ui_test_utils.h"
30 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
31 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
32 31
33 class StartupBrowserCreatorTest : public ExtensionBrowserTest { 32 class StartupBrowserCreatorTest : public ExtensionBrowserTest {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 virtual void OnBrowserAdded(const Browser* browser) { 102 virtual void OnBrowserAdded(const Browser* browser) {
104 added_browser_ = browser; 103 added_browser_ = browser;
105 } 104 }
106 105
107 virtual void OnBrowserRemoved(const Browser* browser) { } 106 virtual void OnBrowserRemoved(const Browser* browser) { }
108 107
109 const Browser* added_browser_; 108 const Browser* added_browser_;
110 }; 109 };
111 110
112 // Test that when there is a popup as the active browser any requests to 111 // Test that when there is a popup as the active browser any requests to
113 // StartupBrowserCreatorImpl::OpenURLsInBrowser don't crash because there's no 112 // StartupBrowserCreator::LaunchWithProfile::OpenURLsInBrowser don't crash
114 // explicit profile given. 113 // because there's no explicit profile given.
115 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) { 114 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) {
116 std::vector<GURL> urls; 115 std::vector<GURL> urls;
117 urls.push_back(GURL("http://localhost")); 116 urls.push_back(GURL("http://localhost"));
118 117
119 // Note that in our testing we do not ever query the BrowserList for the "last 118 // Note that in our testing we do not ever query the BrowserList for the "last
120 // active" browser. That's because the browsers are set as "active" by 119 // active" browser. That's because the browsers are set as "active" by
121 // platform UI toolkit messages, and those messages are not sent during unit 120 // platform UI toolkit messages, and those messages are not sent during unit
122 // testing sessions. 121 // testing sessions.
123 122
124 OpenURLsPopupObserver observer; 123 OpenURLsPopupObserver observer;
125 BrowserList::AddObserver(&observer); 124 BrowserList::AddObserver(&observer);
126 125
127 Browser* popup = Browser::CreateWithParams( 126 Browser* popup = Browser::CreateWithParams(
128 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); 127 Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile()));
129 ASSERT_TRUE(popup->is_type_popup()); 128 ASSERT_TRUE(popup->is_type_popup());
130 ASSERT_EQ(popup, observer.added_browser_); 129 ASSERT_EQ(popup, observer.added_browser_);
131 130
132 CommandLine dummy(CommandLine::NO_PROGRAM); 131 CommandLine dummy(CommandLine::NO_PROGRAM);
133 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 132 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
134 browser::startup::IS_FIRST_RUN : 133 StartupBrowserCreator::IS_FIRST_RUN :
135 browser::startup::IS_NOT_FIRST_RUN; 134 StartupBrowserCreator::IS_NOT_FIRST_RUN;
136 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); 135 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
137 // This should create a new window, but re-use the profile from |popup|. If 136 // This should create a new window, but re-use the profile from |popup|. If
138 // it used a NULL or invalid profile, it would crash. 137 // it used a NULL or invalid profile, it would crash.
139 launch.OpenURLsInBrowser(popup, false, urls); 138 launch.OpenURLsInBrowser(popup, false, urls);
140 ASSERT_NE(popup, observer.added_browser_); 139 ASSERT_NE(popup, observer.added_browser_);
141 BrowserList::RemoveObserver(&observer); 140 BrowserList::RemoveObserver(&observer);
142 } 141 }
143 142
144 // We don't do non-process-startup browser launches on ChromeOS. 143 // We don't do non-process-startup browser launches on ChromeOS.
145 // Session restore for process-startup browser launches is tested 144 // Session restore for process-startup browser launches is tested
146 // in session_restore_uitest. 145 // in session_restore_uitest.
(...skipping 12 matching lines...) Expand all
159 // Set the startup preference to open these URLs. 158 // Set the startup preference to open these URLs.
160 SessionStartupPref pref(SessionStartupPref::URLS); 159 SessionStartupPref pref(SessionStartupPref::URLS);
161 pref.urls = urls; 160 pref.urls = urls;
162 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 161 SessionStartupPref::SetStartupPref(browser()->profile(), pref);
163 162
164 // Close the browser. 163 // Close the browser.
165 browser()->window()->Close(); 164 browser()->window()->Close();
166 165
167 // Do a simple non-process-startup browser launch. 166 // Do a simple non-process-startup browser launch.
168 CommandLine dummy(CommandLine::NO_PROGRAM); 167 CommandLine dummy(CommandLine::NO_PROGRAM);
169 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 168 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
170 browser::startup::IS_FIRST_RUN : 169 StartupBrowserCreator::IS_FIRST_RUN :
171 browser::startup::IS_NOT_FIRST_RUN; 170 StartupBrowserCreator::IS_NOT_FIRST_RUN;
172 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); 171 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
173 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); 172 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
174 173
175 // This should have created a new browser window. |browser()| is still 174 // This should have created a new browser window. |browser()| is still
176 // around at this point, even though we've closed its window. 175 // around at this point, even though we've closed its window.
177 Browser* new_browser = NULL; 176 Browser* new_browser = NULL;
178 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); 177 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
179 178
180 // The new browser should have one tab for each URL. 179 // The new browser should have one tab for each URL.
181 ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count()); 180 ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count());
182 for (size_t i=0; i < urls.size(); i++) { 181 for (size_t i=0; i < urls.size(); i++) {
(...skipping 20 matching lines...) Expand all
203 FilePath(FilePath::kCurrentDirectory), 202 FilePath(FilePath::kCurrentDirectory),
204 FilePath(FILE_PATH_LITERAL("title2.html")))); 203 FilePath(FILE_PATH_LITERAL("title2.html"))));
205 204
206 // Set the startup preference to open these URLs. 205 // Set the startup preference to open these URLs.
207 SessionStartupPref pref(SessionStartupPref::URLS); 206 SessionStartupPref pref(SessionStartupPref::URLS);
208 pref.urls = urls; 207 pref.urls = urls;
209 SessionStartupPref::SetStartupPref(browser()->profile(), pref); 208 SessionStartupPref::SetStartupPref(browser()->profile(), pref);
210 209
211 // Do a simple non-process-startup browser launch. 210 // Do a simple non-process-startup browser launch.
212 CommandLine dummy(CommandLine::NO_PROGRAM); 211 CommandLine dummy(CommandLine::NO_PROGRAM);
213 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 212 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
214 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; 213 StartupBrowserCreator::IS_FIRST_RUN :
215 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); 214 StartupBrowserCreator::IS_NOT_FIRST_RUN;
215 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
216 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); 216 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
217 217
218 // This should have created a new browser window. 218 // This should have created a new browser window.
219 Browser* new_browser = NULL; 219 Browser* new_browser = NULL;
220 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); 220 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
221 221
222 // The new browser should have exactly one tab (not the startup URLs). 222 // The new browser should have exactly one tab (not the startup URLs).
223 ASSERT_EQ(1, new_browser->tab_count()); 223 ASSERT_EQ(1, new_browser->tab_count());
224 } 224 }
225 225
226 // App shortcuts are not implemented on mac os. 226 // App shortcuts are not implemented on mac os.
227 #if !defined(OS_MACOSX) 227 #if !defined(OS_MACOSX)
228 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { 228 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) {
229 // Load an app with launch.container = 'tab'. 229 // Load an app with launch.container = 'tab'.
230 const Extension* extension_app = NULL; 230 const Extension* extension_app = NULL;
231 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); 231 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
232 232
233 // Add --app-id=<extension->id()> to the command line. 233 // Add --app-id=<extension->id()> to the command line.
234 CommandLine command_line(CommandLine::NO_PROGRAM); 234 CommandLine command_line(CommandLine::NO_PROGRAM);
235 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 235 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
236 236
237 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 237 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
238 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; 238 StartupBrowserCreator::IS_FIRST_RUN :
239 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); 239 StartupBrowserCreator::IS_NOT_FIRST_RUN;
240 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
241 first_run);
240 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); 242 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
241 243
242 // No pref was set, so the app should have opened in a window. 244 // No pref was set, so the app should have opened in a window.
243 // The launch should have created a new browser. 245 // The launch should have created a new browser.
244 Browser* new_browser = NULL; 246 Browser* new_browser = NULL;
245 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); 247 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
246 248
247 // Expect an app window. 249 // Expect an app window.
248 EXPECT_TRUE(new_browser->is_app()); 250 EXPECT_TRUE(new_browser->is_app());
249 251
250 // The browser's app_name should include the app's ID. 252 // The browser's app_name should include the app's ID.
251 EXPECT_NE( 253 EXPECT_NE(
252 new_browser->app_name_.find(extension_app->id()), 254 new_browser->app_name_.find(extension_app->id()),
253 std::string::npos) << new_browser->app_name_; 255 std::string::npos) << new_browser->app_name_;
254 } 256 }
255 257
256 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) { 258 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) {
257 const Extension* extension_app = NULL; 259 const Extension* extension_app = NULL;
258 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); 260 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
259 261
260 // Set a pref indicating that the user wants to open this app in a window. 262 // Set a pref indicating that the user wants to open this app in a window.
261 SetAppLaunchPref(extension_app->id(), ExtensionPrefs::LAUNCH_WINDOW); 263 SetAppLaunchPref(extension_app->id(), ExtensionPrefs::LAUNCH_WINDOW);
262 264
263 CommandLine command_line(CommandLine::NO_PROGRAM); 265 CommandLine command_line(CommandLine::NO_PROGRAM);
264 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 266 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
265 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 267 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
266 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; 268 StartupBrowserCreator::IS_FIRST_RUN :
267 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); 269 StartupBrowserCreator::IS_NOT_FIRST_RUN;
270 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
271 first_run);
268 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); 272 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
269 273
270 // Pref was set to open in a window, so the app should have opened in a 274 // Pref was set to open in a window, so the app should have opened in a
271 // window. The launch should have created a new browser. Find the new 275 // window. The launch should have created a new browser. Find the new
272 // browser. 276 // browser.
273 Browser* new_browser = NULL; 277 Browser* new_browser = NULL;
274 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); 278 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
275 279
276 // Expect an app window. 280 // Expect an app window.
277 EXPECT_TRUE(new_browser->is_app()); 281 EXPECT_TRUE(new_browser->is_app());
278 282
279 // The browser's app_name should include the app's ID. 283 // The browser's app_name should include the app's ID.
280 EXPECT_NE( 284 EXPECT_NE(
281 new_browser->app_name_.find(extension_app->id()), 285 new_browser->app_name_.find(extension_app->id()),
282 std::string::npos) << new_browser->app_name_; 286 std::string::npos) << new_browser->app_name_;
283 } 287 }
284 288
285 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) { 289 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) {
286 // Load an app with launch.container = 'tab'. 290 // Load an app with launch.container = 'tab'.
287 const Extension* extension_app = NULL; 291 const Extension* extension_app = NULL;
288 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); 292 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
289 293
290 // Set a pref indicating that the user wants to open this app in a window. 294 // Set a pref indicating that the user wants to open this app in a window.
291 SetAppLaunchPref(extension_app->id(), ExtensionPrefs::LAUNCH_REGULAR); 295 SetAppLaunchPref(extension_app->id(), ExtensionPrefs::LAUNCH_REGULAR);
292 296
293 CommandLine command_line(CommandLine::NO_PROGRAM); 297 CommandLine command_line(CommandLine::NO_PROGRAM);
294 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 298 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
295 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 299 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
296 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; 300 StartupBrowserCreator::IS_FIRST_RUN :
297 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); 301 StartupBrowserCreator::IS_NOT_FIRST_RUN;
302 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
303 first_run);
298 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); 304 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
299 305
300 // When an app shortcut is open and the pref indicates a tab should 306 // When an app shortcut is open and the pref indicates a tab should
301 // open, the tab is open in a new browser window. Expect a new window. 307 // open, the tab is open in a new browser window. Expect a new window.
302 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); 308 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
303 309
304 Browser* new_browser = NULL; 310 Browser* new_browser = NULL;
305 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); 311 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
306 312
307 // The tab should be in a tabbed window. 313 // The tab should be in a tabbed window.
308 EXPECT_TRUE(new_browser->is_type_tabbed()); 314 EXPECT_TRUE(new_browser->is_type_tabbed());
309 315
310 // The browser's app_name should not include the app's ID: It is in a 316 // The browser's app_name should not include the app's ID: It is in a
311 // normal browser. 317 // normal browser.
312 EXPECT_EQ( 318 EXPECT_EQ(
313 new_browser->app_name_.find(extension_app->id()), 319 new_browser->app_name_.find(extension_app->id()),
314 std::string::npos) << new_browser->app_name_; 320 std::string::npos) << new_browser->app_name_;
315 } 321 }
316 322
317 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) { 323 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) {
318 // Load an app with launch.container = 'panel'. 324 // Load an app with launch.container = 'panel'.
319 const Extension* extension_app = NULL; 325 const Extension* extension_app = NULL;
320 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_panel_container", &extension_app)); 326 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_panel_container", &extension_app));
321 327
322 CommandLine command_line(CommandLine::NO_PROGRAM); 328 CommandLine command_line(CommandLine::NO_PROGRAM);
323 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); 329 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
324 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? 330 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
325 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; 331 StartupBrowserCreator::IS_FIRST_RUN :
326 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); 332 StartupBrowserCreator::IS_NOT_FIRST_RUN;
333 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
334 first_run);
327 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); 335 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
328 336
329 // The launch should have created a new browser, with a panel type. 337 // The launch should have created a new browser, with a panel type.
330 Browser* new_browser = NULL; 338 Browser* new_browser = NULL;
331 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); 339 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
332 340
333 // Expect an app panel. 341 // Expect an app panel.
334 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app()); 342 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app());
335 343
336 // The new browser's app_name should include the app's ID. 344 // The new browser's app_name should include the app's ID.
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_urls)); 689 ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_urls));
682 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); 690 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
683 ASSERT_TRUE(new_browser); 691 ASSERT_TRUE(new_browser);
684 ASSERT_EQ(1, new_browser->tab_count()); 692 ASSERT_EQ(1, new_browser->tab_count());
685 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), 693 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
686 new_browser->GetWebContentsAt(0)->GetURL()); 694 new_browser->GetWebContentsAt(0)->GetURL());
687 EXPECT_EQ(1U, new_browser->GetTabContentsWrapperAt(0)->infobar_tab_helper()-> 695 EXPECT_EQ(1U, new_browser->GetTabContentsWrapperAt(0)->infobar_tab_helper()->
688 infobar_count()); 696 infobar_count());
689 } 697 }
690 #endif // !OS_CHROMEOS 698 #endif // !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.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698