Chromium Code Reviews| 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 <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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 // Add --app-id=<extension->id()> to the command line. | 313 // Add --app-id=<extension->id()> to the command line. |
| 314 CommandLine command_line(CommandLine::NO_PROGRAM); | 314 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 315 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 315 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
| 316 | 316 |
| 317 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 317 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
| 318 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 318 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
| 319 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); | 319 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); |
| 320 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, | 320 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false, |
| 321 browser()->host_desktop_type())); | 321 browser()->host_desktop_type())); |
| 322 | 322 |
| 323 // No pref was set, so the app should have opened in a window. | 323 // No pref was set, so the app should have opened in a tab in a new window. |
| 324 // The launch should have created a new browser. | 324 // The launch should have created a new browser. |
| 325 Browser* new_browser = FindOneOtherBrowser(browser()); | 325 Browser* new_browser = FindOneOtherBrowser(browser()); |
| 326 ASSERT_TRUE(new_browser); | 326 ASSERT_TRUE(new_browser); |
| 327 | 327 |
| 328 // Expect an app window. | 328 // It should be a standard tabbed window, not an app window. |
|
Lei Zhang
2014/12/11 19:29:05
It's not clear how enabling the bookmarks app syst
| |
| 329 EXPECT_TRUE(new_browser->is_app()); | 329 EXPECT_FALSE(new_browser->is_app()); |
| 330 | 330 EXPECT_TRUE(new_browser->is_type_tabbed()); |
| 331 // The browser's app_name should include the app's ID. | |
| 332 EXPECT_NE( | |
| 333 new_browser->app_name_.find(extension_app->id()), | |
| 334 std::string::npos) << new_browser->app_name_; | |
| 335 } | 331 } |
| 336 | 332 |
| 337 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) { | 333 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) { |
| 338 const Extension* extension_app = NULL; | 334 const Extension* extension_app = NULL; |
| 339 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); | 335 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); |
| 340 | 336 |
| 341 // Set a pref indicating that the user wants to open this app in a window. | 337 // Set a pref indicating that the user wants to open this app in a window. |
| 342 SetAppLaunchPref(extension_app->id(), extensions::LAUNCH_TYPE_WINDOW); | 338 SetAppLaunchPref(extension_app->id(), extensions::LAUNCH_TYPE_WINDOW); |
| 343 | 339 |
| 344 CommandLine command_line(CommandLine::NO_PROGRAM); | 340 CommandLine command_line(CommandLine::NO_PROGRAM); |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1491 ASSERT_EQ(1, tab_strip->count()); | 1487 ASSERT_EQ(1, tab_strip->count()); |
| 1492 EXPECT_EQ("title1.html", | 1488 EXPECT_EQ("title1.html", |
| 1493 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1489 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
| 1494 } | 1490 } |
| 1495 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1491 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 1496 | 1492 |
| 1497 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1493 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
| 1498 // defined(ENABLE_CONFIGURATION_POLICY) | 1494 // defined(ENABLE_CONFIGURATION_POLICY) |
| 1499 | 1495 |
| 1500 #endif // !defined(OS_CHROMEOS) | 1496 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |