Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: extensions/renderer/declarative_event_unittest.cc

Issue 2842673002: [Extensions Bindings] Remove Isolate arg from APIBinding::CreateInstance (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 {"events", events_schema.data()}}; 192 {"events", events_schema.data()}};
193 } 193 }
194 }; 194 };
195 195
196 // Test all methods of declarative events. 196 // Test all methods of declarative events.
197 TEST_F(DeclarativeEventWithSchemaTest, TestAllMethods) { 197 TEST_F(DeclarativeEventWithSchemaTest, TestAllMethods) {
198 v8::HandleScope handle_scope(isolate()); 198 v8::HandleScope handle_scope(isolate());
199 v8::Local<v8::Context> context = MainContext(); 199 v8::Local<v8::Context> context = MainContext();
200 200
201 v8::Local<v8::Object> api = bindings_system()->CreateAPIInstance( 201 v8::Local<v8::Object> api = bindings_system()->CreateAPIInstance(
202 kDeclarativeAPIName, context, isolate(), base::Bind(&AllowAllAPIs), 202 kDeclarativeAPIName, context, base::Bind(&AllowAllAPIs), nullptr);
203 nullptr);
204 ASSERT_FALSE(api.IsEmpty()); 203 ASSERT_FALSE(api.IsEmpty());
205 204
206 v8::Local<v8::Value> declarative_event = 205 v8::Local<v8::Value> declarative_event =
207 GetPropertyFromObject(api, context, "declarativeEvent"); 206 GetPropertyFromObject(api, context, "declarativeEvent");
208 ASSERT_FALSE(declarative_event.IsEmpty()); 207 ASSERT_FALSE(declarative_event.IsEmpty());
209 ASSERT_TRUE(declarative_event->IsObject()); 208 ASSERT_TRUE(declarative_event->IsObject());
210 v8::Local<v8::Value> add_rules = GetPropertyFromObject( 209 v8::Local<v8::Value> add_rules = GetPropertyFromObject(
211 declarative_event.As<v8::Object>(), context, "addRules"); 210 declarative_event.As<v8::Object>(), context, "addRules");
212 ASSERT_FALSE(add_rules.IsEmpty()); 211 ASSERT_FALSE(add_rules.IsEmpty());
213 ASSERT_TRUE(add_rules->IsFunction()); 212 ASSERT_TRUE(add_rules->IsFunction());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 "})"; 253 "})";
255 v8::Local<v8::Function> remove_rules = 254 v8::Local<v8::Function> remove_rules =
256 FunctionFromString(context, kGetRules); 255 FunctionFromString(context, kGetRules);
257 RunFunctionOnGlobal(remove_rules, context, arraysize(args), args); 256 RunFunctionOnGlobal(remove_rules, context, arraysize(args), args);
258 ValidateLastRequest("events.getRules", "['alpha.declarativeEvent',0,null]"); 257 ValidateLastRequest("events.getRules", "['alpha.declarativeEvent',0,null]");
259 reset_last_request(); 258 reset_last_request();
260 } 259 }
261 } 260 }
262 261
263 } // namespace extensions 262 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/api_bindings_system_unittest.cc ('k') | extensions/renderer/native_extension_bindings_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698