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

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

Issue 1542943002: [proxies] Expose proxies in the API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-12-17_JSProxy_d8_printing_1530293004
Patch Set: adressing comments Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('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 15cb651909b925663ede878e940e73775e298816..12e99a08474feee263357cfc58d938b2fbc258a2 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -24287,3 +24287,28 @@ TEST(ObjectTemplateIntrinsics) {
CHECK_EQ(fn2->GetCreationContext(), *ctx2);
}
}
+
+
+TEST(Proxy) {
+ i::FLAG_harmony_proxies = true;
+ LocalContext context;
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>();
+ v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>();
+
+ v8::Local<v8::Proxy> proxy =
+ v8::Proxy::New(context.local(), target, handler).ToLocalChecked();
+ CHECK(proxy->IsProxy());
+ CHECK(!target->IsProxy());
+ CHECK(!proxy->IsRevoked());
+ CHECK(proxy->GetTarget()->SameValue(target));
+ CHECK(proxy->GetHandler()->SameValue(handler));
+
+ proxy->Revoke();
+ CHECK(proxy->IsProxy());
+ CHECK(!target->IsProxy());
+ CHECK(proxy->IsRevoked());
+ CHECK(proxy->GetTarget()->SameValue(target));
+ CHECK(proxy->GetHandler()->IsNull());
+}
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698