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 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "chrome/renderer/module_system.h" | 7 #include "chrome/renderer/extensions/module_system.h" |
| 8 |
| 9 using extensions::ModuleSystem; |
| 10 using extensions::NativeHandler; |
8 | 11 |
9 class CounterNatives : public NativeHandler { | 12 class CounterNatives : public NativeHandler { |
10 public: | 13 public: |
11 CounterNatives() : counter_(0) { | 14 CounterNatives() : counter_(0) { |
12 RouteFunction("Get", base::Bind(&CounterNatives::Get, | 15 RouteFunction("Get", base::Bind(&CounterNatives::Get, |
13 base::Unretained(this))); | 16 base::Unretained(this))); |
14 RouteFunction("Increment", base::Bind(&CounterNatives::Increment, | 17 RouteFunction("Increment", base::Bind(&CounterNatives::Increment, |
15 base::Unretained(this))); | 18 base::Unretained(this))); |
16 } | 19 } |
17 | 20 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 221 } |
219 | 222 |
220 TEST_F(ModuleSystemTest, TestOverrideNonExistentNativeHandler) { | 223 TEST_F(ModuleSystemTest, TestOverrideNonExistentNativeHandler) { |
221 ModuleSystem::NativesEnabledScope natives_enabled_scope(module_system_.get()); | 224 ModuleSystem::NativesEnabledScope natives_enabled_scope(module_system_.get()); |
222 OverrideNativeHandler("thing", "exports.x = 5;"); | 225 OverrideNativeHandler("thing", "exports.x = 5;"); |
223 RegisterModule("test", | 226 RegisterModule("test", |
224 "var assert = requireNative('assert');" | 227 "var assert = requireNative('assert');" |
225 "assert.AssertTrue(requireNative('thing').x == 5);"); | 228 "assert.AssertTrue(requireNative('thing').x == 5);"); |
226 module_system_->Require("test"); | 229 module_system_->Require("test"); |
227 } | 230 } |
OLD | NEW |