| 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 "extensions/renderer/module_system_test.h" | 5 #include "extensions/renderer/module_system_test.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (source_map_iter == source_map_.end()) | 112 if (source_map_iter == source_map_.end()) |
| 113 return v8::Local<v8::String>(); | 113 return v8::Local<v8::String>(); |
| 114 return v8::String::NewFromUtf8(isolate, source_map_iter->second.c_str()); | 114 return v8::String::NewFromUtf8(isolate, source_map_iter->second.c_str()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool Contains(const std::string& name) const override { | 117 bool Contains(const std::string& name) const override { |
| 118 return source_map_.count(name); | 118 return source_map_.count(name); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void RegisterModule(const std::string& name, const std::string& source) { | 121 void RegisterModule(const std::string& name, const std::string& source) { |
| 122 CHECK_EQ(0u, source_map_.count(name)) << "Module " << name << " not found"; | 122 // Module |name| not found |
| 123 CHECK_EQ(0u, source_map_.count(name)); |
| 123 source_map_[name] = source; | 124 source_map_[name] = source; |
| 124 } | 125 } |
| 125 | 126 |
| 126 private: | 127 private: |
| 127 std::map<std::string, std::string> source_map_; | 128 std::map<std::string, std::string> source_map_; |
| 128 }; | 129 }; |
| 129 | 130 |
| 130 ModuleSystemTestEnvironment::ModuleSystemTestEnvironment(v8::Isolate* isolate) | 131 ModuleSystemTestEnvironment::ModuleSystemTestEnvironment(v8::Isolate* isolate) |
| 131 : isolate_(isolate), | 132 : isolate_(isolate), |
| 132 context_holder_(new gin::ContextHolder(isolate_)), | 133 context_holder_(new gin::ContextHolder(isolate_)), |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 256 |
| 256 void ModuleSystemTest::ExpectNoAssertionsMade() { | 257 void ModuleSystemTest::ExpectNoAssertionsMade() { |
| 257 should_assertions_be_made_ = false; | 258 should_assertions_be_made_ = false; |
| 258 } | 259 } |
| 259 | 260 |
| 260 void ModuleSystemTest::RunResolvedPromises() { | 261 void ModuleSystemTest::RunResolvedPromises() { |
| 261 v8::MicrotasksScope::PerformCheckpoint(isolate_); | 262 v8::MicrotasksScope::PerformCheckpoint(isolate_); |
| 262 } | 263 } |
| 263 | 264 |
| 264 } // namespace extensions | 265 } // namespace extensions |
| OLD | NEW |