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

Unified Diff: extensions/renderer/native_extension_bindings_system_unittest.cc

Issue 2901383008: [Extenisons Bindings] Support `unmanaged` property for events (Closed)
Patch Set: rebase Created 3 years, 7 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/chrome_setting.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/native_extension_bindings_system_unittest.cc
diff --git a/extensions/renderer/native_extension_bindings_system_unittest.cc b/extensions/renderer/native_extension_bindings_system_unittest.cc
index b76fb63be509803198a2c6b1d3285020afafdea0..0378253606c765c0befd231fab94c16c240a8488 100644
--- a/extensions/renderer/native_extension_bindings_system_unittest.cc
+++ b/extensions/renderer/native_extension_bindings_system_unittest.cc
@@ -1019,4 +1019,34 @@ TEST_F(NativeExtensionBindingsSystemUnittest, TestUpdatingPermissions) {
}
}
+TEST_F(NativeExtensionBindingsSystemUnittest, UnmanagedEvents) {
+ InitEventChangeHandler();
+
+ scoped_refptr<Extension> extension =
+ CreateExtension("foo", ItemType::EXTENSION, std::vector<std::string>());
+ RegisterExtension(extension->id());
+
+ v8::HandleScope handle_scope(isolate());
+ v8::Local<v8::Context> context = MainContext();
+ ScriptContext* script_context = CreateScriptContext(
+ context, extension.get(), Feature::BLESSED_EXTENSION_CONTEXT);
+ script_context->set_url(extension->url());
+
+ bindings_system()->UpdateBindingsForContext(script_context);
+
+ const char kAddListeners[] =
+ "(function() {\n"
+ " chrome.runtime.onMessage.addListener(function() {});\n"
+ " chrome.runtime.onConnect.addListener(function() {});\n"
+ "});";
+
+ v8::Local<v8::Function> add_listeners =
+ FunctionFromString(context, kAddListeners);
+ RunFunctionOnGlobal(add_listeners, context, 0, nullptr);
+
+ // We should have no notifications for event listeners added (since the
+ // mock is a strict mock, this will fail if anything was called).
+ ::testing::Mock::VerifyAndClearExpectations(event_change_handler());
+}
+
} // namespace extensions
« no previous file with comments | « extensions/renderer/chrome_setting.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698