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

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

Issue 13977018: Add Value::Is* methods for typed arrays and ArrayBuffer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
« src/api.cc ('K') | « src/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-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index d0b986b796e61f1c2a4e90d9e3fb930e3b2ac881..3036e883009b4cc6e00f8589da9b92185708d122 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -15173,6 +15173,31 @@ THREADED_TEST(Float64Array) {
v8::kExternalDoubleArray, -500, 500);
}
+#define IS_TYPED_ARRAY_TEST(TypedArray) \
+ THREADED_TEST(Is##TypedArray) { \
+ i::FLAG_harmony_typed_arrays = true; \
+ LocalContext env; \
+ v8::Isolate* isolate = env->GetIsolate(); \
+ v8::HandleScope handle_scope(isolate); \
+ \
+ Handle<Value> result = CompileRun( \
+ "var ab = new ArrayBuffer(128);" \
+ "new " #TypedArray "(ab)"); \
+ CHECK(result->Is##TypedArray()); \
+ }
+
+IS_TYPED_ARRAY_TEST(Uint8Array)
+IS_TYPED_ARRAY_TEST(Int8Array)
+IS_TYPED_ARRAY_TEST(Uint16Array)
+IS_TYPED_ARRAY_TEST(Int16Array)
+IS_TYPED_ARRAY_TEST(Uint32Array)
+IS_TYPED_ARRAY_TEST(Int32Array)
+IS_TYPED_ARRAY_TEST(Float32Array)
+IS_TYPED_ARRAY_TEST(Float64Array)
+
+#undef IS_TYPED_ARRAY_TEST
+
+
THREADED_TEST(ScriptContextDependence) {
LocalContext c1;
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698