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

Unified Diff: gin/converter_unittest.cc

Issue 1152653004: Re-land: gin: Use V8 Maybe APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/converter.cc ('k') | gin/dictionary.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/converter_unittest.cc
diff --git a/gin/converter_unittest.cc b/gin/converter_unittest.cc
index 8b9adf414b05899eb85830f90414e95ca74d216e..a7c35470320160fcc2a3798e21b66a6464931eb2 100644
--- a/gin/converter_unittest.cc
+++ b/gin/converter_unittest.cc
@@ -116,19 +116,16 @@ TEST_F(ConverterTest, Vector) {
expected.push_back(0);
expected.push_back(1);
- Local<Array> js_array = Local<Array>::Cast(
- Converter<std::vector<int>>::ToV8(instance_->isolate(), expected));
- ASSERT_FALSE(js_array.IsEmpty());
- EXPECT_EQ(3u, js_array->Length());
+ auto maybe = Converter<std::vector<int>>::ToV8(
+ instance_->isolate()->GetCurrentContext(), expected);
+ Local<Value> js_value;
+ EXPECT_TRUE(maybe.ToLocal(&js_value));
+ Local<Array> js_array2 = Local<Array>::Cast(js_value);
+ EXPECT_EQ(3u, js_array2->Length());
for (size_t i = 0; i < expected.size(); ++i) {
EXPECT_TRUE(Integer::New(instance_->isolate(), expected[i])
- ->StrictEquals(js_array->Get(static_cast<int>(i))));
+ ->StrictEquals(js_array2->Get(static_cast<int>(i))));
}
-
- std::vector<int> actual;
- EXPECT_TRUE(Converter<std::vector<int> >::FromV8(instance_->isolate(),
- js_array, &actual));
- EXPECT_EQ(expected, actual);
}
} // namespace gin
« no previous file with comments | « gin/converter.cc ('k') | gin/dictionary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698