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

Unified Diff: gin/arguments_unittest.cc

Issue 2820113004: Revert of [gin] Add Arguments::GetAll() (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 | « gin/arguments.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/arguments_unittest.cc
diff --git a/gin/arguments_unittest.cc b/gin/arguments_unittest.cc
index a5f03e5f36f0de213e834a9ed362b84a446d40e6..d2b51361995cdc2f38a9cb4ccc5481833422ab96 100644
--- a/gin/arguments_unittest.cc
+++ b/gin/arguments_unittest.cc
@@ -64,67 +64,4 @@
}
}
-TEST_F(ArgumentsTest, TestGetAll) {
- v8::Isolate* isolate = instance_->isolate();
- v8::HandleScope handle_scope(isolate);
- v8::Local<v8::Context> context = context_.Get(instance_->isolate());
-
- using V8List = std::vector<v8::Local<v8::Value>>;
-
- V8List list1 = {
- gin::ConvertToV8(isolate, 1), gin::StringToV8(isolate, "some string"),
- gin::ConvertToV8(context, std::vector<double>({2.0, 3.0}))
- .ToLocalChecked(),
- };
- bool called1 = false;
-
- V8List list2 = {
- gin::StringToV8(isolate, "some other string"),
- gin::ConvertToV8(isolate, 42),
- };
- bool called2 = false;
-
- V8List list3; // Empty list.
- bool called3 = false;
-
- auto check_arguments = [](V8List* expected, bool* called,
- gin::Arguments* arguments) {
- *called = true;
- V8List actual = arguments->GetAll();
- ASSERT_EQ(expected->size(), actual.size());
- for (size_t i = 0; i < expected->size(); ++i)
- EXPECT_EQ(expected->at(i), actual[i]) << i;
- };
-
- // Create an object that will compare GetHolderCreationContext() with
- // |creation_context|.
- v8::Local<v8::ObjectTemplate> object_template =
- ObjectTemplateBuilder(isolate)
- .SetMethod("check1", base::Bind(check_arguments, &list1, &called1))
- .SetMethod("check2", base::Bind(check_arguments, &list2, &called2))
- .SetMethod("check3", base::Bind(check_arguments, &list3, &called3))
- .Build();
-
- v8::Local<v8::Object> object =
- object_template->NewInstance(context).ToLocalChecked();
-
- auto do_check = [object, context](V8List& args, base::StringPiece key) {
- v8::Local<v8::Value> val;
- ASSERT_TRUE(
- object->Get(context, gin::StringToSymbol(context->GetIsolate(), key))
- .ToLocal(&val));
- ASSERT_TRUE(val->IsFunction());
- val.As<v8::Function>()
- ->Call(context, object, args.size(), args.data())
- .ToLocalChecked();
- };
-
- do_check(list1, "check1");
- EXPECT_TRUE(called1);
- do_check(list2, "check2");
- EXPECT_TRUE(called2);
- do_check(list3, "check3");
- EXPECT_TRUE(called3);
-}
-
} // namespace gin
« no previous file with comments | « gin/arguments.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698