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

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

Issue 40324: Allow hidden properties and implement GetIdentityHash (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « src/objects.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
===================================================================
--- test/cctest/test-api.cc (revision 1540)
+++ test/cctest/test-api.cc (working copy)
@@ -1255,6 +1255,39 @@
}
+THREADED_TEST(IdentityHash) {
+ v8::HandleScope scope;
+ LocalContext env;
+
+ Local<v8::Object> obj = v8::Object::New();
+ int hash = obj->GetIdentityHash();
+ int hash1 = obj->GetIdentityHash();
+ CHECK_EQ(hash, hash1);
+ int hash2 = v8::Object::New()->GetIdentityHash();
+ CHECK_NE(hash, hash2);
+ i::Heap::CollectAllGarbage();
+ int hash3 = v8::Object::New()->GetIdentityHash();
+ CHECK_NE(hash, hash3);
+ int hash4 = obj->GetIdentityHash();
+ CHECK_EQ(hash, hash4);
+}
+
+
+THREADED_TEST(HiddenProperties) {
+ v8::HandleScope scope;
+ LocalContext env;
+
+ v8::Local<v8::Object> obj = v8::Object::New();
+ v8::Local<v8::String> key = v8_str("api-test::hidden-key");
+ CHECK(obj->SetHiddenValue(key, v8::Integer::New(1503)));
+ CHECK_EQ(1503, obj->GetHiddenValue(key)->Int32Value());
+ CHECK(obj->SetHiddenValue(key, v8::Integer::New(2002)));
+ CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
+ CHECK(obj->DeleteHiddenValue(key));
+ CHECK(obj->GetHiddenValue(key)->IsUndefined());
+}
+
+
THREADED_TEST(External) {
v8::HandleScope scope;
int x = 3;
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698