Index: extensions/renderer/api_binding_test_util.h |
diff --git a/extensions/renderer/api_binding_test_util.h b/extensions/renderer/api_binding_test_util.h |
index 4a56c69e6326bb44f0235f4e06a444da50590318..aa98697ceeda2ffe67bbe97b74c6ca3acd72e13c 100644 |
--- a/extensions/renderer/api_binding_test_util.h |
+++ b/extensions/renderer/api_binding_test_util.h |
@@ -51,6 +51,61 @@ v8::Local<v8::Function> FunctionFromString(v8::Local<v8::Context> context, |
std::unique_ptr<base::Value> V8ToBaseValue(v8::Local<v8::Value> value, |
v8::Local<v8::Context> context); |
+// Calls the given |function| with the specified |receiver| and arguments, and |
+// returns the result. EXPECTs no errors to be thrown. |
+v8::Local<v8::Value> RunFunction(v8::Local<v8::Function> function, |
+ v8::Local<v8::Context> context, |
+ v8::Local<v8::Value> receiver, |
+ int argc, |
+ v8::Local<v8::Value> argv[]); |
+ |
+// Like RunFunction(), but uses v8::Undefined for the receiver. |
+v8::Local<v8::Value> RunFunction(v8::Local<v8::Function> function, |
+ v8::Local<v8::Context> context, |
+ int argc, |
+ v8::Local<v8::Value> argv[]); |
+ |
+// Like RunFunction(), but uses the |context|'s Global for the receiver. |
+v8::Local<v8::Value> RunFunctionOnGlobal(v8::Local<v8::Function> function, |
+ v8::Local<v8::Context> context, |
+ int argc, |
+ v8::Local<v8::Value> argv[]); |
+ |
+// Like RunFunctionOnGlobal(), but doesn't return the result. This is useful |
+// for binding in places a result isn't expected. |
+void RunFunctionOnGlobalAndIgnoreResult(v8::Local<v8::Function> function, |
+ v8::Local<v8::Context> context, |
+ int argc, |
+ v8::Local<v8::Value> argv[]); |
+ |
+// Calls the given |function| with the specified |receiver| and arguments, but |
+// EXPECTs the function to throw the |expected_error|. |
+void RunFunctionAndExpectError(v8::Local<v8::Function> function, |
+ v8::Local<v8::Context> context, |
+ v8::Local<v8::Value> receiver, |
+ int argc, |
+ v8::Local<v8::Value> argv[], |
+ const std::string& expected_error); |
+ |
+// Like RunFunctionAndExpectError(), but uses v8::Undefined for the receiver. |
+void RunFunctionAndExpectError(v8::Local<v8::Function> function, |
+ v8::Local<v8::Context> context, |
+ int argc, |
+ v8::Local<v8::Value> argv[], |
+ const std::string& expected_error); |
+ |
+// Returns the property with the given |key| from the |object|. EXPECTs the |
+// operation not throw an error, but doesn't assume the key is present. |
+v8::Local<v8::Value> GetPropertyFromObject(v8::Local<v8::Object> object, |
+ v8::Local<v8::Context> context, |
+ base::StringPiece key); |
+ |
+// As above, but converts the result to a base::Value. |
+std::unique_ptr<base::Value> GetBaseValuePropertyFromObject( |
+ v8::Local<v8::Object> object, |
+ v8::Local<v8::Context> context, |
+ base::StringPiece key); |
+ |
} // extensions |
#endif // EXTENSIONS_RENDERER_API_BINDING_TEST_UTIL_H_ |