| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "extensions/renderer/api_binding.h" | 10 #include "extensions/renderer/api_binding.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 v8::Local<v8::Context> context) { | 128 v8::Local<v8::Context> context) { |
| 129 arguments_ = std::move(request->arguments); | 129 arguments_ = std::move(request->arguments); |
| 130 had_callback_ = request->has_callback; | 130 had_callback_ = request->has_callback; |
| 131 } | 131 } |
| 132 | 132 |
| 133 protected: | 133 protected: |
| 134 APIBindingUnittest() {} | 134 APIBindingUnittest() {} |
| 135 void SetUp() override { | 135 void SetUp() override { |
| 136 APIBindingTest::SetUp(); | 136 APIBindingTest::SetUp(); |
| 137 request_handler_ = base::MakeUnique<APIRequestHandler>( | 137 request_handler_ = base::MakeUnique<APIRequestHandler>( |
| 138 base::Bind(&RunFunctionOnGlobalAndIgnoreResult)); | 138 base::Bind(&RunFunctionOnGlobalAndIgnoreResult), |
| 139 APILastError(APILastError::GetParent())); |
| 139 } | 140 } |
| 140 | 141 |
| 141 void TearDown() override { | 142 void TearDown() override { |
| 142 request_handler_.reset(); | 143 request_handler_.reset(); |
| 143 event_handler_.reset(); | 144 event_handler_.reset(); |
| 144 binding_.reset(); | 145 binding_.reset(); |
| 145 APIBindingTest::TearDown(); | 146 APIBindingTest::TearDown(); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void SetFunctions(const char* functions) { | 149 void SetFunctions(const char* functions) { |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 ExpectPass(binding_object, "obj.oneString('ping');", "['pong']", false); | 980 ExpectPass(binding_object, "obj.oneString('ping');", "['pong']", false); |
| 980 EXPECT_EQ("[\"ping\"]", GetStringPropertyFromObject( | 981 EXPECT_EQ("[\"ping\"]", GetStringPropertyFromObject( |
| 981 context->Global(), context, "requestArguments")); | 982 context->Global(), context, "requestArguments")); |
| 982 | 983 |
| 983 // Other methods, like stringAndInt(), should behave normally. | 984 // Other methods, like stringAndInt(), should behave normally. |
| 984 ExpectPass(binding_object, "obj.stringAndInt('foo', 42);", | 985 ExpectPass(binding_object, "obj.stringAndInt('foo', 42);", |
| 985 "['foo',42]", false); | 986 "['foo',42]", false); |
| 986 } | 987 } |
| 987 | 988 |
| 988 } // namespace extensions | 989 } // namespace extensions |
| OLD | NEW |