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

Unified Diff: extensions/renderer/api_bindings_system_unittest.cc

Issue 2762623003: [Extensions Bindings] Add lastError utilities to APIBindingJSUtil (Closed)
Patch Set: Rebase 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
« no previous file with comments | « extensions/renderer/api_bindings_system_unittest.h ('k') | extensions/renderer/api_last_error.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 ac5729a2ff0d16c3427076f0e388e3f1386169c1..5cf93ab9189eefac8954060042407cfd92420571 100644
--- a/extensions/renderer/api_bindings_system_unittest.cc
+++ b/extensions/renderer/api_bindings_system_unittest.cc
@@ -174,7 +174,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) {
@@ -183,10 +183,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
« no previous file with comments | « extensions/renderer/api_bindings_system_unittest.h ('k') | extensions/renderer/api_last_error.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698