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

Unified Diff: extensions/renderer/api_bindings_system_unittest.cc

Issue 2762623003: [Extensions Bindings] Add lastError utilities to APIBindingJSUtil (Closed)
Patch Set: . Created 3 years, 9 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 d9de2d47e3e97acb0599ba4fcee1aff440b204bf..a75274ff341789b7aa098162b626b448095dcd4e 100644
--- a/extensions/renderer/api_bindings_system_unittest.cc
+++ b/extensions/renderer/api_bindings_system_unittest.cc
@@ -172,7 +172,7 @@ void APIBindingsSystemTest::ValidateLastRequest(
ValueToString(*last_request()->arguments));
}
-void APIBindingsSystemTest::CallFunctionOnObject(
+v8::Local<v8::Value> APIBindingsSystemTest::CallFunctionOnObject(
v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
const std::string& script_source) {
@@ -181,10 +181,14 @@ void APIBindingsSystemTest::CallFunctionOnObject(
v8::Local<v8::Function> func =
FunctionFromString(context, wrapped_script_source);
- ASSERT_FALSE(func.IsEmpty());
+ // Use ADD_FAILURE() to avoid messing up the return type with ASSERT.
+ if (func.IsEmpty()) {
+ ADD_FAILURE() << script_source;
+ return v8::Local<v8::Value>();
+ }
v8::Local<v8::Value> argv[] = {object};
- RunFunction(func, context, 1, argv);
+ return RunFunction(func, context, 1, argv);
}
// Tests API object initialization, calling a method on the supplied APIs, and

Powered by Google App Engine
This is Rietveld 408576698