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

Side by Side Diff: extensions/renderer/utils_unittest.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 | « extensions/renderer/resources/web_request_internal_custom_bindings.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "extensions/renderer/module_system_test.h" 6 #include "extensions/renderer/module_system_test.h"
7 #include "gin/dictionary.h" 7 #include "gin/dictionary.h"
8 #include "grit/extensions_renderer_resources.h" 8 #include "grit/extensions_renderer_resources.h"
9 9
10 namespace extensions { 10 namespace extensions {
11 namespace { 11 namespace {
12 12
13 class UtilsUnittest : public ModuleSystemTest { 13 class UtilsUnittest : public ModuleSystemTest {
14 private: 14 private:
15 void SetUp() override { 15 void SetUp() override {
16 ModuleSystemTest::SetUp(); 16 ModuleSystemTest::SetUp();
17 17
18 env()->RegisterModule("utils", IDR_UTILS_JS); 18 env()->RegisterModule("utils", IDR_UTILS_JS);
19 env()->RegisterTestFile("utils_unittest", "utils_unittest.js"); 19 env()->RegisterTestFile("utils_unittest", "utils_unittest.js");
20 env()->OverrideNativeHandler("schema_registry", 20 env()->OverrideNativeHandler("schema_registry",
21 "exports.GetSchema = function() {};"); 21 "exports.$set('GetSchema', function() {});");
22 env()->OverrideNativeHandler("logging", 22 env()->OverrideNativeHandler("logging",
23 "exports.CHECK = function() {};\n" 23 "exports.$set('CHECK', function() {});\n"
24 "exports.DCHECK = function() {};\n" 24 "exports.$set('DCHECK', function() {});\n"
25 "exports.WARNING = function() {};"); 25 "exports.$set('WARNING', function() {});");
26 env()->OverrideNativeHandler("v8_context", ""); 26 env()->OverrideNativeHandler("v8_context", "");
27 gin::Dictionary chrome(env()->isolate(), env()->CreateGlobal("chrome")); 27 gin::Dictionary chrome(env()->isolate(), env()->CreateGlobal("chrome"));
28 gin::Dictionary chrome_runtime( 28 gin::Dictionary chrome_runtime(
29 gin::Dictionary::CreateEmpty(env()->isolate())); 29 gin::Dictionary::CreateEmpty(env()->isolate()));
30 chrome.Set("runtime", chrome_runtime); 30 chrome.Set("runtime", chrome_runtime);
31 } 31 }
32 }; 32 };
33 33
34 TEST_F(UtilsUnittest, TestNothing) { 34 TEST_F(UtilsUnittest, TestNothing) {
35 ExpectNoAssertionsMade(); 35 ExpectNoAssertionsMade();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 TEST_F(UtilsUnittest, PromiseError) { 68 TEST_F(UtilsUnittest, PromiseError) {
69 ModuleSystem::NativesEnabledScope natives_enabled_scope( 69 ModuleSystem::NativesEnabledScope natives_enabled_scope(
70 env()->module_system()); 70 env()->module_system());
71 env()->module_system()->CallModuleMethod("utils_unittest", 71 env()->module_system()->CallModuleMethod("utils_unittest",
72 "testPromiseError"); 72 "testPromiseError");
73 RunResolvedPromises(); 73 RunResolvedPromises();
74 } 74 }
75 75
76 } // namespace 76 } // namespace
77 } // namespace extensions 77 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/resources/web_request_internal_custom_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698