| 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 "base/memory/scoped_ptr.h" |
| 5 #include "chrome/test/base/module_system_test.h" | 6 #include "chrome/test/base/module_system_test.h" |
| 6 #include "base/memory/scoped_ptr.h" | 7 #include "extensions/renderer/module_system.h" |
| 7 #include "chrome/renderer/extensions/module_system.h" | |
| 8 | 8 |
| 9 // TODO(cduvall/kalman): Put this file in extensions namespace. | 9 // TODO(cduvall/kalman): Put this file in extensions namespace. |
| 10 using extensions::ModuleSystem; | 10 using extensions::ModuleSystem; |
| 11 using extensions::NativeHandler; | 11 using extensions::NativeHandler; |
| 12 using extensions::ObjectBackedNativeHandler; | 12 using extensions::ObjectBackedNativeHandler; |
| 13 | 13 |
| 14 class CounterNatives : public ObjectBackedNativeHandler { | 14 class CounterNatives : public ObjectBackedNativeHandler { |
| 15 public: | 15 public: |
| 16 explicit CounterNatives(extensions::ChromeV8Context* context) | 16 explicit CounterNatives(extensions::ChromeV8Context* context) |
| 17 : ObjectBackedNativeHandler(context), counter_(0) { | 17 : ObjectBackedNativeHandler(context), counter_(0) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 TEST_F(ModuleSystemTest, TestOverrideNonExistentNativeHandler) { | 267 TEST_F(ModuleSystemTest, TestOverrideNonExistentNativeHandler) { |
| 268 ModuleSystem::NativesEnabledScope natives_enabled_scope( | 268 ModuleSystem::NativesEnabledScope natives_enabled_scope( |
| 269 context_->module_system()); | 269 context_->module_system()); |
| 270 OverrideNativeHandler("thing", "exports.x = 5;"); | 270 OverrideNativeHandler("thing", "exports.x = 5;"); |
| 271 RegisterModule("test", | 271 RegisterModule("test", |
| 272 "var assert = requireNative('assert');" | 272 "var assert = requireNative('assert');" |
| 273 "assert.AssertTrue(requireNative('thing').x == 5);"); | 273 "assert.AssertTrue(requireNative('thing').x == 5);"); |
| 274 context_->module_system()->Require("test"); | 274 context_->module_system()->Require("test"); |
| 275 } | 275 } |
| OLD | NEW |