| Index: Source/core/testing/Internals.cpp
|
| diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
|
| index dba52a6173c98d9155fade3f81ddbb891aabd9fc..64e85acbd61b11724196d5466209ef86a68f0975 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/css/StyleSheetContents.h"
|
| @@ -2076,4 +2078,26 @@ 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;
|
| + }
|
| +};
|
| +
|
| +ScriptValue Internals::addOneToPromise(ScriptValue promiseValue)
|
| +{
|
| + ScriptPromise promise(promiseValue);
|
| +
|
| + bool result = promise.then(adoptRef(new AddOneCallback()));
|
| + ASSERT(result);
|
| +
|
| + return promise.ResultPromise();
|
| +}
|
| +
|
| }
|
|
|