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

Unified Diff: extensions/renderer/api_bindings_system_unittest.cc

Issue 2583273002: [Extensions Bindings] Allow for argument validation without conversion (Closed)
Patch Set: lazyboy's Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/api_binding_unittest.cc ('k') | extensions/renderer/api_signature.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_bindings_system_unittest.cc
diff --git a/extensions/renderer/api_bindings_system_unittest.cc b/extensions/renderer/api_bindings_system_unittest.cc
index 5a4ec2259d9f2b5f4f045ebc62d9b5f618a30250..6586038795caf08f9f40dc5835c7c507297f80f8 100644
--- a/extensions/renderer/api_bindings_system_unittest.cc
+++ b/extensions/renderer/api_bindings_system_unittest.cc
@@ -299,19 +299,25 @@ TEST_F(APIBindingsSystemTest, TestCustomHooks) {
bool did_call = false;
auto hook = [](bool* did_call, const APISignature* signature,
- gin::Arguments* arguments) {
+ gin::Arguments* arguments,
+ const ArgumentSpec::RefMap& type_refs) {
*did_call = true;
std::string argument;
EXPECT_EQ(2, arguments->Length());
EXPECT_TRUE(arguments->GetNext(&argument));
EXPECT_EQ("foo", argument);
v8::Local<v8::Function> function;
- ASSERT_TRUE(arguments->GetNext(&function));
+ EXPECT_TRUE(arguments->GetNext(&function));
+ // The above EXPECT_TRUE should really be an ASSERT, but that messes with
+ // the return type.
+ if (function.IsEmpty())
+ return APIBindingHooks::RequestResult::HANDLED;
v8::Local<v8::String> response =
gin::StringToV8(arguments->isolate(), "bar");
v8::Local<v8::Value> response_args[] = {response};
RunFunctionOnGlobal(function, arguments->isolate()->GetCurrentContext(),
1, response_args);
+ return APIBindingHooks::RequestResult::HANDLED;
};
APIBindingHooks* hooks = bindings_system()->GetHooksForAPI(kAlphaAPIName);
« no previous file with comments | « extensions/renderer/api_binding_unittest.cc ('k') | extensions/renderer/api_signature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698