| 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/extensions/module_system.h" | 7 #include "chrome/renderer/extensions/module_system.h" |
| 8 | 8 |
| 9 using extensions::ModuleSystem; | 9 using extensions::ModuleSystem; |
| 10 using extensions::NativeHandler; | 10 using extensions::NativeHandler; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 private: | 31 private: |
| 32 int counter_; | 32 int counter_; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class TestExceptionHandler : public ModuleSystem::ExceptionHandler { | 35 class TestExceptionHandler : public ModuleSystem::ExceptionHandler { |
| 36 public: | 36 public: |
| 37 TestExceptionHandler() | 37 TestExceptionHandler() |
| 38 : handled_exception_(false) { | 38 : handled_exception_(false) { |
| 39 } | 39 } |
| 40 | 40 |
| 41 virtual void HandleUncaughtException() { | 41 virtual void HandleUncaughtException() OVERRIDE { |
| 42 handled_exception_ = true; | 42 handled_exception_ = true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool handled_exception() const { return handled_exception_; } | 45 bool handled_exception() const { return handled_exception_; } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 bool handled_exception_; | 48 bool handled_exception_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 TEST_F(ModuleSystemTest, TestExceptionHandling) { | 51 TEST_F(ModuleSystemTest, TestExceptionHandling) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 | 253 |
| 254 TEST_F(ModuleSystemTest, TestOverrideNonExistentNativeHandler) { | 254 TEST_F(ModuleSystemTest, TestOverrideNonExistentNativeHandler) { |
| 255 ModuleSystem::NativesEnabledScope natives_enabled_scope(module_system_.get()); | 255 ModuleSystem::NativesEnabledScope natives_enabled_scope(module_system_.get()); |
| 256 OverrideNativeHandler("thing", "exports.x = 5;"); | 256 OverrideNativeHandler("thing", "exports.x = 5;"); |
| 257 RegisterModule("test", | 257 RegisterModule("test", |
| 258 "var assert = requireNative('assert');" | 258 "var assert = requireNative('assert');" |
| 259 "assert.AssertTrue(requireNative('thing').x == 5);"); | 259 "assert.AssertTrue(requireNative('thing').x == 5);"); |
| 260 module_system_->Require("test"); | 260 module_system_->Require("test"); |
| 261 } | 261 } |
| OLD | NEW |