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

Unified Diff: test/cctest/test-proxies.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: messing around with branches 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 | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-proxies.cc
diff --git a/test/cctest/test-proxies.cc b/test/cctest/test-proxies.cc
new file mode 100644
index 0000000000000000000000000000000000000000..db9e30d41e38dc1f5f055e13cf5faad9ffc5f4c4
--- /dev/null
+++ b/test/cctest/test-proxies.cc
@@ -0,0 +1,33 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdlib.h>
+
+#include "src/v8.h"
+#include "test/cctest/cctest.h"
+
+
+TEST(Proxy) {
Yang 2015/12/22 14:47:55 I would have put this in test-api.cc, where all ot
Camillo Bruni 2015/12/22 14:52:24 can do, I preferred a separate file ;)
+ 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 | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698