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

Unified Diff: extensions/renderer/event_unittest.cc

Issue 1074273002: Move the event attach/detach logic on unload from event.js to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: being process of relanding - more test assertions Created 5 years, 8 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/event_bindings.cc ('k') | extensions/renderer/module_system.h » ('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 4144a01b0fa20aca037988e9f2c61ba49ffed656..9d3b68f0014980dffae42b48e934db200af85446 100644
--- a/extensions/renderer/event_unittest.cc
+++ b/extensions/renderer/event_unittest.cc
@@ -18,7 +18,6 @@ class EventUnittest : public ModuleSystemTest {
env()->RegisterModule(kSchemaUtils, IDR_SCHEMA_UTILS_JS);
env()->RegisterModule("uncaught_exception_handler",
IDR_UNCAUGHT_EXCEPTION_HANDLER_JS);
- env()->RegisterModule("unload_event", IDR_UNLOAD_EVENT_JS);
env()->RegisterModule("utils", IDR_UTILS_JS);
// Mock out the native handler for event_bindings. These mocks will fail if
@@ -92,41 +91,6 @@ TEST_F(EventUnittest, AddRemoveTwoListeners) {
env()->module_system()->Require("test");
}
-TEST_F(EventUnittest, OnUnloadDetachesAllListeners) {
- ModuleSystem::NativesEnabledScope natives_enabled_scope(
- env()->module_system());
- env()->RegisterModule(
- "test",
- "var assert = requireNative('assert');"
- "var Event = require('event_bindings').Event;"
- "var eventNatives = requireNative('event_natives');"
- "var myEvent = new Event('named-event');"
- "var cb1 = function() {};"
- "var cb2 = function() {};"
- "myEvent.addListener(cb1);"
- "myEvent.addListener(cb2);"
- "require('unload_event').dispatch();"
- "assert.AssertFalse(!!eventNatives.attachedListeners['named-event']);");
- env()->module_system()->Require("test");
-}
-
-TEST_F(EventUnittest, OnUnloadDetachesAllListenersEvenDupes) {
- ModuleSystem::NativesEnabledScope natives_enabled_scope(
- env()->module_system());
- env()->RegisterModule(
- "test",
- "var assert = requireNative('assert');"
- "var Event = require('event_bindings').Event;"
- "var eventNatives = requireNative('event_natives');"
- "var myEvent = new Event('named-event');"
- "var cb1 = function() {};"
- "myEvent.addListener(cb1);"
- "myEvent.addListener(cb1);"
- "require('unload_event').dispatch();"
- "assert.AssertFalse(!!eventNatives.attachedListeners['named-event']);");
- env()->module_system()->Require("test");
-}
-
TEST_F(EventUnittest, EventsThatSupportRulesMustHaveAName) {
ModuleSystem::NativesEnabledScope natives_enabled_scope(
env()->module_system());
« no previous file with comments | « extensions/renderer/event_bindings.cc ('k') | extensions/renderer/module_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698