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

Side by Side Diff: test/cctest/test-api.cc

Issue 14657003: Implementation of Uint8ClampedArray. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/typedarray.js ('k') | test/mjsunit/harmony/typedarrays.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 15156 matching lines...) Expand 10 before | Expand all | Expand 10 after
15167 TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloatArray>( 15167 TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloatArray>(
15168 v8::kExternalFloatArray, -500, 500); 15168 v8::kExternalFloatArray, -500, 500);
15169 } 15169 }
15170 15170
15171 15171
15172 THREADED_TEST(Float64Array) { 15172 THREADED_TEST(Float64Array) {
15173 TypedArrayTestHelper<double, v8::Float64Array, i::ExternalDoubleArray>( 15173 TypedArrayTestHelper<double, v8::Float64Array, i::ExternalDoubleArray>(
15174 v8::kExternalDoubleArray, -500, 500); 15174 v8::kExternalDoubleArray, -500, 500);
15175 } 15175 }
15176 15176
15177
15178 THREADED_TEST(Uint8ClampedArray) {
15179 TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray, i::ExternalPixelArray>(
15180 v8::kExternalPixelArray, 0, 0xFF);
15181 }
15182
15183
15177 #define IS_TYPED_ARRAY_TEST(TypedArray) \ 15184 #define IS_TYPED_ARRAY_TEST(TypedArray) \
15178 THREADED_TEST(Is##TypedArray) { \ 15185 THREADED_TEST(Is##TypedArray) { \
15179 i::FLAG_harmony_typed_arrays = true; \ 15186 i::FLAG_harmony_typed_arrays = true; \
15180 LocalContext env; \ 15187 LocalContext env; \
15181 v8::Isolate* isolate = env->GetIsolate(); \ 15188 v8::Isolate* isolate = env->GetIsolate(); \
15182 v8::HandleScope handle_scope(isolate); \ 15189 v8::HandleScope handle_scope(isolate); \
15183 \ 15190 \
15184 Handle<Value> result = CompileRun( \ 15191 Handle<Value> result = CompileRun( \
15185 "var ab = new ArrayBuffer(128);" \ 15192 "var ab = new ArrayBuffer(128);" \
15186 "new " #TypedArray "(ab)"); \ 15193 "new " #TypedArray "(ab)"); \
15187 CHECK(result->Is##TypedArray()); \ 15194 CHECK(result->Is##TypedArray()); \
15188 } 15195 }
15189 15196
15190 IS_TYPED_ARRAY_TEST(Uint8Array) 15197 IS_TYPED_ARRAY_TEST(Uint8Array)
15191 IS_TYPED_ARRAY_TEST(Int8Array) 15198 IS_TYPED_ARRAY_TEST(Int8Array)
15192 IS_TYPED_ARRAY_TEST(Uint16Array) 15199 IS_TYPED_ARRAY_TEST(Uint16Array)
15193 IS_TYPED_ARRAY_TEST(Int16Array) 15200 IS_TYPED_ARRAY_TEST(Int16Array)
15194 IS_TYPED_ARRAY_TEST(Uint32Array) 15201 IS_TYPED_ARRAY_TEST(Uint32Array)
15195 IS_TYPED_ARRAY_TEST(Int32Array) 15202 IS_TYPED_ARRAY_TEST(Int32Array)
15196 IS_TYPED_ARRAY_TEST(Float32Array) 15203 IS_TYPED_ARRAY_TEST(Float32Array)
15197 IS_TYPED_ARRAY_TEST(Float64Array) 15204 IS_TYPED_ARRAY_TEST(Float64Array)
15205 IS_TYPED_ARRAY_TEST(Uint8ClampedArray)
15198 15206
15199 #undef IS_TYPED_ARRAY_TEST 15207 #undef IS_TYPED_ARRAY_TEST
15200 15208
15201 15209
15202 15210
15203 THREADED_TEST(ScriptContextDependence) { 15211 THREADED_TEST(ScriptContextDependence) {
15204 LocalContext c1; 15212 LocalContext c1;
15205 v8::HandleScope scope(c1->GetIsolate()); 15213 v8::HandleScope scope(c1->GetIsolate());
15206 const char *source = "foo"; 15214 const char *source = "foo";
15207 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); 15215 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source));
(...skipping 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after
18883 i::Semaphore* sem_; 18891 i::Semaphore* sem_;
18884 volatile int sem_value_; 18892 volatile int sem_value_;
18885 }; 18893 };
18886 18894
18887 18895
18888 THREADED_TEST(SemaphoreInterruption) { 18896 THREADED_TEST(SemaphoreInterruption) {
18889 ThreadInterruptTest().RunTest(); 18897 ThreadInterruptTest().RunTest();
18890 } 18898 }
18891 18899
18892 #endif // WIN32 18900 #endif // WIN32
OLDNEW
« no previous file with comments | « src/typedarray.js ('k') | test/mjsunit/harmony/typedarrays.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698