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

Unified Diff: extensions/renderer/api_binding_unittest.cc

Issue 2842673002: [Extensions Bindings] Remove Isolate arg from APIBinding::CreateInstance (Closed)
Patch Set: Created 3 years, 8 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_binding.cc ('k') | extensions/renderer/api_bindings_system.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_binding_unittest.cc
diff --git a/extensions/renderer/api_binding_unittest.cc b/extensions/renderer/api_binding_unittest.cc
index c589d08a00c7ec3c53e36823f5f5cb924ae97262..d17e7201d53e4367ccaff95de70a5f74735e0a52 100644
--- a/extensions/renderer/api_binding_unittest.cc
+++ b/extensions/renderer/api_binding_unittest.cc
@@ -313,7 +313,7 @@ TEST_F(APIBindingUnittest, TestEmptyAPI) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
EXPECT_EQ(
0u,
binding_object->GetOwnPropertyNames(context).ToLocalChecked()->Length());
@@ -329,7 +329,7 @@ TEST_F(APIBindingUnittest, Test) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
ExpectPass(binding_object, "obj.oneString('foo');", "['foo']", false);
ExpectPass(binding_object, "obj.oneString('');", "['']", false);
@@ -423,7 +423,7 @@ TEST_F(APIBindingUnittest, EnumValues) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
const char kExpected[] =
"{'ALPHA':'alpha','CAMEL_CASE':'camelCase','HYPHEN_ATED':'Hyphen-ated',"
@@ -450,7 +450,7 @@ TEST_F(APIBindingUnittest, EnumWithEmptyEntry) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
EXPECT_EQ(
"{\"\":\"\",\"OTHER\":\"other\"}",
@@ -497,7 +497,7 @@ TEST_F(APIBindingUnittest, TypeRefsTest) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
ExpectPass(binding_object, "obj.takesRefObj({prop1: 'foo'})",
"[{'prop1':'foo'}]", false);
@@ -546,7 +546,7 @@ TEST_F(APIBindingUnittest, RestrictedAPIs) {
};
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(is_available));
+ binding()->CreateInstance(context, base::Bind(is_available));
auto is_defined = [&binding_object, context](const std::string& name) {
v8::Local<v8::Value> val =
@@ -574,7 +574,7 @@ TEST_F(APIBindingUnittest, TestEventCreation) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
// Event behavior is tested in the APIEventHandler unittests as well as the
// APIBindingsSystem tests, so we really only need to check that the events
@@ -612,7 +612,7 @@ TEST_F(APIBindingUnittest, TestProperties) {
v8::HandleScope handle_scope(isolate());
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
EXPECT_EQ("17",
GetStringPropertyFromObject(binding_object, context, "prop1"));
EXPECT_EQ(R"({"subprop1":"some value","subprop2":true})",
@@ -664,7 +664,7 @@ TEST_F(APIBindingUnittest, TestRefProperties) {
v8::HandleScope handle_scope(isolate());
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
EXPECT_EQ(R"({"alphaProp":"alphaVal"})",
GetStringPropertyFromObject(binding_object, context, "alpha"));
EXPECT_EQ(
@@ -680,7 +680,7 @@ TEST_F(APIBindingUnittest, TestDisposedContext) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
v8::Local<v8::Function> func =
FunctionFromString(context, "(function(obj) { obj.oneString('foo'); })");
@@ -700,10 +700,10 @@ TEST_F(APIBindingUnittest, MultipleContexts) {
SetFunctions(kFunctions);
InitializeBinding();
- v8::Local<v8::Object> binding_object_a = binding()->CreateInstance(
- context_a, isolate(), base::Bind(&AllowAllAPIs));
- v8::Local<v8::Object> binding_object_b = binding()->CreateInstance(
- context_b, isolate(), base::Bind(&AllowAllAPIs));
+ v8::Local<v8::Object> binding_object_a =
+ binding()->CreateInstance(context_a, base::Bind(&AllowAllAPIs));
+ v8::Local<v8::Object> binding_object_b =
+ binding()->CreateInstance(context_b, base::Bind(&AllowAllAPIs));
ExpectPass(context_a, binding_object_a, "obj.oneString('foo');", "['foo']",
false);
@@ -744,7 +744,7 @@ TEST_F(APIBindingUnittest, TestCustomHooks) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
// First try calling the oneString() method, which has a custom hook
// installed.
@@ -785,7 +785,7 @@ TEST_F(APIBindingUnittest, TestJSCustomHook) {
InitializeBinding();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
// First try calling with an invalid invocation. An error should be raised and
// the hook should never have been called, since the arguments didn't match.
@@ -837,7 +837,7 @@ TEST_F(APIBindingUnittest, TestUpdateArgumentsPreValidate) {
InitializeBinding();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
// Call the method with a hook. Since the hook updates arguments before
// validation, we should be able to pass in invalid arguments and still
@@ -895,7 +895,7 @@ TEST_F(APIBindingUnittest, TestThrowInUpdateArgumentsPreValidate) {
InitializeBinding();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
v8::Local<v8::Function> function =
FunctionFromString(context,
@@ -937,7 +937,7 @@ TEST_F(APIBindingUnittest, TestReturningResultFromCustomJSHook) {
InitializeBinding();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
v8::Local<v8::Function> function =
FunctionFromString(context,
@@ -998,7 +998,7 @@ TEST_F(APIBindingUnittest, TestThrowingFromCustomJSHook) {
InitializeBinding();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
v8::Local<v8::Function> function =
FunctionFromString(context,
@@ -1048,7 +1048,7 @@ TEST_F(APIBindingUnittest,
InitializeBinding();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
{
// Test an invocation that we expect to throw an exception.
@@ -1104,7 +1104,7 @@ TEST_F(APIBindingUnittest, TestUpdateArgumentsPostValidate) {
InitializeBinding();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
// Try calling the method with an invalid signature. Since it's invalid, we
// should never enter the hook.
@@ -1152,7 +1152,7 @@ TEST_F(APIBindingUnittest, TestUpdateArgumentsPostValidateViolatingSchema) {
InitializeBinding();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
// Call the method with a valid signature. The hook should be entered and
// manipulate the arguments.
@@ -1168,7 +1168,7 @@ TEST_F(APIBindingUnittest, TestUserGestures) {
v8::Local<v8::Context> context = MainContext();
v8::Local<v8::Object> binding_object =
- binding()->CreateInstance(context, isolate(), base::Bind(&AllowAllAPIs));
+ binding()->CreateInstance(context, base::Bind(&AllowAllAPIs));
v8::Local<v8::Function> function =
FunctionFromString(context, "(function(obj) { obj.oneString('foo');})");
« no previous file with comments | « extensions/renderer/api_binding.cc ('k') | extensions/renderer/api_bindings_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698