OLD | NEW |
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 #include "chrome/test/base/module_system_test.h" | 5 #include "chrome/test/base/module_system_test.h" |
6 | 6 |
| 7 #include "extensions/common/extension_urls.h" |
7 #include "grit/renderer_resources.h" | 8 #include "grit/renderer_resources.h" |
8 | 9 |
9 namespace extensions { | 10 namespace extensions { |
10 namespace { | 11 namespace { |
11 | 12 |
12 class EventUnittest : public ModuleSystemTest { | 13 class EventUnittest : public ModuleSystemTest { |
13 virtual void SetUp() OVERRIDE { | 14 virtual void SetUp() OVERRIDE { |
14 ModuleSystemTest::SetUp(); | 15 ModuleSystemTest::SetUp(); |
15 | 16 |
16 RegisterModule("event_bindings", IDR_EVENT_BINDINGS_JS); | 17 RegisterModule(kEventBindings, IDR_EVENT_BINDINGS_JS); |
17 RegisterModule("json_schema", IDR_JSON_SCHEMA_JS); | 18 RegisterModule("json_schema", IDR_JSON_SCHEMA_JS); |
18 RegisterModule("schemaUtils", IDR_SCHEMA_UTILS_JS); | 19 RegisterModule(kSchemaUtils, IDR_SCHEMA_UTILS_JS); |
19 RegisterModule("unload_event", IDR_UNLOAD_EVENT_JS); | 20 RegisterModule("unload_event", IDR_UNLOAD_EVENT_JS); |
20 RegisterModule("utils", IDR_UTILS_JS); | 21 RegisterModule("utils", IDR_UTILS_JS); |
21 | 22 |
22 // Mock out the native handler for event_bindings. These mocks will fail if | 23 // Mock out the native handler for event_bindings. These mocks will fail if |
23 // any invariants maintained by the real event_bindings are broken. | 24 // any invariants maintained by the real event_bindings are broken. |
24 OverrideNativeHandler("event_natives", | 25 OverrideNativeHandler("event_natives", |
25 "var assert = requireNative('assert');" | 26 "var assert = requireNative('assert');" |
26 "var attachedListeners = exports.attachedListeners = {};" | 27 "var attachedListeners = exports.attachedListeners = {};" |
27 "var attachedFilteredListeners = " | 28 "var attachedFilteredListeners = " |
28 " exports.attachedFilteredListeners = {};" | 29 " exports.attachedFilteredListeners = {};" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 " e.addListener(cb);" | 267 " e.addListener(cb);" |
267 "} catch (e) {" | 268 "} catch (e) {" |
268 " caught = true;" | 269 " caught = true;" |
269 "}" | 270 "}" |
270 "assert.AssertTrue(caught);"); | 271 "assert.AssertTrue(caught);"); |
271 module_system_->Require("test"); | 272 module_system_->Require("test"); |
272 } | 273 } |
273 | 274 |
274 } // namespace | 275 } // namespace |
275 } // namespace extensions | 276 } // namespace extensions |
OLD | NEW |