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

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

Issue 1417513003: [Extensions] Don't allow built-in extensions code to be overridden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Jochen's 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/bindings/externally_connectable_everywhere/manifest.json » ('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"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
12 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
13 #include "extensions/browser/extension_host.h" 15 #include "extensions/browser/extension_host.h"
14 #include "extensions/browser/process_manager.h" 16 #include "extensions/browser/process_manager.h"
15 #include "extensions/test/extension_test_message_listener.h" 17 #include "extensions/test/extension_test_message_listener.h"
16 #include "extensions/test/result_catcher.h" 18 #include "extensions/test/result_catcher.h"
19 #include "net/test/embedded_test_server/embedded_test_server.h"
17 20
18 namespace extensions { 21 namespace extensions {
19 namespace { 22 namespace {
20 23
21 class ExtensionBindingsApiTest : public ExtensionApiTest { 24 class ExtensionBindingsApiTest : public ExtensionApiTest {
22 public: 25 public:
23 void SetUpOnMainThread() override { 26 void SetUpOnMainThread() override {
24 content::BrowserThread::PostTask( 27 content::BrowserThread::PostTask(
25 content::BrowserThread::IO, FROM_HERE, 28 content::BrowserThread::IO, FROM_HERE,
26 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); 29 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, ApiEnums) { 107 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, ApiEnums) {
105 ASSERT_TRUE(RunExtensionTest("bindings/api_enums")) << message_; 108 ASSERT_TRUE(RunExtensionTest("bindings/api_enums")) << message_;
106 }; 109 };
107 110
108 // Regression test for http://crbug.com/504011 - proper access checks on 111 // Regression test for http://crbug.com/504011 - proper access checks on
109 // getModuleSystem(). 112 // getModuleSystem().
110 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, ModuleSystem) { 113 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, ModuleSystem) {
111 ASSERT_TRUE(RunExtensionTest("bindings/module_system")) << message_; 114 ASSERT_TRUE(RunExtensionTest("bindings/module_system")) << message_;
112 } 115 }
113 116
117 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoExportOverriding) {
118 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
119
120 // We need to create runtime bindings in the web page. An extension that's
121 // externally connectable will do that for us.
122 ASSERT_TRUE(LoadExtension(
123 test_data_dir_.AppendASCII("bindings")
124 .AppendASCII("externally_connectable_everywhere")));
125
126 ui_test_utils::NavigateToURL(
127 browser(),
128 embedded_test_server()->GetURL(
129 "/extensions/api_test/bindings/override_exports.html"));
130
131 // See chrome/test/data/extensions/api_test/bindings/override_exports.html.
132 std::string result;
133 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
134 browser()->tab_strip_model()->GetActiveWebContents(),
135 "window.domAutomationController.send("
136 "document.getElementById('status').textContent.trim());",
137 &result));
138 EXPECT_EQ("success", result);
139 }
140
114 } // namespace 141 } // namespace
115 } // namespace extensions 142 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/bindings/externally_connectable_everywhere/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698