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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 browser()->host_desktop_type())); | 274 browser()->host_desktop_type())); |
275 | 275 |
276 // This should have created a new browser window. | 276 // This should have created a new browser window. |
277 Browser* new_browser = FindOneOtherBrowser(browser()); | 277 Browser* new_browser = FindOneOtherBrowser(browser()); |
278 ASSERT_TRUE(new_browser); | 278 ASSERT_TRUE(new_browser); |
279 | 279 |
280 // The new browser should have exactly one tab (not the startup URLs). | 280 // The new browser should have exactly one tab (not the startup URLs). |
281 ASSERT_EQ(1, new_browser->tab_strip_model()->count()); | 281 ASSERT_EQ(1, new_browser->tab_strip_model()->count()); |
282 } | 282 } |
283 | 283 |
| 284 #if defined(OS_WIN) |
| 285 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ActivateExistingBrowser) { |
| 286 // Initially, there should only be one browser open. |
| 287 ASSERT_TRUE(browser()); |
| 288 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
| 289 browser()->host_desktop_type())); |
| 290 |
| 291 // Add --activate-existing-profile-browser to the command line and |
| 292 // start a new process. |
| 293 CommandLine dummy(CommandLine::NO_PROGRAM); |
| 294 dummy.AppendSwitch(switches::kActivateExistingProfileBrowser); |
| 295 |
| 296 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( |
| 297 dummy, base::FilePath(), browser()->profile()->GetPath()); |
| 298 |
| 299 // This should not have created a new browser window, and should have |
| 300 // activated the existing browser. |
| 301 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
| 302 browser()->host_desktop_type())); |
| 303 } |
| 304 #endif |
| 305 |
284 // App shortcuts are not implemented on mac os. | 306 // App shortcuts are not implemented on mac os. |
285 #if !defined(OS_MACOSX) | 307 #if !defined(OS_MACOSX) |
286 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { | 308 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { |
287 // Load an app with launch.container = 'tab'. | 309 // Load an app with launch.container = 'tab'. |
288 const Extension* extension_app = NULL; | 310 const Extension* extension_app = NULL; |
289 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); | 311 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); |
290 | 312 |
291 // Add --app-id=<extension->id()> to the command line. | 313 // Add --app-id=<extension->id()> to the command line. |
292 CommandLine command_line(CommandLine::NO_PROGRAM); | 314 CommandLine command_line(CommandLine::NO_PROGRAM); |
293 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 315 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 ASSERT_EQ(1, tab_strip->count()); | 1491 ASSERT_EQ(1, tab_strip->count()); |
1470 EXPECT_EQ("title1.html", | 1492 EXPECT_EQ("title1.html", |
1471 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1493 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
1472 } | 1494 } |
1473 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1495 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
1474 | 1496 |
1475 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1497 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
1476 // defined(ENABLE_CONFIGURATION_POLICY) | 1498 // defined(ENABLE_CONFIGURATION_POLICY) |
1477 | 1499 |
1478 #endif // !defined(OS_CHROMEOS) | 1500 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |