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

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

Issue 15769014: update test to test new style property handlers (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.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 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 LocalContext env; 2000 LocalContext env;
2001 env->Global()->Set(v8_str("obj"), 2001 env->Global()->Set(v8_str("obj"),
2002 templ->GetFunction()->NewInstance()); 2002 templ->GetFunction()->NewInstance());
2003 Local<Script> script = v8_compile("obj[900]"); 2003 Local<Script> script = v8_compile("obj[900]");
2004 CHECK_EQ(script->Run()->Int32Value(), 900); 2004 CHECK_EQ(script->Run()->Int32Value(), 900);
2005 } 2005 }
2006 2006
2007 2007
2008 v8::Handle<v8::Object> bottom; 2008 v8::Handle<v8::Object> bottom;
2009 2009
2010 static v8::Handle<Value> CheckThisIndexedPropertyHandler( 2010 static void CheckThisIndexedPropertyHandler(
2011 uint32_t index, 2011 uint32_t index,
2012 const AccessorInfo& info) { 2012 const v8::PropertyCallbackInfo<v8::Value>& info) {
2013 CheckReturnValue(info);
2013 ApiTestFuzzer::Fuzz(); 2014 ApiTestFuzzer::Fuzz();
2014 CHECK(info.This()->Equals(bottom)); 2015 CHECK(info.This()->Equals(bottom));
2015 return v8::Handle<Value>();
2016 } 2016 }
2017 2017
2018 static v8::Handle<Value> CheckThisNamedPropertyHandler( 2018 static void CheckThisNamedPropertyHandler(
2019 Local<String> name, 2019 Local<String> name,
2020 const AccessorInfo& info) { 2020 const v8::PropertyCallbackInfo<v8::Value>& info) {
2021 CheckReturnValue(info);
2021 ApiTestFuzzer::Fuzz(); 2022 ApiTestFuzzer::Fuzz();
2022 CHECK(info.This()->Equals(bottom)); 2023 CHECK(info.This()->Equals(bottom));
2023 return v8::Handle<Value>(); 2024 }
2025
2026 void CheckThisIndexedPropertySetter(
2027 uint32_t index,
2028 Local<Value> value,
2029 const v8::PropertyCallbackInfo<v8::Value>& info) {
2030 CheckReturnValue(info);
2031 ApiTestFuzzer::Fuzz();
2032 CHECK(info.This()->Equals(bottom));
2024 } 2033 }
2025 2034
2026 2035
2027 v8::Handle<Value> CheckThisIndexedPropertySetter(uint32_t index, 2036 void CheckThisNamedPropertySetter(
2028 Local<Value> value, 2037 Local<String> property,
2029 const AccessorInfo& info) { 2038 Local<Value> value,
2039 const v8::PropertyCallbackInfo<v8::Value>& info) {
2040 CheckReturnValue(info);
2030 ApiTestFuzzer::Fuzz(); 2041 ApiTestFuzzer::Fuzz();
2031 CHECK(info.This()->Equals(bottom)); 2042 CHECK(info.This()->Equals(bottom));
2032 return v8::Handle<Value>(); 2043 }
2044
2045 void CheckThisIndexedPropertyQuery(
2046 uint32_t index,
2047 const v8::PropertyCallbackInfo<v8::Integer>& info) {
2048 CheckReturnValue(info);
2049 ApiTestFuzzer::Fuzz();
2050 CHECK(info.This()->Equals(bottom));
2033 } 2051 }
2034 2052
2035 2053
2036 v8::Handle<Value> CheckThisNamedPropertySetter(Local<String> property, 2054 void CheckThisNamedPropertyQuery(
2037 Local<Value> value, 2055 Local<String> property,
2038 const AccessorInfo& info) { 2056 const v8::PropertyCallbackInfo<v8::Integer>& info) {
2057 CheckReturnValue(info);
2039 ApiTestFuzzer::Fuzz(); 2058 ApiTestFuzzer::Fuzz();
2040 CHECK(info.This()->Equals(bottom)); 2059 CHECK(info.This()->Equals(bottom));
2041 return v8::Handle<Value>();
2042 }
2043
2044 v8::Handle<v8::Integer> CheckThisIndexedPropertyQuery(
2045 uint32_t index,
2046 const AccessorInfo& info) {
2047 ApiTestFuzzer::Fuzz();
2048 CHECK(info.This()->Equals(bottom));
2049 return v8::Handle<v8::Integer>();
2050 } 2060 }
2051 2061
2052 2062
2053 v8::Handle<v8::Integer> CheckThisNamedPropertyQuery(Local<String> property, 2063 void CheckThisIndexedPropertyDeleter(
2054 const AccessorInfo& info) { 2064 uint32_t index,
2065 const v8::PropertyCallbackInfo<v8::Boolean>& info) {
2066 CheckReturnValue(info);
2055 ApiTestFuzzer::Fuzz(); 2067 ApiTestFuzzer::Fuzz();
2056 CHECK(info.This()->Equals(bottom)); 2068 CHECK(info.This()->Equals(bottom));
2057 return v8::Handle<v8::Integer>();
2058 } 2069 }
2059 2070
2060 2071
2061 v8::Handle<v8::Boolean> CheckThisIndexedPropertyDeleter( 2072 void CheckThisNamedPropertyDeleter(
2062 uint32_t index, 2073 Local<String> property,
2063 const AccessorInfo& info) { 2074 const v8::PropertyCallbackInfo<v8::Boolean>& info) {
2075 CheckReturnValue(info);
2064 ApiTestFuzzer::Fuzz(); 2076 ApiTestFuzzer::Fuzz();
2065 CHECK(info.This()->Equals(bottom)); 2077 CHECK(info.This()->Equals(bottom));
2066 return v8::Handle<v8::Boolean>();
2067 } 2078 }
2068 2079
2069 2080
2070 v8::Handle<v8::Boolean> CheckThisNamedPropertyDeleter( 2081 void CheckThisIndexedPropertyEnumerator(
2071 Local<String> property, 2082 const v8::PropertyCallbackInfo<v8::Array>& info) {
2072 const AccessorInfo& info) { 2083 CheckReturnValue(info);
2073 ApiTestFuzzer::Fuzz(); 2084 ApiTestFuzzer::Fuzz();
2074 CHECK(info.This()->Equals(bottom)); 2085 CHECK(info.This()->Equals(bottom));
2075 return v8::Handle<v8::Boolean>();
2076 } 2086 }
2077 2087
2078 2088
2079 v8::Handle<v8::Array> CheckThisIndexedPropertyEnumerator( 2089 void CheckThisNamedPropertyEnumerator(
2080 const AccessorInfo& info) { 2090 const v8::PropertyCallbackInfo<v8::Array>& info) {
2091 CheckReturnValue(info);
2081 ApiTestFuzzer::Fuzz(); 2092 ApiTestFuzzer::Fuzz();
2082 CHECK(info.This()->Equals(bottom)); 2093 CHECK(info.This()->Equals(bottom));
2083 return v8::Handle<v8::Array>();
2084 } 2094 }
2085 2095
2086 2096
2087 v8::Handle<v8::Array> CheckThisNamedPropertyEnumerator(
2088 const AccessorInfo& info) {
2089 ApiTestFuzzer::Fuzz();
2090 CHECK(info.This()->Equals(bottom));
2091 return v8::Handle<v8::Array>();
2092 }
2093
2094
2095 THREADED_TEST(PropertyHandlerInPrototype) { 2097 THREADED_TEST(PropertyHandlerInPrototype) {
2096 LocalContext env; 2098 LocalContext env;
2097 v8::HandleScope scope(env->GetIsolate()); 2099 v8::HandleScope scope(env->GetIsolate());
2098 2100
2099 // Set up a prototype chain with three interceptors. 2101 // Set up a prototype chain with three interceptors.
2100 v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(); 2102 v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
2101 templ->InstanceTemplate()->SetIndexedPropertyHandler( 2103 templ->InstanceTemplate()->SetIndexedPropertyHandler(
2102 CheckThisIndexedPropertyHandler, 2104 CheckThisIndexedPropertyHandler,
2103 CheckThisIndexedPropertySetter, 2105 CheckThisIndexedPropertySetter,
2104 CheckThisIndexedPropertyQuery, 2106 CheckThisIndexedPropertyQuery,
(...skipping 16989 matching lines...) Expand 10 before | Expand all | Expand 10 after
19094 i::Semaphore* sem_; 19096 i::Semaphore* sem_;
19095 volatile int sem_value_; 19097 volatile int sem_value_;
19096 }; 19098 };
19097 19099
19098 19100
19099 THREADED_TEST(SemaphoreInterruption) { 19101 THREADED_TEST(SemaphoreInterruption) {
19100 ThreadInterruptTest().RunTest(); 19102 ThreadInterruptTest().RunTest();
19101 } 19103 }
19102 19104
19103 #endif // WIN32 19105 #endif // WIN32
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698