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

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

Issue 1152523002: Remove v8::Private (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.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
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index e6c83849ae4881400eddc34ec268e0e51423c773..630391e93edaec3cfdfaeac3f24b8b042107ae53 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -2434,65 +2434,6 @@ THREADED_TEST(SymbolTemplateProperties) {
}
-THREADED_TEST(PrivateProperties) {
- LocalContext env;
- v8::Isolate* isolate = env->GetIsolate();
- v8::HandleScope scope(isolate);
-
- v8::Local<v8::Object> obj = v8::Object::New(isolate);
- v8::Local<v8::Private> priv1 = v8::Private::New(isolate);
- v8::Local<v8::Private> priv2 =
- v8::Private::New(isolate, v8_str("my-private"));
-
- CcTest::heap()->CollectAllGarbage();
-
- CHECK(priv2->Name()->Equals(v8::String::NewFromUtf8(isolate, "my-private")));
-
- // Make sure delete of a non-existent private symbol property works.
- CHECK(obj->DeletePrivate(priv1));
- CHECK(!obj->HasPrivate(priv1));
-
- CHECK(obj->SetPrivate(priv1, v8::Integer::New(isolate, 1503)));
- CHECK(obj->HasPrivate(priv1));
- CHECK_EQ(1503, obj->GetPrivate(priv1)->Int32Value());
- CHECK(obj->SetPrivate(priv1, v8::Integer::New(isolate, 2002)));
- CHECK(obj->HasPrivate(priv1));
- CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
-
- CHECK_EQ(0u, obj->GetOwnPropertyNames()->Length());
- unsigned num_props = obj->GetPropertyNames()->Length();
- CHECK(obj->Set(v8::String::NewFromUtf8(isolate, "bla"),
- v8::Integer::New(isolate, 20)));
- CHECK_EQ(1u, obj->GetOwnPropertyNames()->Length());
- CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length());
-
- CcTest::heap()->CollectAllGarbage();
-
- // Add another property and delete it afterwards to force the object in
- // slow case.
- CHECK(obj->SetPrivate(priv2, v8::Integer::New(isolate, 2008)));
- CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
- CHECK_EQ(2008, obj->GetPrivate(priv2)->Int32Value());
- CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
- CHECK_EQ(1u, obj->GetOwnPropertyNames()->Length());
-
- CHECK(obj->HasPrivate(priv1));
- CHECK(obj->HasPrivate(priv2));
- CHECK(obj->DeletePrivate(priv2));
- CHECK(obj->HasPrivate(priv1));
- CHECK(!obj->HasPrivate(priv2));
- CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
- CHECK_EQ(1u, obj->GetOwnPropertyNames()->Length());
-
- // Private properties are inherited (for the time being).
- v8::Local<v8::Object> child = v8::Object::New(isolate);
- child->SetPrototype(obj);
- CHECK(child->HasPrivate(priv1));
- CHECK_EQ(2002, child->GetPrivate(priv1)->Int32Value());
- CHECK_EQ(0u, child->GetOwnPropertyNames()->Length());
-}
-
-
THREADED_TEST(GlobalSymbols) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
@@ -2541,28 +2482,6 @@ THREADED_TEST(WellKnownSymbols) {
}
-THREADED_TEST(GlobalPrivates) {
- LocalContext env;
- v8::Isolate* isolate = env->GetIsolate();
- v8::HandleScope scope(isolate);
-
- v8::Local<String> name = v8_str("my-private");
- v8::Local<v8::Private> glob = v8::Private::ForApi(isolate, name);
- v8::Local<v8::Object> obj = v8::Object::New(isolate);
- CHECK(obj->SetPrivate(glob, v8::Integer::New(isolate, 3)));
-
- v8::Local<v8::Private> glob2 = v8::Private::ForApi(isolate, name);
- CHECK(obj->HasPrivate(glob2));
-
- v8::Local<v8::Private> priv = v8::Private::New(isolate, name);
- CHECK(!obj->HasPrivate(priv));
-
- CompileRun("var intern = %CreateGlobalPrivateSymbol('my-private')");
- v8::Local<Value> intern = env->Global()->Get(v8_str("intern"));
- CHECK(!obj->Has(intern));
-}
-
-
class ScopedArrayBufferContents {
public:
explicit ScopedArrayBufferContents(const v8::ArrayBuffer::Contents& contents)
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698