| 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 #ifndef EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ | 5 #ifndef EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ |
| 6 #define EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ | 6 #define EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ |
| 7 | 7 |
| 8 #include "extensions/renderer/module_system.h" | 8 #include "extensions/renderer/module_system.h" |
| 9 #include "extensions/renderer/scoped_persistent.h" | 9 #include "extensions/renderer/scoped_persistent.h" |
| 10 #include "extensions/renderer/script_context.h" | 10 #include "extensions/renderer/script_context.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // module_system_->Require("test"); | 74 // module_system_->Require("test"); |
| 75 // } | 75 // } |
| 76 // | 76 // |
| 77 // By default a test will fail if no method in the native module 'assert' is | 77 // By default a test will fail if no method in the native module 'assert' is |
| 78 // called. This behaviour can be overridden by calling ExpectNoAssertionsMade(). | 78 // called. This behaviour can be overridden by calling ExpectNoAssertionsMade(). |
| 79 class ModuleSystemTest : public testing::Test { | 79 class ModuleSystemTest : public testing::Test { |
| 80 public: | 80 public: |
| 81 ModuleSystemTest(); | 81 ModuleSystemTest(); |
| 82 virtual ~ModuleSystemTest(); | 82 virtual ~ModuleSystemTest(); |
| 83 | 83 |
| 84 virtual void SetUp() OVERRIDE; | 84 virtual void SetUp() override; |
| 85 virtual void TearDown() OVERRIDE; | 85 virtual void TearDown() override; |
| 86 | 86 |
| 87 protected: | 87 protected: |
| 88 ModuleSystemTestEnvironment* env() { return env_.get(); } | 88 ModuleSystemTestEnvironment* env() { return env_.get(); } |
| 89 | 89 |
| 90 scoped_ptr<ModuleSystemTestEnvironment> CreateEnvironment(); | 90 scoped_ptr<ModuleSystemTestEnvironment> CreateEnvironment(); |
| 91 | 91 |
| 92 // Make the test fail if any asserts are called. By default a test will fail | 92 // Make the test fail if any asserts are called. By default a test will fail |
| 93 // if no asserts are called. | 93 // if no asserts are called. |
| 94 void ExpectNoAssertionsMade(); | 94 void ExpectNoAssertionsMade(); |
| 95 | 95 |
| 96 // Runs promises that have been resolved. Resolved promises will not run | 96 // Runs promises that have been resolved. Resolved promises will not run |
| 97 // until this is called. | 97 // until this is called. |
| 98 void RunResolvedPromises(); | 98 void RunResolvedPromises(); |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 v8::Isolate* isolate_; | 101 v8::Isolate* isolate_; |
| 102 scoped_ptr<ModuleSystemTestEnvironment> env_; | 102 scoped_ptr<ModuleSystemTestEnvironment> env_; |
| 103 bool should_assertions_be_made_; | 103 bool should_assertions_be_made_; |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 DISALLOW_COPY_AND_ASSIGN(ModuleSystemTest); | 106 DISALLOW_COPY_AND_ASSIGN(ModuleSystemTest); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace extensions | 109 } // namespace extensions |
| 110 | 110 |
| 111 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ | 111 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ |
| OLD | NEW |