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

Unified Diff: test/cctest/test-weaktypedarrays.cc

Issue 17155014: API for DataView. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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
« src/api.cc ('K') | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-weaktypedarrays.cc
diff --git a/test/cctest/test-weaktypedarrays.cc b/test/cctest/test-weaktypedarrays.cc
index 6d0a247f537464b1e54b170d95cff625e068ede4..fe1ef049408da73866ccfaf03c6c278cd6e0a4cd 100644
--- a/test/cctest/test-weaktypedarrays.cc
+++ b/test/cctest/test-weaktypedarrays.cc
@@ -74,7 +74,7 @@ static int CountViews(JSArrayBuffer* array_buffer) {
}
static bool HasViewInWeakList(JSArrayBuffer* array_buffer,
- JSObject* ta) {
+ JSArrayBufferView* ta) {
for (Object* o = array_buffer->weak_first_view();
!o->IsUndefined();
o = JSArrayBufferView::cast(o)->weak_next()) {
@@ -178,8 +178,8 @@ TEST(WeakArrayBuffersFromScript) {
}
}
-template <typename TypedArray>
-void TestTypedArrayFromApi() {
+template <typename View>
+void TestViewFromApi() {
v8::V8::Initialize();
LocalContext context;
Isolate* isolate = GetIsolateFrom(&context);
@@ -189,20 +189,20 @@ void TestTypedArrayFromApi() {
Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab);
{
v8::HandleScope s2(context->GetIsolate());
- v8::Handle<TypedArray> ta1 = TypedArray::New(ab, 0, 256);
+ v8::Handle<View> ta1 = View::New(ab, 0, 256);
{
v8::HandleScope s3(context->GetIsolate());
- v8::Handle<TypedArray> ta2 = TypedArray::New(ab, 0, 128);
+ v8::Handle<View> ta2 = View::New(ab, 0, 128);
- Handle<JSTypedArray> ita1 = v8::Utils::OpenHandle(*ta1);
- Handle<JSTypedArray> ita2 = v8::Utils::OpenHandle(*ta2);
+ Handle<JSArrayBufferView> ita1 = v8::Utils::OpenHandle(*ta1);
+ Handle<JSArrayBufferView> ita2 = v8::Utils::OpenHandle(*ta2);
CHECK_EQ(2, CountViews(*iab));
CHECK(HasViewInWeakList(*iab, *ita1));
CHECK(HasViewInWeakList(*iab, *ita2));
}
isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
CHECK_EQ(1, CountViews(*iab));
- Handle<JSTypedArray> ita1 = v8::Utils::OpenHandle(*ta1);
+ Handle<JSArrayBufferView> ita1 = v8::Utils::OpenHandle(*ta1);
CHECK(HasViewInWeakList(*iab, *ita1));
}
isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
@@ -212,47 +212,52 @@ void TestTypedArrayFromApi() {
TEST(Uint8ArrayFromApi) {
- TestTypedArrayFromApi<v8::Uint8Array>();
+ TestViewFromApi<v8::Uint8Array>();
}
TEST(Int8ArrayFromApi) {
- TestTypedArrayFromApi<v8::Int8Array>();
+ TestViewFromApi<v8::Int8Array>();
}
TEST(Uint16ArrayFromApi) {
- TestTypedArrayFromApi<v8::Uint16Array>();
+ TestViewFromApi<v8::Uint16Array>();
}
TEST(Int16ArrayFromApi) {
- TestTypedArrayFromApi<v8::Int16Array>();
+ TestViewFromApi<v8::Int16Array>();
}
TEST(Uint32ArrayFromApi) {
- TestTypedArrayFromApi<v8::Uint32Array>();
+ TestViewFromApi<v8::Uint32Array>();
}
TEST(Int32ArrayFromApi) {
- TestTypedArrayFromApi<v8::Int32Array>();
+ TestViewFromApi<v8::Int32Array>();
}
TEST(Float32ArrayFromApi) {
- TestTypedArrayFromApi<v8::Float32Array>();
+ TestViewFromApi<v8::Float32Array>();
}
TEST(Float64ArrayFromApi) {
- TestTypedArrayFromApi<v8::Float64Array>();
+ TestViewFromApi<v8::Float64Array>();
}
TEST(Uint8ClampedArrayFromApi) {
- TestTypedArrayFromApi<v8::Uint8ClampedArray>();
+ TestViewFromApi<v8::Uint8ClampedArray>();
+}
+
+
+TEST(DataViewFromApi) {
+ TestViewFromApi<v8::DataView>();
}
template <typename TypedArray>
@@ -378,5 +383,5 @@ TEST(Uint8ClampedArrayFromScript) {
TEST(DataViewFromScript) {
- TestTypedArrayFromScript<v8::Object>("DataView");
+ TestTypedArrayFromScript<v8::DataView>("DataView");
}
« src/api.cc ('K') | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698