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

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

Issue 1159433003: Use GetProperty for getting elements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
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 7419 matching lines...) Expand 10 before | Expand all | Expand 10 after
7430 v8::Handle<String> str = v8_str("42"); 7430 v8::Handle<String> str = v8_str("42");
7431 v8::Handle<v8::Uint32> index = str->ToArrayIndex(); 7431 v8::Handle<v8::Uint32> index = str->ToArrayIndex();
7432 CHECK(!index.IsEmpty()); 7432 CHECK(!index.IsEmpty());
7433 CHECK_EQ(42.0, index->Uint32Value()); 7433 CHECK_EQ(42.0, index->Uint32Value());
7434 str = v8_str("42asdf"); 7434 str = v8_str("42asdf");
7435 index = str->ToArrayIndex(); 7435 index = str->ToArrayIndex();
7436 CHECK(index.IsEmpty()); 7436 CHECK(index.IsEmpty());
7437 str = v8_str("-42"); 7437 str = v8_str("-42");
7438 index = str->ToArrayIndex(); 7438 index = str->ToArrayIndex();
7439 CHECK(index.IsEmpty()); 7439 CHECK(index.IsEmpty());
7440 str = v8_str("4294967295"); 7440 str = v8_str("4294967294");
7441 index = str->ToArrayIndex(); 7441 index = str->ToArrayIndex();
7442 CHECK(!index.IsEmpty()); 7442 CHECK(!index.IsEmpty());
7443 CHECK_EQ(4294967295.0, index->Uint32Value()); 7443 CHECK_EQ(4294967294.0, index->Uint32Value());
7444 v8::Handle<v8::Number> num = v8::Number::New(isolate, 1); 7444 v8::Handle<v8::Number> num = v8::Number::New(isolate, 1);
7445 index = num->ToArrayIndex(); 7445 index = num->ToArrayIndex();
7446 CHECK(!index.IsEmpty()); 7446 CHECK(!index.IsEmpty());
7447 CHECK_EQ(1.0, index->Uint32Value()); 7447 CHECK_EQ(1.0, index->Uint32Value());
7448 num = v8::Number::New(isolate, -1); 7448 num = v8::Number::New(isolate, -1);
7449 index = num->ToArrayIndex(); 7449 index = num->ToArrayIndex();
7450 CHECK(index.IsEmpty()); 7450 CHECK(index.IsEmpty());
7451 v8::Handle<v8::Object> obj = v8::Object::New(isolate); 7451 v8::Handle<v8::Object> obj = v8::Object::New(isolate);
7452 index = obj->ToArrayIndex(); 7452 index = obj->ToArrayIndex();
7453 CHECK(index.IsEmpty()); 7453 CHECK(index.IsEmpty());
(...skipping 13663 matching lines...) Expand 10 before | Expand all | Expand 10 after
21117 // add the testExtraShouldReturnFive export 21117 // add the testExtraShouldReturnFive export
21118 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); 21118 v8::Local<v8::Object> exports = env->GetExtrasExportsObject();
21119 21119
21120 auto func = 21120 auto func =
21121 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); 21121 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>();
21122 auto undefined = v8::Undefined(isolate); 21122 auto undefined = v8::Undefined(isolate);
21123 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); 21123 auto result = func->Call(undefined, 0, {}).As<v8::Number>();
21124 21124
21125 CHECK(result->Value() == 5.0); 21125 CHECK(result->Value() == 5.0);
21126 } 21126 }
OLDNEW
« src/objects-inl.h ('K') | « src/utils.h ('k') | test/cctest/test-api-interceptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698