OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/declarative_event.h" | 5 #include "extensions/renderer/declarative_event.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 auto prop = base::MakeUnique<ArgumentSpec>(ArgumentType::STRING); | 91 auto prop = base::MakeUnique<ArgumentSpec>(ArgumentType::STRING); |
92 ArgumentSpec::PropertiesMap props; | 92 ArgumentSpec::PropertiesMap props; |
93 props["url"] = std::move(prop); | 93 props["url"] = std::move(prop); |
94 condition->set_properties(std::move(props)); | 94 condition->set_properties(std::move(props)); |
95 type_refs_.AddSpec("condition", std::move(condition)); | 95 type_refs_.AddSpec("condition", std::move(condition)); |
96 } | 96 } |
97 | 97 |
98 request_handler_ = base::MakeUnique<APIRequestHandler>( | 98 request_handler_ = base::MakeUnique<APIRequestHandler>( |
99 base::Bind(&DeclarativeEventTest::OnRequest, base::Unretained(this)), | 99 base::Bind(&DeclarativeEventTest::OnRequest, base::Unretained(this)), |
100 base::Bind(&RunFunctionOnGlobalAndIgnoreResult), | 100 base::Bind(&RunFunctionOnGlobalAndIgnoreResult), |
101 APILastError(APILastError::GetParent())); | 101 APILastError(APILastError::GetParent(), |
| 102 APILastError::AddConsoleError())); |
102 } | 103 } |
103 | 104 |
104 void TearDown() override { | 105 void TearDown() override { |
105 request_handler_.reset(); | 106 request_handler_.reset(); |
106 APIBindingTest::TearDown(); | 107 APIBindingTest::TearDown(); |
107 } | 108 } |
108 | 109 |
109 APITypeReferenceMap type_refs_; | 110 APITypeReferenceMap type_refs_; |
110 std::unique_ptr<APIRequestHandler> request_handler_; | 111 std::unique_ptr<APIRequestHandler> request_handler_; |
111 std::unique_ptr<APIRequestHandler::Request> last_request_; | 112 std::unique_ptr<APIRequestHandler::Request> last_request_; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 "})"; | 254 "})"; |
254 v8::Local<v8::Function> remove_rules = | 255 v8::Local<v8::Function> remove_rules = |
255 FunctionFromString(context, kGetRules); | 256 FunctionFromString(context, kGetRules); |
256 RunFunctionOnGlobal(remove_rules, context, arraysize(args), args); | 257 RunFunctionOnGlobal(remove_rules, context, arraysize(args), args); |
257 ValidateLastRequest("events.getRules", "['alpha.declarativeEvent',0,null]"); | 258 ValidateLastRequest("events.getRules", "['alpha.declarativeEvent',0,null]"); |
258 reset_last_request(); | 259 reset_last_request(); |
259 } | 260 } |
260 } | 261 } |
261 | 262 |
262 } // namespace extensions | 263 } // namespace extensions |
OLD | NEW |