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

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

Issue 1748943002: [Extensions] Harden against bindings interception (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/bindings/function_interceptions.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Contains holistic tests of the bindings infrastructure 5 // Contains holistic tests of the bindings infrastructure
6 6
7 #include "chrome/browser/extensions/api/permissions/permissions_api.h" 7 #include "chrome/browser/extensions/api/permissions/permissions_api.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/net/url_request_mock_util.h" 9 #include "chrome/browser/net/url_request_mock_util.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // See handler_function_type_checking.html. 176 // See handler_function_type_checking.html.
177 std::string result; 177 std::string result;
178 EXPECT_TRUE(content::ExecuteScriptAndExtractString( 178 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
179 web_contents, 179 web_contents,
180 "window.domAutomationController.send(" 180 "window.domAutomationController.send("
181 "document.getElementById('status').textContent.trim());", 181 "document.getElementById('status').textContent.trim());",
182 &result)); 182 &result));
183 EXPECT_EQ("success", result); 183 EXPECT_EQ("success", result);
184 } 184 }
185 185
186 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
187 MoreNativeFunctionInterceptionTests) {
188 ASSERT_TRUE(embedded_test_server()->Start());
189
190 // We need to create runtime bindings in the web page. An extension that's
191 // externally connectable will do that for us.
192 ASSERT_TRUE(
193 LoadExtension(test_data_dir_.AppendASCII("bindings")
194 .AppendASCII("externally_connectable_everywhere")));
195
196 ui_test_utils::NavigateToURL(
197 browser(),
198 embedded_test_server()->GetURL(
199 "/extensions/api_test/bindings/function_interceptions.html"));
200 content::WebContents* web_contents =
201 browser()->tab_strip_model()->GetActiveWebContents();
202 EXPECT_FALSE(web_contents->IsCrashed());
203 // See function_interceptions.html.
204 std::string result;
205 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
206 web_contents, "window.domAutomationController.send(window.testStatus);",
207 &result));
208 EXPECT_EQ("success", result);
209 }
210
186 } // namespace 211 } // namespace
187 } // namespace extensions 212 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/bindings/function_interceptions.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698