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 14 matching lines...) Expand all Loading... |
25 String* value) { | 25 String* value) { |
26 Function* self = new Function(script_state, value); | 26 Function* self = new Function(script_state, value); |
27 return self->BindToV8Function(); | 27 return self->BindToV8Function(); |
28 } | 28 } |
29 | 29 |
30 private: | 30 private: |
31 Function(ScriptState* script_state, String* value) | 31 Function(ScriptState* script_state, String* value) |
32 : ScriptFunction(script_state), value_(value) {} | 32 : ScriptFunction(script_state), value_(value) {} |
33 | 33 |
34 ScriptValue Call(ScriptValue value) override { | 34 ScriptValue Call(ScriptValue value) override { |
35 ASSERT(!value.IsEmpty()); | 35 DCHECK(!value.IsEmpty()); |
36 *value_ = ToCoreString(value.V8Value() | 36 *value_ = ToCoreString(value.V8Value() |
37 ->ToString(GetScriptState()->GetContext()) | 37 ->ToString(GetScriptState()->GetContext()) |
38 .ToLocalChecked()); | 38 .ToLocalChecked()); |
39 return value; | 39 return value; |
40 } | 40 } |
41 | 41 |
42 String* value_; | 42 String* value_; |
43 }; | 43 }; |
44 | 44 |
45 class ScriptPromiseResolverTest : public ::testing::Test { | 45 class ScriptPromiseResolverTest : public ::testing::Test { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 resolver->Reject(); | 347 resolver->Reject(); |
348 v8::MicrotasksScope::PerformCheckpoint(GetIsolate()); | 348 v8::MicrotasksScope::PerformCheckpoint(GetIsolate()); |
349 | 349 |
350 EXPECT_EQ(String(), on_fulfilled); | 350 EXPECT_EQ(String(), on_fulfilled); |
351 EXPECT_EQ("undefined", on_rejected); | 351 EXPECT_EQ("undefined", on_rejected); |
352 } | 352 } |
353 | 353 |
354 } // namespace | 354 } // namespace |
355 | 355 |
356 } // namespace blink | 356 } // namespace blink |
OLD | NEW |