OLD | NEW |
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" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // The tab should be in a tabbed window. | 309 // The tab should be in a tabbed window. |
310 EXPECT_TRUE(new_browser->is_type_tabbed()); | 310 EXPECT_TRUE(new_browser->is_type_tabbed()); |
311 | 311 |
312 // The browser's app_name should not include the app's ID: It is in a | 312 // The browser's app_name should not include the app's ID: It is in a |
313 // normal browser. | 313 // normal browser. |
314 EXPECT_EQ( | 314 EXPECT_EQ( |
315 new_browser->app_name_.find(extension_app->id()), | 315 new_browser->app_name_.find(extension_app->id()), |
316 std::string::npos) << new_browser->app_name_; | 316 std::string::npos) << new_browser->app_name_; |
317 } | 317 } |
318 | 318 |
319 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) { | |
320 // Load an app with launch.container = 'panel'. | |
321 const Extension* extension_app = NULL; | |
322 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_panel_container", &extension_app)); | |
323 | |
324 CommandLine command_line(CommandLine::NO_PROGRAM); | |
325 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | |
326 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | |
327 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | |
328 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); | |
329 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); | |
330 | |
331 // The launch should have created a new browser, with a panel type. | |
332 Browser* new_browser = NULL; | |
333 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); | |
334 | |
335 // Expect an app panel. | |
336 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app()); | |
337 | |
338 // The new browser's app_name should include the app's ID. | |
339 EXPECT_NE( | |
340 new_browser->app_name_.find(extension_app->id()), | |
341 std::string::npos) << new_browser->app_name_; | |
342 } | |
343 | |
344 #endif // !defined(OS_MACOSX) | 319 #endif // !defined(OS_MACOSX) |
345 | 320 |
346 #endif // !defined(OS_CHROMEOS) | 321 #endif // !defined(OS_CHROMEOS) |
347 | 322 |
348 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, | 323 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, |
349 ReadingWasRestartedAfterRestart) { | 324 ReadingWasRestartedAfterRestart) { |
350 // Tests that StartupBrowserCreator::WasRestarted reads and resets the | 325 // Tests that StartupBrowserCreator::WasRestarted reads and resets the |
351 // preference kWasRestarted correctly. | 326 // preference kWasRestarted correctly. |
352 StartupBrowserCreator::was_restarted_read_ = false; | 327 StartupBrowserCreator::was_restarted_read_ = false; |
353 PrefService* pref_service = g_browser_process->local_state(); | 328 PrefService* pref_service = g_browser_process->local_state(); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 ASSERT_EQ(1u, browser::GetBrowserCount(profile_urls)); | 658 ASSERT_EQ(1u, browser::GetBrowserCount(profile_urls)); |
684 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); | 659 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); |
685 ASSERT_TRUE(new_browser); | 660 ASSERT_TRUE(new_browser); |
686 ASSERT_EQ(1, new_browser->tab_count()); | 661 ASSERT_EQ(1, new_browser->tab_count()); |
687 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), | 662 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
688 chrome::GetWebContentsAt(new_browser, 0)->GetURL()); | 663 chrome::GetWebContentsAt(new_browser, 0)->GetURL()); |
689 EXPECT_EQ(1U, chrome::GetTabContentsAt(new_browser, 0)->infobar_tab_helper()-> | 664 EXPECT_EQ(1U, chrome::GetTabContentsAt(new_browser, 0)->infobar_tab_helper()-> |
690 infobar_count()); | 665 infobar_count()); |
691 } | 666 } |
692 #endif // !OS_CHROMEOS | 667 #endif // !OS_CHROMEOS |
OLD | NEW |