Index: Source/core/testing/Internals.cpp |
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
index 65bd2e614f46fe1463efcd8805cd0b9aae2a3ed1..2d4b150b353643fe93ad576e86afc9ef9ba2e311 100644 |
--- a/Source/core/testing/Internals.cpp |
+++ b/Source/core/testing/Internals.cpp |
@@ -42,6 +42,7 @@ |
#include "bindings/v8/ExceptionState.h" |
#include "bindings/v8/ScriptFunction.h" |
#include "bindings/v8/ScriptPromise.h" |
+#include "bindings/v8/ScriptPromiseResolver.h" |
#include "bindings/v8/SerializedScriptValue.h" |
#include "bindings/v8/V8ThrowException.h" |
#include "core/animation/DocumentTimeline.h" |
@@ -2380,6 +2381,27 @@ private: |
} // namespace |
+ScriptPromise Internals::createPromise(ExecutionContext* context) |
+{ |
+ return ScriptPromiseResolver::create(context)->promise(); |
+} |
+ |
+ScriptPromise Internals::createResolvedPromise(ExecutionContext* context, ScriptValue value) |
+{ |
+ RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(context); |
+ ScriptPromise promise = resolver->promise(); |
+ resolver->resolve(value); |
+ return promise; |
+} |
+ |
+ScriptPromise Internals::createRejectedPromise(ExecutionContext* context, ScriptValue value) |
+{ |
+ RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(context); |
+ ScriptPromise promise = resolver->promise(); |
+ resolver->reject(value); |
+ return promise; |
+} |
+ |
ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromise promise) |
{ |
return promise.then(AddOneFunction::create(context)); |