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

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

Issue 2912883004: [Extensions Bindings] Don't allow `event` module with native bindings (Closed)
Patch Set: lazyboy's Created 3 years, 6 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
« no previous file with comments | « extensions/renderer/declarative_event.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Test that the rules schema behaves properly. This is designed to be more of 113 // Test that the rules schema behaves properly. This is designed to be more of
114 // a sanity check than a comprehensive test, since it mostly delegates the logic 114 // a sanity check than a comprehensive test, since it mostly delegates the logic
115 // out to ArgumentSpec. 115 // out to ArgumentSpec.
116 TEST_F(DeclarativeEventTest, TestRulesSchema) { 116 TEST_F(DeclarativeEventTest, TestRulesSchema) {
117 v8::HandleScope handle_scope(isolate()); 117 v8::HandleScope handle_scope(isolate());
118 v8::Local<v8::Context> context = MainContext(); 118 v8::Local<v8::Context> context = MainContext();
119 119
120 gin::Handle<DeclarativeEvent> emitter = gin::CreateHandle( 120 gin::Handle<DeclarativeEvent> emitter = gin::CreateHandle(
121 context->GetIsolate(), 121 context->GetIsolate(),
122 new DeclarativeEvent("declEvent", type_refs(), request_handler(), 122 new DeclarativeEvent("declEvent", type_refs(), request_handler(),
123 {"action1", "action2"}, {"condition"})); 123 {"action1", "action2"}, {"condition"}, 0));
124 124
125 v8::Local<v8::Value> emitter_value = emitter.ToV8(); 125 v8::Local<v8::Value> emitter_value = emitter.ToV8();
126 126
127 const char kAddRules[] = 127 const char kAddRules[] =
128 "(function(event) {\n" 128 "(function(event) {\n"
129 " var rules = %s;\n" 129 " var rules = %s;\n"
130 " event.addRules(rules);\n" 130 " event.addRules(rules);\n"
131 "})"; 131 "})";
132 132
133 { 133 {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 "})"; 249 "})";
250 v8::Local<v8::Function> remove_rules = 250 v8::Local<v8::Function> remove_rules =
251 FunctionFromString(context, kGetRules); 251 FunctionFromString(context, kGetRules);
252 RunFunctionOnGlobal(remove_rules, context, arraysize(args), args); 252 RunFunctionOnGlobal(remove_rules, context, arraysize(args), args);
253 ValidateLastRequest("events.getRules", "['alpha.declarativeEvent',0,null]"); 253 ValidateLastRequest("events.getRules", "['alpha.declarativeEvent',0,null]");
254 reset_last_request(); 254 reset_last_request();
255 } 255 }
256 } 256 }
257 257
258 } // namespace extensions 258 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/declarative_event.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698