| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 public: | 46 public: |
| 47 ScriptPromiseResolverTest() : m_pageHolder(DummyPageHolder::create()) {} | 47 ScriptPromiseResolverTest() : m_pageHolder(DummyPageHolder::create()) {} |
| 48 | 48 |
| 49 ~ScriptPromiseResolverTest() override { | 49 ~ScriptPromiseResolverTest() override { |
| 50 // Execute all pending microtasks | 50 // Execute all pending microtasks |
| 51 v8::MicrotasksScope::PerformCheckpoint(isolate()); | 51 v8::MicrotasksScope::PerformCheckpoint(isolate()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 std::unique_ptr<DummyPageHolder> m_pageHolder; | 54 std::unique_ptr<DummyPageHolder> m_pageHolder; |
| 55 ScriptState* getScriptState() const { | 55 ScriptState* getScriptState() const { |
| 56 return ScriptState::forMainWorld(&m_pageHolder->frame()); | 56 return toScriptStateForMainWorld(&m_pageHolder->frame()); |
| 57 } | 57 } |
| 58 ExecutionContext* getExecutionContext() const { | 58 ExecutionContext* getExecutionContext() const { |
| 59 return &m_pageHolder->document(); | 59 return &m_pageHolder->document(); |
| 60 } | 60 } |
| 61 v8::Isolate* isolate() const { return getScriptState()->isolate(); } | 61 v8::Isolate* isolate() const { return getScriptState()->isolate(); } |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 TEST_F(ScriptPromiseResolverTest, construct) { | 64 TEST_F(ScriptPromiseResolverTest, construct) { |
| 65 ASSERT_FALSE(getExecutionContext()->isContextDestroyed()); | 65 ASSERT_FALSE(getExecutionContext()->isContextDestroyed()); |
| 66 ScriptState::Scope scope(getScriptState()); | 66 ScriptState::Scope scope(getScriptState()); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 resolver->reject(); | 338 resolver->reject(); |
| 339 v8::MicrotasksScope::PerformCheckpoint(isolate()); | 339 v8::MicrotasksScope::PerformCheckpoint(isolate()); |
| 340 | 340 |
| 341 EXPECT_EQ(String(), onFulfilled); | 341 EXPECT_EQ(String(), onFulfilled); |
| 342 EXPECT_EQ("undefined", onRejected); | 342 EXPECT_EQ("undefined", onRejected); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace | 345 } // namespace |
| 346 | 346 |
| 347 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |