| 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 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 1557 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
| 1558 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 1558 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
| 1559 const Extension* extension_app = GetExtension(); | 1559 const Extension* extension_app = GetExtension(); |
| 1560 | 1560 |
| 1561 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. | 1561 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. |
| 1562 WebContents* app_window = | 1562 WebContents* app_window = |
| 1563 application_launch::OpenApplication(browser()->profile(), | 1563 application_launch::OpenApplication(browser()->profile(), |
| 1564 extension_app, | 1564 extension_app, |
| 1565 extension_misc::LAUNCH_WINDOW, | 1565 extension_misc::LAUNCH_WINDOW, |
| 1566 GURL(), | 1566 GURL(), |
| 1567 NEW_WINDOW); | 1567 NEW_WINDOW, |
| 1568 NULL); |
| 1568 ASSERT_TRUE(app_window); | 1569 ASSERT_TRUE(app_window); |
| 1569 | 1570 |
| 1570 // Apps launched in a window from the NTP do not have extension_app set in | 1571 // Apps launched in a window from the NTP do not have extension_app set in |
| 1571 // tab contents. | 1572 // tab contents. |
| 1572 TabContentsWrapper* wrapper = | 1573 TabContentsWrapper* wrapper = |
| 1573 TabContentsWrapper::GetCurrentWrapperForContents(app_window); | 1574 TabContentsWrapper::GetCurrentWrapperForContents(app_window); |
| 1574 EXPECT_FALSE(wrapper->extension_tab_helper()->extension_app()); | 1575 EXPECT_FALSE(wrapper->extension_tab_helper()->extension_app()); |
| 1575 EXPECT_EQ(extension_app->GetFullLaunchURL(), app_window->GetURL()); | 1576 EXPECT_EQ(extension_app->GetFullLaunchURL(), app_window->GetURL()); |
| 1576 | 1577 |
| 1577 // The launch should have created a new browser. | 1578 // The launch should have created a new browser. |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 2140 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
| 2140 } | 2141 } |
| 2141 }; | 2142 }; |
| 2142 | 2143 |
| 2143 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 2144 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
| 2144 // Test that an application browser window loads correctly. | 2145 // Test that an application browser window loads correctly. |
| 2145 | 2146 |
| 2146 // Verify the browser is in application mode. | 2147 // Verify the browser is in application mode. |
| 2147 EXPECT_TRUE(browser()->IsApplication()); | 2148 EXPECT_TRUE(browser()->IsApplication()); |
| 2148 } | 2149 } |
| OLD | NEW |