Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/extensions/extension_nacl_browsertest.cc

Issue 11753009: Simplify ExecuteJavaScript* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update prerender_browsertest.cc. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = chrome::GetActiveWebContents(browser());
105 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 105 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
106 web_contents->GetRenderViewHost(), 106 web_contents,
107 "",
108 "window.domAutomationController.send(EmbeddedPluginCreated());", 107 "window.domAutomationController.send(EmbeddedPluginCreated());",
109 &embedded_plugin_created)); 108 &embedded_plugin_created));
110 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 109 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
111 web_contents->GetRenderViewHost(), 110 web_contents,
112 "",
113 "window.domAutomationController.send(ContentHandlerPluginCreated());", 111 "window.domAutomationController.send(ContentHandlerPluginCreated());",
114 &content_handler_plugin_created)); 112 &content_handler_plugin_created));
115 113
116 EXPECT_EQ(should_create, embedded_plugin_created); 114 EXPECT_EQ(should_create, embedded_plugin_created);
117 EXPECT_EQ(should_create, content_handler_plugin_created); 115 EXPECT_EQ(should_create, content_handler_plugin_created);
118 } 116 }
119 }; 117 };
120 118
121 // Test that the NaCl plugin isn't blocked for Webstore extensions. 119 // Test that the NaCl plugin isn't blocked for Webstore extensions.
122 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, WebStoreExtension) { 120 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, WebStoreExtension) {
(...skipping 27 matching lines...) Expand all
150 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { 148 IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) {
151 ASSERT_TRUE(test_server()->Start()); 149 ASSERT_TRUE(test_server()->Start());
152 150
153 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); 151 const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED);
154 ASSERT_TRUE(extension); 152 ASSERT_TRUE(extension);
155 ASSERT_EQ(extension->location(), Extension::LOAD); 153 ASSERT_EQ(extension->location(), Extension::LOAD);
156 CheckPluginsCreated(extension, true); 154 CheckPluginsCreated(extension, true);
157 } 155 }
158 156
159 } // namespace 157 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698