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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/crx_installer.h" | 10 #include "chrome/browser/extensions/crx_installer.h" |
11 #include "chrome/browser/extensions/extension_browsertest.h" | 11 #include "chrome/browser/extensions/extension_browsertest.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/extension_system.h" | 13 #include "chrome/browser/extensions/extension_system.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
21 #include "content/public/browser/plugin_service.h" | 21 #include "content/public/browser/plugin_service.h" |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/common/webplugininfo.h" |
23 #include "content/public/test/browser_test_utils.h" | 24 #include "content/public/test/browser_test_utils.h" |
24 #include "net/dns/mock_host_resolver.h" | 25 #include "net/dns/mock_host_resolver.h" |
25 #include "webkit/plugins/webplugininfo.h" | |
26 | 26 |
27 using content::PluginService; | 27 using content::PluginService; |
28 using content::WebContents; | 28 using content::WebContents; |
29 using extensions::Extension; | 29 using extensions::Extension; |
30 using extensions::Manifest; | 30 using extensions::Manifest; |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 const char* kExtensionId = "bjjcibdiodkkeanflmiijlcfieiemced"; | 34 const char* kExtensionId = "bjjcibdiodkkeanflmiijlcfieiemced"; |
35 | 35 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 const Extension* InstallHostedApp() { | 101 const Extension* InstallHostedApp() { |
102 base::FilePath file_path = test_data_dir_.AppendASCII( | 102 base::FilePath file_path = test_data_dir_.AppendASCII( |
103 "native_client_hosted_app"); | 103 "native_client_hosted_app"); |
104 return InstallExtension(file_path, INSTALL_TYPE_FROM_WEBSTORE); | 104 return InstallExtension(file_path, INSTALL_TYPE_FROM_WEBSTORE); |
105 } | 105 } |
106 | 106 |
107 bool IsNaClPluginLoaded() { | 107 bool IsNaClPluginLoaded() { |
108 base::FilePath path; | 108 base::FilePath path; |
109 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 109 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
110 webkit::WebPluginInfo info; | 110 content::WebPluginInfo info; |
111 return PluginService::GetInstance()->GetPluginInfoByPath(path, &info); | 111 return PluginService::GetInstance()->GetPluginInfoByPath(path, &info); |
112 } | 112 } |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 void CheckPluginsCreated(const GURL& url, PluginType expected_to_succeed) { | 116 void CheckPluginsCreated(const GURL& url, PluginType expected_to_succeed) { |
117 ui_test_utils::NavigateToURL(browser(), url); | 117 ui_test_utils::NavigateToURL(browser(), url); |
118 // Don't run tests if the NaCl plugin isn't loaded. | 118 // Don't run tests if the NaCl plugin isn't loaded. |
119 if (!IsNaClPluginLoaded()) | 119 if (!IsNaClPluginLoaded()) |
120 return; | 120 return; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 replace_host.SetHostStr(host_str); | 207 replace_host.SetHostStr(host_str); |
208 replace_host.ClearPort(); | 208 replace_host.ClearPort(); |
209 url = url.ReplaceComponents(replace_host); | 209 url = url.ReplaceComponents(replace_host); |
210 | 210 |
211 const Extension* extension = InstallHostedApp(); | 211 const Extension* extension = InstallHostedApp(); |
212 ASSERT_TRUE(extension); | 212 ASSERT_TRUE(extension); |
213 CheckPluginsCreated(url, PLUGIN_TYPE_ALL); | 213 CheckPluginsCreated(url, PLUGIN_TYPE_ALL); |
214 } | 214 } |
215 | 215 |
216 } // namespace | 216 } // namespace |
OLD | NEW |