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 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ActivateExistingBrowser) { | |
285 // Initially, there should only be one browser open. | |
286 ASSERT_TRUE(browser()); | |
287 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), | |
288 browser()->host_desktop_type())); | |
289 | |
290 // Add --activate-existing-profile-browser to the command line and | |
291 // start a new process. | |
292 CommandLine dummy(CommandLine::NO_PROGRAM); | |
293 dummy.AppendSwitch(switches::kActivateExistingProfileBrowser); | |
294 | |
295 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( | |
296 dummy, base::FilePath(), browser()->profile()->GetPath()); | |
297 | |
298 // This should not have created a new browser window, and should have | |
299 // activated the existing browser. | |
300 EXPECT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), | |
301 browser()->host_desktop_type())); | |
302 EXPECT_TRUE(browser()->window()->IsActive()); | |
tapted
2014/11/04 23:10:48
Calls to IsActive need to be in interactive_ui_tes
noms (inactive)
2014/11/10 21:46:08
I've just removed the check to active, and checkin
| |
303 } | |
304 | |
284 // App shortcuts are not implemented on mac os. | 305 // App shortcuts are not implemented on mac os. |
285 #if !defined(OS_MACOSX) | 306 #if !defined(OS_MACOSX) |
286 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { | 307 IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { |
287 // Load an app with launch.container = 'tab'. | 308 // Load an app with launch.container = 'tab'. |
288 const Extension* extension_app = NULL; | 309 const Extension* extension_app = NULL; |
289 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); | 310 ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app)); |
290 | 311 |
291 // Add --app-id=<extension->id()> to the command line. | 312 // Add --app-id=<extension->id()> to the command line. |
292 CommandLine command_line(CommandLine::NO_PROGRAM); | 313 CommandLine command_line(CommandLine::NO_PROGRAM); |
293 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 314 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()); | 1490 ASSERT_EQ(1, tab_strip->count()); |
1470 EXPECT_EQ("title1.html", | 1491 EXPECT_EQ("title1.html", |
1471 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); | 1492 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); |
1472 } | 1493 } |
1473 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 1494 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
1474 | 1495 |
1475 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || | 1496 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || |
1476 // defined(ENABLE_CONFIGURATION_POLICY) | 1497 // defined(ENABLE_CONFIGURATION_POLICY) |
1477 | 1498 |
1478 #endif // !defined(OS_CHROMEOS) | 1499 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |