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

Unified Diff: extensions/renderer/api_bindings_system_unittest.cc

Issue 2609553003: [Extensions Bindings] Allow custom hooks to return values, throw (Closed)
Patch Set: jbroman Created 3 years, 11 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 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 23906077abc11196bd5003127b9e95e529114ed2..37ac5e064a18f5eb0dd7eb66401f7f1aecab51cb 100644
--- a/extensions/renderer/api_bindings_system_unittest.cc
+++ b/extensions/renderer/api_bindings_system_unittest.cc
@@ -300,22 +300,24 @@ TEST_F(APIBindingsSystemTest, TestCustomHooks) {
std::vector<v8::Local<v8::Value>>* arguments,
const ArgumentSpec::RefMap& type_refs) {
*did_call = true;
+ APIBindingHooks::RequestResult result(
+ APIBindingHooks::RequestResult::HANDLED);
if (arguments->size() != 2) { // ASSERT* messes with the return type.
EXPECT_EQ(2u, arguments->size());
- return APIBindingHooks::RequestResult::HANDLED;
+ return result;
}
std::string argument;
EXPECT_EQ("foo", gin::V8ToString(arguments->at(0)));
if (!arguments->at(1)->IsFunction()) {
EXPECT_TRUE(arguments->at(1)->IsFunction());
- return APIBindingHooks::RequestResult::HANDLED;
+ return result;
}
v8::Local<v8::String> response =
gin::StringToV8(context->GetIsolate(), "bar");
v8::Local<v8::Value> response_args[] = {response};
RunFunctionOnGlobal(arguments->at(1).As<v8::Function>(),
context, 1, response_args);
- return APIBindingHooks::RequestResult::HANDLED;
+ return result;
};
APIBindingHooks* hooks = bindings_system()->GetHooksForAPI(kAlphaAPIName);
« extensions/renderer/api_binding_unittest.cc ('K') | « extensions/renderer/api_binding_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698