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

Unified Diff: extensions/renderer/event_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, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/api_test_base.cc ('k') | extensions/renderer/module_system.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/event_unittest.cc
diff --git a/extensions/renderer/event_unittest.cc b/extensions/renderer/event_unittest.cc
index 9d3b68f0014980dffae42b48e934db200af85446..59694623dcaad5e590c028b756b67ff57dc4ec87 100644
--- a/extensions/renderer/event_unittest.cc
+++ b/extensions/renderer/event_unittest.cc
@@ -25,45 +25,47 @@ class EventUnittest : public ModuleSystemTest {
env()->OverrideNativeHandler(
"event_natives",
"var assert = requireNative('assert');"
- "var attachedListeners = exports.attachedListeners = {};"
- "var attachedFilteredListeners = "
- " exports.attachedFilteredListeners = {};"
+ "exports.$set('attachedListeners', {});"
+ "var attachedListeners = exports.attachedListeners;"
+ "exports.$set('attachedFilteredListeners', {});"
+ "var attachedFilteredListeners = exports.attachedFilteredListeners;"
"var nextId = 0;"
"var idToName = {};"
- "exports.AttachEvent = function(eventName) {"
+ "exports.$set('AttachEvent', function(eventName) {"
" assert.AssertFalse(!!attachedListeners[eventName]);"
" attachedListeners[eventName] = 1;"
- "};"
- "exports.DetachEvent = function(eventName) {"
+ "});"
+ "exports.$set('DetachEvent', function(eventName) {"
" assert.AssertTrue(!!attachedListeners[eventName]);"
" delete attachedListeners[eventName];"
- "};"
- "exports.IsEventAttached = function(eventName) {"
+ "});"
+ "exports.$set('IsEventAttached', function(eventName) {"
" return !!attachedListeners[eventName];"
- "};"
- "exports.AttachFilteredEvent = function(name, filters) {"
+ "});"
+ "exports.$set('AttachFilteredEvent', function(name, filters) {"
" var id = nextId++;"
" idToName[id] = name;"
" attachedFilteredListeners[name] ="
" attachedFilteredListeners[name] || [];"
" attachedFilteredListeners[name][id] = filters;"
" return id;"
- "};"
- "exports.DetachFilteredEvent = function(id, manual) {"
+ "});"
+ "exports.$set('DetachFilteredEvent', function(id, manual) {"
" var i = attachedFilteredListeners[idToName[id]].indexOf(id);"
" attachedFilteredListeners[idToName[id]].splice(i, 1);"
- "};"
- "exports.HasFilteredListener = function(name) {"
+ "});"
+ "exports.$set('HasFilteredListener', function(name) {"
" return attachedFilteredListeners[name].length;"
- "};");
+ "});");
env()->OverrideNativeHandler("sendRequest",
- "exports.sendRequest = function() {};");
+ "exports.$set('sendRequest', function() {});");
env()->OverrideNativeHandler(
"apiDefinitions",
- "exports.GetExtensionAPIDefinitionsForTest = function() {};");
- env()->OverrideNativeHandler("logging", "exports.DCHECK = function() {};");
+ "exports.$set('GetExtensionAPIDefinitionsForTest', function() {});");
+ env()->OverrideNativeHandler("logging",
+ "exports.$set('DCHECK', function() {});");
env()->OverrideNativeHandler("schema_registry",
- "exports.GetSchema = function() {};");
+ "exports.$set('GetSchema', function() {});");
}
};
« no previous file with comments | « extensions/renderer/api_test_base.cc ('k') | extensions/renderer/module_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698