| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "include/v8.h" | 7 #include "include/v8.h" |
| 8 #include "test/unittests/test-utils.h" | 8 #include "test/unittests/test-utils.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 Local<FunctionTemplate> constructor_template = | 57 Local<FunctionTemplate> constructor_template = |
| 58 FunctionTemplate::New(isolate(), Constructor); | 58 FunctionTemplate::New(isolate(), Constructor); |
| 59 constructor_template->InstanceTemplate()->SetAccessCheckCallbackAndHandler( | 59 constructor_template->InstanceTemplate()->SetAccessCheckCallbackAndHandler( |
| 60 AccessCheck, NamedPropertyHandlerConfiguration(NamedGetter), | 60 AccessCheck, NamedPropertyHandlerConfiguration(NamedGetter), |
| 61 IndexedPropertyHandlerConfiguration()); | 61 IndexedPropertyHandlerConfiguration()); |
| 62 constructor_template->Inherit(parent_template); | 62 constructor_template->Inherit(parent_template); |
| 63 | 63 |
| 64 Local<Object> remote_context = | 64 Local<Object> remote_context = |
| 65 Context::NewRemoteContext(isolate(), | 65 Context::NewRemoteContext(isolate(), |
| 66 constructor_template->InstanceTemplate()) | 66 constructor_template->InstanceTemplate()) |
| 67 .ToLocalChecked(); | 67 .ToLocalChecked(); |
| 68 EXPECT_TRUE(parent_template->HasInstance(remote_context)); | 68 EXPECT_TRUE(parent_template->HasInstance(remote_context)); |
| 69 EXPECT_TRUE(constructor_template->HasInstance(remote_context)); | 69 EXPECT_TRUE(constructor_template->HasInstance(remote_context)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 TEST_F(RemoteObjectTest, TypeOfRemoteContext) { |
| 73 Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate()); |
| 74 global_template->SetAccessCheckCallbackAndHandler( |
| 75 AccessCheck, NamedPropertyHandlerConfiguration(NamedGetter), |
| 76 IndexedPropertyHandlerConfiguration()); |
| 77 Local<Object> remote_context = |
| 78 Context::NewRemoteContext(isolate(), global_template).ToLocalChecked(); |
| 79 String::Utf8Value result(remote_context->TypeOf(isolate())); |
| 80 EXPECT_STREQ("object", *result); |
| 81 } |
| 82 |
| 72 } // namespace v8 | 83 } // namespace v8 |
| OLD | NEW |