| 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 void OnFunctionCall(std::unique_ptr<APIBinding::Request> request, | 128 void OnFunctionCall(std::unique_ptr<APIBinding::Request> request, |
| 129 v8::Local<v8::Context> context) { | 129 v8::Local<v8::Context> context) { |
| 130 last_request_ = std::move(request); | 130 last_request_ = std::move(request); |
| 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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 | 1012 |
| 1012 blink::WebScopedUserGesture user_gesture(nullptr); | 1013 blink::WebScopedUserGesture user_gesture(nullptr); |
| 1013 RunFunction(function, context, arraysize(argv), argv); | 1014 RunFunction(function, context, arraysize(argv), argv); |
| 1014 ASSERT_TRUE(last_request()); | 1015 ASSERT_TRUE(last_request()); |
| 1015 EXPECT_TRUE(last_request()->has_user_gesture); | 1016 EXPECT_TRUE(last_request()->has_user_gesture); |
| 1016 | 1017 |
| 1017 reset_last_request(); | 1018 reset_last_request(); |
| 1018 } | 1019 } |
| 1019 | 1020 |
| 1020 } // namespace extensions | 1021 } // namespace extensions |
| OLD | NEW |