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/api_test_base.h" | 5 #include "extensions/renderer/api_test_base.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "extensions/common/extension_urls.h" | 10 #include "extensions/common/extension_urls.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 ApiTestBase::~ApiTestBase() { | 101 ApiTestBase::~ApiTestBase() { |
102 } | 102 } |
103 | 103 |
104 void ApiTestBase::SetUp() { | 104 void ApiTestBase::SetUp() { |
105 ModuleSystemTest::SetUp(); | 105 ModuleSystemTest::SetUp(); |
106 InitializeEnvironment(); | 106 InitializeEnvironment(); |
107 RegisterModules(); | 107 RegisterModules(); |
108 } | 108 } |
109 | 109 |
| 110 void ApiTestBase::TearDown() { |
| 111 env()->context()->DispatchOnUnloadEvent(); |
| 112 ModuleSystemTest::TearDown(); |
| 113 } |
| 114 |
110 void ApiTestBase::RegisterModules() { | 115 void ApiTestBase::RegisterModules() { |
111 v8_schema_registry_.reset(new V8SchemaRegistry); | 116 v8_schema_registry_.reset(new V8SchemaRegistry); |
112 const std::vector<std::pair<std::string, int> > resources = | 117 const std::vector<std::pair<std::string, int> > resources = |
113 Dispatcher::GetJsResources(); | 118 Dispatcher::GetJsResources(); |
114 for (std::vector<std::pair<std::string, int> >::const_iterator resource = | 119 for (std::vector<std::pair<std::string, int> >::const_iterator resource = |
115 resources.begin(); | 120 resources.begin(); |
116 resource != resources.end(); | 121 resource != resources.end(); |
117 ++resource) { | 122 ++resource) { |
118 if (resource->first != "test_environment_specific_bindings") | 123 if (resource->first != "test_environment_specific_bindings") |
119 env()->RegisterModule(resource->first, resource->second); | 124 env()->RegisterModule(resource->first, resource->second); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 217 } |
213 | 218 |
214 void ApiTestBase::RunPromisesAgain() { | 219 void ApiTestBase::RunPromisesAgain() { |
215 RunResolvedPromises(); | 220 RunResolvedPromises(); |
216 base::MessageLoop::current()->PostTask( | 221 base::MessageLoop::current()->PostTask( |
217 FROM_HERE, | 222 FROM_HERE, |
218 base::Bind(&ApiTestBase::RunPromisesAgain, base::Unretained(this))); | 223 base::Bind(&ApiTestBase::RunPromisesAgain, base::Unretained(this))); |
219 } | 224 } |
220 | 225 |
221 } // namespace extensions | 226 } // namespace extensions |
OLD | NEW |