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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <stdlib.h>
6
7 #include "src/v8.h"
8 #include "test/cctest/cctest.h"
9
10
11 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 ;)
12 i::FLAG_harmony_proxies = true;
13 LocalContext context;
14 v8::Isolate* isolate = CcTest::isolate();
15 v8::HandleScope scope(isolate);
16 v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>();
17 v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>();
18
19 v8::Local<v8::Proxy> proxy =
20 v8::Proxy::New(context.local(), target, handler).ToLocalChecked();
21 CHECK(proxy->IsProxy());
22 CHECK(!target->IsProxy());
23 CHECK(!proxy->IsRevoked());
24 CHECK(proxy->GetTarget()->SameValue(target));
25 CHECK(proxy->GetHandler()->SameValue(handler));
26
27 proxy->Revoke();
28 CHECK(proxy->IsProxy());
29 CHECK(!target->IsProxy());
30 CHECK(proxy->IsRevoked());
31 CHECK(proxy->GetTarget()->SameValue(target));
32 CHECK(proxy->GetHandler()->IsNull());
33 }
OLDNEW
« 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