Index: Source/core/testing/Internals.cpp |
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
index 35e8ee2f5ac32dd40bc3d67d125827f1c6de25e6..05c3fe2d9118da9de96341eb980f4e74c970e710 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" |
@@ -2381,6 +2382,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)); |