| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" |
| 6 #include "extensions/renderer/module_system.h" | 6 #include "extensions/renderer/module_system.h" |
| 7 #include "extensions/renderer/module_system_test.h" | 7 #include "extensions/renderer/module_system_test.h" |
| 8 #include "gin/modules/module_registry.h" | 8 #include "gin/modules/module_registry.h" |
| 9 | 9 |
| 10 namespace extensions { | 10 namespace extensions { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 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() : handled_exception_(false) {} | 37 TestExceptionHandler() : handled_exception_(false) {} |
| 38 | 38 |
| 39 virtual void HandleUncaughtException(const v8::TryCatch& try_catch) override { | 39 void HandleUncaughtException(const v8::TryCatch& try_catch) override { |
| 40 handled_exception_ = true; | 40 handled_exception_ = true; |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool handled_exception() const { return handled_exception_; } | 43 bool handled_exception() const { return handled_exception_; } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 bool handled_exception_; | 46 bool handled_exception_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 TEST_F(ModuleSystemTest, TestExceptionHandling) { | 49 TEST_F(ModuleSystemTest, TestExceptionHandling) { |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 "});"); | 478 "});"); |
| 479 scoped_ptr<ModuleSystemTestEnvironment> other_env = CreateEnvironment(); | 479 scoped_ptr<ModuleSystemTestEnvironment> other_env = CreateEnvironment(); |
| 480 gin::ModuleRegistry::From(env()->context()->v8_context())->AddBuiltinModule( | 480 gin::ModuleRegistry::From(env()->context()->v8_context())->AddBuiltinModule( |
| 481 env()->isolate(), "natives", other_env->module_system()->NewInstance()); | 481 env()->isolate(), "natives", other_env->module_system()->NewInstance()); |
| 482 other_env->ShutdownModuleSystem(); | 482 other_env->ShutdownModuleSystem(); |
| 483 env()->module_system()->Require("test"); | 483 env()->module_system()->Require("test"); |
| 484 RunResolvedPromises(); | 484 RunResolvedPromises(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace extensions | 487 } // namespace extensions |
| OLD | NEW |