| 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 "bindings/core/v8/ScriptPromiseResolver.h" | 5 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptFunction.h" | 7 #include "bindings/core/v8/ScriptFunction.h" |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 ScriptState* getScriptState() const { | 54 ScriptState* getScriptState() const { |
| 55 return ScriptState::forMainWorld(&m_pageHolder->frame()); | 55 return ScriptState::forMainWorld(&m_pageHolder->frame()); |
| 56 } | 56 } |
| 57 ExecutionContext* getExecutionContext() const { | 57 ExecutionContext* getExecutionContext() const { |
| 58 return &m_pageHolder->document(); | 58 return &m_pageHolder->document(); |
| 59 } | 59 } |
| 60 v8::Isolate* isolate() const { return getScriptState()->isolate(); } | 60 v8::Isolate* isolate() const { return getScriptState()->isolate(); } |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 TEST_F(ScriptPromiseResolverTest, construct) { | 63 TEST_F(ScriptPromiseResolverTest, construct) { |
| 64 ASSERT_FALSE(getExecutionContext()->activeDOMObjectsAreStopped()); | 64 ASSERT_FALSE(getExecutionContext()->isContextDestroyed()); |
| 65 ScriptState::Scope scope(getScriptState()); | 65 ScriptState::Scope scope(getScriptState()); |
| 66 ScriptPromiseResolver::create(getScriptState()); | 66 ScriptPromiseResolver::create(getScriptState()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 TEST_F(ScriptPromiseResolverTest, resolve) { | 69 TEST_F(ScriptPromiseResolverTest, resolve) { |
| 70 ScriptPromiseResolver* resolver = nullptr; | 70 ScriptPromiseResolver* resolver = nullptr; |
| 71 ScriptPromise promise; | 71 ScriptPromise promise; |
| 72 { | 72 { |
| 73 ScriptState::Scope scope(getScriptState()); | 73 ScriptState::Scope scope(getScriptState()); |
| 74 resolver = ScriptPromiseResolver::create(getScriptState()); | 74 resolver = ScriptPromiseResolver::create(getScriptState()); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 resolver->reject(); | 337 resolver->reject(); |
| 338 v8::MicrotasksScope::PerformCheckpoint(isolate()); | 338 v8::MicrotasksScope::PerformCheckpoint(isolate()); |
| 339 | 339 |
| 340 EXPECT_EQ(String(), onFulfilled); | 340 EXPECT_EQ(String(), onFulfilled); |
| 341 EXPECT_EQ("undefined", onRejected); | 341 EXPECT_EQ("undefined", onRejected); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace | 344 } // namespace |
| 345 | 345 |
| 346 } // namespace blink | 346 } // namespace blink |
| OLD | NEW |