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/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/crx_installer.h" | 9 #include "chrome/browser/extensions/crx_installer.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
19 #include "content/public/browser/plugin_service.h" | 20 #include "content/public/browser/plugin_service.h" |
20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
21 #include "webkit/plugins/webplugininfo.h" | 22 #include "webkit/plugins/webplugininfo.h" |
22 | 23 |
23 using content::PluginService; | 24 using content::PluginService; |
24 using content::WebContents; | 25 using content::WebContents; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 void CheckPluginsCreated(const Extension* extension, bool should_create) { | 94 void CheckPluginsCreated(const Extension* extension, bool should_create) { |
94 ui_test_utils::NavigateToURL(browser(), | 95 ui_test_utils::NavigateToURL(browser(), |
95 extension->GetResourceURL("test.html")); | 96 extension->GetResourceURL("test.html")); |
96 // Don't run tests if the NaCl plugin isn't loaded. | 97 // Don't run tests if the NaCl plugin isn't loaded. |
97 if (!IsNaClPluginLoaded()) | 98 if (!IsNaClPluginLoaded()) |
98 return; | 99 return; |
99 | 100 |
100 bool embedded_plugin_created = false; | 101 bool embedded_plugin_created = false; |
101 bool content_handler_plugin_created = false; | 102 bool content_handler_plugin_created = false; |
102 WebContents* web_contents = browser()->GetActiveWebContents(); | 103 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
103 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 104 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
104 web_contents->GetRenderViewHost(), L"", | 105 web_contents->GetRenderViewHost(), L"", |
105 L"window.domAutomationController.send(EmbeddedPluginCreated());", | 106 L"window.domAutomationController.send(EmbeddedPluginCreated());", |
106 &embedded_plugin_created)); | 107 &embedded_plugin_created)); |
107 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 108 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
108 web_contents->GetRenderViewHost(), L"", | 109 web_contents->GetRenderViewHost(), L"", |
109 L"window.domAutomationController.send(ContentHandlerPluginCreated());", | 110 L"window.domAutomationController.send(ContentHandlerPluginCreated());", |
110 &content_handler_plugin_created)); | 111 &content_handler_plugin_created)); |
111 | 112 |
112 EXPECT_EQ(should_create, embedded_plugin_created); | 113 EXPECT_EQ(should_create, embedded_plugin_created); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { | 147 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { |
147 ASSERT_TRUE(test_server()->Start()); | 148 ASSERT_TRUE(test_server()->Start()); |
148 | 149 |
149 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); | 150 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); |
150 ASSERT_TRUE(extension); | 151 ASSERT_TRUE(extension); |
151 ASSERT_EQ(extension->location(), Extension::LOAD); | 152 ASSERT_EQ(extension->location(), Extension::LOAD); |
152 CheckPluginsCreated(extension, true); | 153 CheckPluginsCreated(extension, true); |
153 } | 154 } |
154 | 155 |
155 } // namespace | 156 } // namespace |
OLD | NEW |