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

Unified Diff: chrome/browser/extensions/extension_bindings_apitest.cc

Issue 1433293004: [Extensions] Don't allow gin::Define to be overridden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/bindings/override_gin_define.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_bindings_apitest.cc
diff --git a/chrome/browser/extensions/extension_bindings_apitest.cc b/chrome/browser/extensions/extension_bindings_apitest.cc
index 81e9b926daef425391532fc3d42752084dc67c58..d99e574ffb78f3034d52e1810b3ebb61151e82f4 100644
--- a/chrome/browser/extensions/extension_bindings_apitest.cc
+++ b/chrome/browser/extensions/extension_bindings_apitest.cc
@@ -138,6 +138,32 @@ IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoExportOverriding) {
EXPECT_EQ("success", result);
}
+IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoGinDefineOverriding) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ // We need to create runtime bindings in the web page. An extension that's
+ // externally connectable will do that for us.
+ ASSERT_TRUE(LoadExtension(
+ test_data_dir_.AppendASCII("bindings")
+ .AppendASCII("externally_connectable_everywhere")));
+
+ ui_test_utils::NavigateToURL(
+ browser(),
+ embedded_test_server()->GetURL(
+ "/extensions/api_test/bindings/override_gin_define.html"));
+ ASSERT_FALSE(
+ browser()->tab_strip_model()->GetActiveWebContents()->IsCrashed());
+
+ // See chrome/test/data/extensions/api_test/bindings/override_gin_define.html.
+ std::string result;
+ EXPECT_TRUE(content::ExecuteScriptAndExtractString(
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ "window.domAutomationController.send("
+ "document.getElementById('status').textContent.trim());",
+ &result));
+ EXPECT_EQ("success", result);
+}
+
IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, HandlerFunctionTypeChecking) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
ui_test_utils::NavigateToURL(
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/bindings/override_gin_define.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698