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/extensions/extension_system.h" | 12 #include "chrome/browser/extensions/extension_system.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.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/browser_tabstrip.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/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
24 #include "webkit/plugins/webplugininfo.h" | 24 #include "webkit/plugins/webplugininfo.h" |
25 | 25 |
26 using content::PluginService; | 26 using content::PluginService; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void CheckPluginsCreated(const Extension* extension, bool should_create) { | 95 void CheckPluginsCreated(const Extension* extension, bool should_create) { |
96 ui_test_utils::NavigateToURL(browser(), | 96 ui_test_utils::NavigateToURL(browser(), |
97 extension->GetResourceURL("test.html")); | 97 extension->GetResourceURL("test.html")); |
98 // Don't run tests if the NaCl plugin isn't loaded. | 98 // Don't run tests if the NaCl plugin isn't loaded. |
99 if (!IsNaClPluginLoaded()) | 99 if (!IsNaClPluginLoaded()) |
100 return; | 100 return; |
101 | 101 |
102 bool embedded_plugin_created = false; | 102 bool embedded_plugin_created = false; |
103 bool content_handler_plugin_created = false; | 103 bool content_handler_plugin_created = false; |
104 WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 104 WebContents* web_contents = |
| 105 browser()->tab_strip_model()->GetActiveWebContents(); |
105 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 106 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
106 web_contents, | 107 web_contents, |
107 "window.domAutomationController.send(EmbeddedPluginCreated());", | 108 "window.domAutomationController.send(EmbeddedPluginCreated());", |
108 &embedded_plugin_created)); | 109 &embedded_plugin_created)); |
109 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 110 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
110 web_contents, | 111 web_contents, |
111 "window.domAutomationController.send(ContentHandlerPluginCreated());", | 112 "window.domAutomationController.send(ContentHandlerPluginCreated());", |
112 &content_handler_plugin_created)); | 113 &content_handler_plugin_created)); |
113 | 114 |
114 EXPECT_EQ(should_create, embedded_plugin_created); | 115 EXPECT_EQ(should_create, embedded_plugin_created); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { | 149 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { |
149 ASSERT_TRUE(test_server()->Start()); | 150 ASSERT_TRUE(test_server()->Start()); |
150 | 151 |
151 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); | 152 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); |
152 ASSERT_TRUE(extension); | 153 ASSERT_TRUE(extension); |
153 ASSERT_EQ(extension->location(), Extension::LOAD); | 154 ASSERT_EQ(extension->location(), Extension::LOAD); |
154 CheckPluginsCreated(extension, true); | 155 CheckPluginsCreated(extension, true); |
155 } | 156 } |
156 | 157 |
157 } // namespace | 158 } // namespace |
OLD | NEW |