| Index: extensions/renderer/native_extension_bindings_system_unittest.cc
|
| diff --git a/extensions/renderer/native_extension_bindings_system_unittest.cc b/extensions/renderer/native_extension_bindings_system_unittest.cc
|
| index 404c24996658b5900659db2e4db3c88e9d928f6c..a009e2db3fcce5d7c51e9f09aa4b0c248b7f24f2 100644
|
| --- a/extensions/renderer/native_extension_bindings_system_unittest.cc
|
| +++ b/extensions/renderer/native_extension_bindings_system_unittest.cc
|
| @@ -99,8 +99,12 @@ class NativeExtensionBindingsSystemUnittest : public APIBindingTest {
|
| }
|
|
|
| void TearDown() override {
|
| - for (auto* context : raw_script_contexts_)
|
| + event_change_handler_.reset();
|
| +
|
| + for (auto* context : raw_script_contexts_) {
|
| + bindings_system_->WillReleaseScriptContext(context);
|
| script_context_set_->Remove(context);
|
| + }
|
| base::RunLoop().RunUntilIdle();
|
| script_context_set_.reset();
|
| bindings_system_.reset();
|
| @@ -141,6 +145,20 @@ class NativeExtensionBindingsSystemUnittest : public APIBindingTest {
|
| return raw_script_context;
|
| }
|
|
|
| + void DisposeMainScriptContext() {
|
| + v8::Local<v8::Context> context = ContextLocal();
|
| + auto iter =
|
| + std::find_if(raw_script_contexts_.begin(), raw_script_contexts_.end(),
|
| + [context](ScriptContext* script_context) {
|
| + return script_context->v8_context() == context;
|
| + });
|
| + ASSERT_TRUE(iter != raw_script_contexts_.end());
|
| + bindings_system_->WillReleaseScriptContext(*iter);
|
| + DisposeContext();
|
| + script_context_set_->Remove(*iter);
|
| + raw_script_contexts_.erase(iter);
|
| + }
|
| +
|
| void RegisterExtension(const ExtensionId& id) { extension_ids_.insert(id); }
|
|
|
| void InitEventChangeHandler() {
|
| @@ -361,7 +379,7 @@ TEST_F(NativeExtensionBindingsSystemUnittest,
|
| ASSERT_FALSE(first_idle_object.IsEmpty());
|
| EXPECT_TRUE(first_idle_object->IsObject());
|
|
|
| - DisposeContext();
|
| + DisposeMainScriptContext();
|
|
|
| // Check an API that was instantiated....
|
| v8::Local<v8::Value> second_idle_object =
|
|
|