| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_bindings_system.h" | 5 #include "extensions/renderer/api_bindings_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 base::Bind(&APIBindingsSystemTestBase::GetAPISchema, | 115 base::Bind(&APIBindingsSystemTestBase::GetAPISchema, |
| 116 base::Unretained(this)), | 116 base::Unretained(this)), |
| 117 base::Bind(&APIBindingsSystemTestBase::OnAPIRequest, | 117 base::Bind(&APIBindingsSystemTestBase::OnAPIRequest, |
| 118 base::Unretained(this)), | 118 base::Unretained(this)), |
| 119 base::Bind(&APIBindingsSystemTestBase::OnEventListenersChanged, | 119 base::Bind(&APIBindingsSystemTestBase::OnEventListenersChanged, |
| 120 base::Unretained(this)), | 120 base::Unretained(this)), |
| 121 APILastError(APILastError::GetParent())); | 121 APILastError(APILastError::GetParent())); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void TearDown() override { | 124 void TearDown() override { |
| 125 { |
| 126 v8::HandleScope handle_scope(isolate()); |
| 127 bindings_system_->WillReleaseContext(ContextLocal()); |
| 128 } |
| 125 bindings_system_.reset(); | 129 bindings_system_.reset(); |
| 126 APIBindingTest::TearDown(); | 130 APIBindingTest::TearDown(); |
| 127 } | 131 } |
| 128 | 132 |
| 129 // Checks that |last_request_| exists and was provided with the | 133 // Checks that |last_request_| exists and was provided with the |
| 130 // |expected_name| and |expected_arguments|. | 134 // |expected_name| and |expected_arguments|. |
| 131 void ValidateLastRequest(const std::string& expected_name, | 135 void ValidateLastRequest(const std::string& expected_name, |
| 132 const std::string& expected_arguments); | 136 const std::string& expected_arguments); |
| 133 | 137 |
| 134 const APIRequestHandler::Request* last_request() const { | 138 const APIRequestHandler::Request* last_request() const { |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 context, "idleState")); | 586 context, "idleState")); |
| 583 bindings_system()->FireEventInContext("idle.onStateChanged", context, | 587 bindings_system()->FireEventInContext("idle.onStateChanged", context, |
| 584 *ListValueFromString("['active']")); | 588 *ListValueFromString("['active']")); |
| 585 | 589 |
| 586 EXPECT_EQ("\"active\"", GetStringPropertyFromObject(context->Global(), | 590 EXPECT_EQ("\"active\"", GetStringPropertyFromObject(context->Global(), |
| 587 context, "idleState")); | 591 context, "idleState")); |
| 588 } | 592 } |
| 589 } | 593 } |
| 590 | 594 |
| 591 } // namespace extensions | 595 } // namespace extensions |
| OLD | NEW |