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

Unified Diff: extensions/renderer/api_bindings_system_unittest.cc

Issue 2583273002: [Extensions Bindings] Allow for argument validation without conversion (Closed)
Patch Set: format 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
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 654f11a516a29f50b64a62025dcd250685e6b7b8..55c03f573e0750d55c6504c9ae12b2008c03a342 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);

Powered by Google App Engine
This is Rietveld 408576698