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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 #if !defined(OS_MACOSX) | 993 #if !defined(OS_MACOSX) |
994 IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { | 994 IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { |
995 ASSERT_TRUE(test_server()->Start()); | 995 ASSERT_TRUE(test_server()->Start()); |
996 | 996 |
997 // Load an app | 997 // Load an app |
998 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 998 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
999 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 999 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
1000 const Extension* extension_app = GetExtension(); | 1000 const Extension* extension_app = GetExtension(); |
1001 | 1001 |
1002 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. | 1002 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. |
1003 WebContents* app_window = | 1003 WebContents* app_window = application_launch::OpenApplication( |
1004 application_launch::OpenApplication(browser()->profile(), | 1004 application_launch::LaunchParams(browser()->profile(), extension_app, |
1005 extension_app, | 1005 extension_misc::LAUNCH_WINDOW, |
1006 extension_misc::LAUNCH_WINDOW, | 1006 NEW_WINDOW)); |
1007 GURL(), | |
1008 NEW_WINDOW, | |
1009 NULL); | |
1010 ASSERT_TRUE(app_window); | 1007 ASSERT_TRUE(app_window); |
1011 | 1008 |
1012 // Apps launched in a window from the NTP do not have extension_app set in | 1009 // Apps launched in a window from the NTP do not have extension_app set in |
1013 // tab contents. | 1010 // tab contents. |
1014 TabContents* tab_contents = TabContents::FromWebContents(app_window); | 1011 TabContents* tab_contents = TabContents::FromWebContents(app_window); |
1015 EXPECT_FALSE(tab_contents->extension_tab_helper()->extension_app()); | 1012 EXPECT_FALSE(tab_contents->extension_tab_helper()->extension_app()); |
1016 EXPECT_EQ(extension_app->GetFullLaunchURL(), app_window->GetURL()); | 1013 EXPECT_EQ(extension_app->GetFullLaunchURL(), app_window->GetURL()); |
1017 | 1014 |
1018 // The launch should have created a new browser. | 1015 // The launch should have created a new browser. |
1019 ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); | 1016 ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 1585 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
1589 } | 1586 } |
1590 }; | 1587 }; |
1591 | 1588 |
1592 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 1589 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
1593 // Test that an application browser window loads correctly. | 1590 // Test that an application browser window loads correctly. |
1594 | 1591 |
1595 // Verify the browser is in application mode. | 1592 // Verify the browser is in application mode. |
1596 EXPECT_TRUE(browser()->IsApplication()); | 1593 EXPECT_TRUE(browser()->IsApplication()); |
1597 } | 1594 } |
OLD | NEW |