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

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

Issue 11631002: Extend API to allow setting length property for function templates. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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
« src/api.cc ('K') | « src/objects-inl.h ('k') | no next file » | 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 846
847 Local<Value> result = v8_compile("(new obj()).toString()")->Run(); 847 Local<Value> result = v8_compile("(new obj()).toString()")->Run();
848 CHECK_EQ(v8_str("[object funky]"), result); 848 CHECK_EQ(v8_str("[object funky]"), result);
849 849
850 result = v8_compile("(new obj()).m")->Run(); 850 result = v8_compile("(new obj()).m")->Run();
851 CHECK_EQ(239, result->Int32Value()); 851 CHECK_EQ(239, result->Int32Value());
852 } 852 }
853 } 853 }
854 854
855 855
856 THREADED_TEST(FunctionTemplateSetLength) {
857 v8::HandleScope scope;
858 LocalContext env;
859 {
860 Local<v8::FunctionTemplate> fun_templ =
861 v8::FunctionTemplate::New(handle_call);
862 fun_templ->SetLength(22);
863 Local<Function> fun = fun_templ->GetFunction();
864 env->Global()->Set(v8_str("obj"), fun);
865 Local<Script> script = v8_compile("obj.length");
866 CHECK_EQ(22, script->Run()->Int32Value());
867 }
868 {
869 // Without setting length it defaults to 0.
870 Local<v8::FunctionTemplate> fun_templ =
871 v8::FunctionTemplate::New(handle_call);
872 Local<Function> fun = fun_templ->GetFunction();
873 env->Global()->Set(v8_str("obj"), fun);
874 Local<Script> script = v8_compile("obj.length");
875 CHECK_EQ(0, script->Run()->Int32Value());
876 }
877 }
878
879
856 static void* expected_ptr; 880 static void* expected_ptr;
857 static v8::Handle<v8::Value> callback(const v8::Arguments& args) { 881 static v8::Handle<v8::Value> callback(const v8::Arguments& args) {
858 void* ptr = v8::External::Unwrap(args.Data()); 882 void* ptr = v8::External::Unwrap(args.Data());
859 CHECK_EQ(expected_ptr, ptr); 883 CHECK_EQ(expected_ptr, ptr);
860 return v8::True(); 884 return v8::True();
861 } 885 }
862 886
863 887
864 static void TestExternalPointerWrapping() { 888 static void TestExternalPointerWrapping() {
865 v8::HandleScope scope; 889 v8::HandleScope scope;
(...skipping 17231 matching lines...) Expand 10 before | Expand all | Expand 10 after
18097 18121
18098 i::Semaphore* sem_; 18122 i::Semaphore* sem_;
18099 volatile int sem_value_; 18123 volatile int sem_value_;
18100 }; 18124 };
18101 18125
18102 18126
18103 THREADED_TEST(SemaphoreInterruption) { 18127 THREADED_TEST(SemaphoreInterruption) {
18104 ThreadInterruptTest().RunTest(); 18128 ThreadInterruptTest().RunTest();
18105 } 18129 }
18106 #endif // WIN32 18130 #endif // WIN32
OLDNEW
« src/api.cc ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698