| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_apitest.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_apitest.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "apps/launcher.h" |
| 9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 14 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
| 15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 16 #include "components/guest_view/browser/guest_view_manager.h" | 17 #include "components/guest_view/browser/guest_view_manager.h" |
| 17 #include "components/guest_view/browser/guest_view_manager_delegate.h" | 18 #include "components/guest_view/browser/guest_view_manager_delegate.h" |
| 18 #include "components/guest_view/browser/guest_view_manager_factory.h" | 19 #include "components/guest_view/browser/guest_view_manager_factory.h" |
| 19 #include "components/guest_view/browser/test_guest_view_manager.h" | 20 #include "components/guest_view/browser/test_guest_view_manager.h" |
| 20 #include "content/public/browser/render_process_host.h" | 21 #include "content/public/browser/render_process_host.h" |
| 21 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
| 23 #include "content/public/test/test_renderer_host.h" | 24 #include "content/public/test/test_renderer_host.h" |
| 24 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
| 25 #include "extensions/browser/api/extensions_api_client.h" | 26 #include "extensions/browser/api/extensions_api_client.h" |
| 26 #include "extensions/browser/api/test/test_api.h" | 27 #include "extensions/browser/api/test/test_api.h" |
| 27 #include "extensions/browser/app_window/app_window.h" | 28 #include "extensions/browser/app_window/app_window.h" |
| 28 #include "extensions/browser/app_window/app_window_registry.h" | 29 #include "extensions/browser/app_window/app_window_registry.h" |
| 29 #include "extensions/browser/process_manager.h" | 30 #include "extensions/browser/process_manager.h" |
| 31 #include "extensions/common/constants.h" |
| 30 #include "extensions/common/extension.h" | 32 #include "extensions/common/extension.h" |
| 31 #include "extensions/common/extension_paths.h" | 33 #include "extensions/common/extension_paths.h" |
| 32 #include "extensions/common/switches.h" | 34 #include "extensions/common/switches.h" |
| 33 #include "extensions/shell/browser/desktop_controller.h" | 35 #include "extensions/shell/browser/desktop_controller.h" |
| 34 #include "extensions/shell/browser/shell_content_browser_client.h" | 36 #include "extensions/shell/browser/shell_content_browser_client.h" |
| 35 #include "extensions/shell/browser/shell_extension_system.h" | 37 #include "extensions/shell/browser/shell_extension_system.h" |
| 36 #include "extensions/shell/test/shell_test.h" | 38 #include "extensions/shell/test/shell_test.h" |
| 37 #include "extensions/test/extension_test_message_listener.h" | 39 #include "extensions/test/extension_test_message_listener.h" |
| 38 #include "net/base/filename_util.h" | 40 #include "net/base/filename_util.h" |
| 39 #include "net/test/embedded_test_server/embedded_test_server.h" | 41 #include "net/test/embedded_test_server/embedded_test_server.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 base::ThreadRestrictions::ScopedAllowIO allow_io; | 143 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 142 base::FilePath test_data_dir; | 144 base::FilePath test_data_dir; |
| 143 PathService::Get(DIR_TEST_DATA, &test_data_dir); | 145 PathService::Get(DIR_TEST_DATA, &test_data_dir); |
| 144 test_data_dir = test_data_dir.AppendASCII(app_location.c_str()); | 146 test_data_dir = test_data_dir.AppendASCII(app_location.c_str()); |
| 145 | 147 |
| 146 test_config_.SetString(kTestDataDirectory, | 148 test_config_.SetString(kTestDataDirectory, |
| 147 net::FilePathToFileURL(test_data_dir).spec()); | 149 net::FilePathToFileURL(test_data_dir).spec()); |
| 148 | 150 |
| 149 const Extension* extension = extension_system_->LoadApp(test_data_dir); | 151 const Extension* extension = extension_system_->LoadApp(test_data_dir); |
| 150 ASSERT_TRUE(extension); | 152 ASSERT_TRUE(extension); |
| 151 extension_system_->LaunchApp(extension->id()); | 153 apps::LaunchPlatformApp(browser_context_, extension, |
| 154 extensions::SOURCE_UNTRACKED); |
| 152 | 155 |
| 153 ExtensionTestMessageListener launch_listener("LAUNCHED", false); | 156 ExtensionTestMessageListener launch_listener("LAUNCHED", false); |
| 154 launch_listener.set_failure_message("FAILURE"); | 157 launch_listener.set_failure_message("FAILURE"); |
| 155 ASSERT_TRUE(launch_listener.WaitUntilSatisfied()); | 158 ASSERT_TRUE(launch_listener.WaitUntilSatisfied()); |
| 156 | 159 |
| 157 embedder_web_contents_ = GetFirstAppWindowWebContents(); | 160 embedder_web_contents_ = GetFirstAppWindowWebContents(); |
| 158 } | 161 } |
| 159 | 162 |
| 160 content::WebContents* WebViewAPITest::GetFirstAppWindowWebContents() { | 163 content::WebContents* WebViewAPITest::GetFirstAppWindowWebContents() { |
| 161 const AppWindowRegistry::AppWindowList& app_window_list = | 164 const AppWindowRegistry::AppWindowList& app_window_list = |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 // This test verifies that webview.contentWindow works inside an iframe | 763 // This test verifies that webview.contentWindow works inside an iframe |
| 761 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebViewInsideFrame) { | 764 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebViewInsideFrame) { |
| 762 LaunchApp("web_view/inside_iframe"); | 765 LaunchApp("web_view/inside_iframe"); |
| 763 } | 766 } |
| 764 | 767 |
| 765 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestCaptureVisibleRegion) { | 768 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestCaptureVisibleRegion) { |
| 766 RunTest("testCaptureVisibleRegion", "web_view/apitest"); | 769 RunTest("testCaptureVisibleRegion", "web_view/apitest"); |
| 767 } | 770 } |
| 768 | 771 |
| 769 } // namespace extensions | 772 } // namespace extensions |
| OLD | NEW |