| Index: Source/core/testing/Internals.cpp
|
| diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
|
| index 2d48ab6bd45c67331cad339499240f8995ed7520..da71c45f10390506f9b884cdb9b377de89d10a1a 100644
|
| --- a/Source/core/testing/Internals.cpp
|
| +++ b/Source/core/testing/Internals.cpp
|
| @@ -39,6 +39,8 @@
|
| #include "RuntimeEnabledFeatures.h"
|
| #include "TypeConversions.h"
|
| #include "bindings/v8/ExceptionState.h"
|
| +#include "bindings/v8/ScriptFunction.h"
|
| +#include "bindings/v8/ScriptPromise.h"
|
| #include "bindings/v8/SerializedScriptValue.h"
|
| #include "bindings/v8/V8ThrowException.h"
|
| #include "core/animation/DocumentTimeline.h"
|
| @@ -2079,4 +2081,28 @@ bool Internals::loseSharedGraphicsContext3D()
|
| return true;
|
| }
|
|
|
| +class AddOneCallback : public ScriptFunction {
|
| +public:
|
| + virtual ScriptValue call(ScriptValue value) OVERRIDE
|
| + {
|
| + v8::Local<v8::Value> v8Value = value.v8Value();
|
| + ASSERT(v8Value->IsNumber());
|
| + int intValue = v8Value.As<v8::Integer>()->Value();
|
| + ScriptValue result = ScriptValue(v8::Integer::New(intValue + 1));
|
| + return result;
|
| + }
|
| +private:
|
| + virtual ~AddOneCallback() { }
|
| +};
|
| +
|
| +ScriptValue Internals::addOneToPromise(ScriptValue promiseValue)
|
| +{
|
| + ScriptPromise promise(promiseValue);
|
| +
|
| + bool result = promise.then(adoptRef(new AddOneCallback()));
|
| + ASSERT(result);
|
| +
|
| + return promise.ResultPromise();
|
| +}
|
| +
|
| }
|
|
|