| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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 "config.h" | 5 #include "config.h" |
| 6 #include "bindings/core/v8/ScriptPromiseProperty.h" | 6 #include "bindings/core/v8/ScriptPromiseProperty.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/DOMWrapperWorld.h" | 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
| 10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // These tests use Event because it is simple to manufacture lots | 93 // These tests use Event because it is simple to manufacture lots |
| 94 // of events, and 'Ready' because it is an available property name | 94 // of events, and 'Ready' because it is an available property name |
| 95 // that won't bloat V8HiddenValue with a test property name. | 95 // that won't bloat V8HiddenValue with a test property name. |
| 96 | 96 |
| 97 ScriptValue wrap(PassRefPtrWillBeRawPtr<Event> event) | 97 ScriptValue wrap(PassRefPtrWillBeRawPtr<Event> event) |
| 98 { | 98 { |
| 99 ScriptState::Scope scope(scriptState()); | 99 ScriptState::Scope scope(scriptState()); |
| 100 return ScriptValue(scriptState(), V8ValueTraits<PassRefPtrWillBeRawPtr<E
vent> >::toV8Value(event, scriptState()->context()->Global(), isolate())); | 100 return ScriptValue(scriptState(), V8ValueTraits<PassRefPtrWillBeRawPtr<E
vent> >::toV8Value(event, scriptState()->context()->Global(), isolate())); |
| 101 } | 101 } |
| 102 | 102 |
| 103 typedef ScriptPromiseProperty<RefPtrWillBeMember<Event>, Event*, Event*> Pro
perty; | 103 typedef ScriptPromiseProperty<RefPtrWillBeMember<Event>, RefPtrWillBeMember<
Event>, RefPtrWillBeMember<Event> > Property; |
| 104 PassRefPtrWillBeRawPtr<Property> newProperty() { return Property::create(&do
cument(), Event::create(), Property::Ready); } | 104 PassRefPtrWillBeRawPtr<Property> newProperty() { return Property::create(&do
cument(), Event::create(), Property::Ready); } |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 OwnPtr<DummyPageHolder> m_page; | 107 OwnPtr<DummyPageHolder> m_page; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 TEST_F(ScriptPromisePropertyTest, Promise_IsStableObject) | 110 TEST_F(ScriptPromisePropertyTest, Promise_IsStableObject) |
| 111 { | 111 { |
| 112 RefPtr<Property> p(newProperty()); | 112 RefPtr<Property> p(newProperty()); |
| 113 ScriptPromise v = p->promise(DOMWrapperWorld::mainWorld()); | 113 ScriptPromise v = p->promise(DOMWrapperWorld::mainWorld()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 destroyContext(); | 222 destroyContext(); |
| 223 | 223 |
| 224 RefPtrWillBeRawPtr<Event> event(Event::create()); | 224 RefPtrWillBeRawPtr<Event> event(Event::create()); |
| 225 p->resolve(event.get()); | 225 p->resolve(event.get()); |
| 226 EXPECT_EQ(Property::Pending, p->state()); | 226 EXPECT_EQ(Property::Pending, p->state()); |
| 227 | 227 |
| 228 v8::Isolate::GetCurrent()->RunMicrotasks(); | 228 v8::Isolate::GetCurrent()->RunMicrotasks(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace | 231 } // namespace |
| OLD | NEW |