Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Unified Diff: Source/bindings/v8/ScriptPromiseResolverTest.cpp

Issue 197213007: ScriptPromise implementation for V8 Promises (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/ScriptPromiseResolver.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ScriptPromiseResolverTest.cpp
diff --git a/Source/bindings/v8/ScriptPromiseResolverTest.cpp b/Source/bindings/v8/ScriptPromiseResolverTest.cpp
index 30fe569b3bd7aae548ca6a21236852505937a3a8..7787eb6bcfeb35d7815726168d43469486915b43 100644
--- a/Source/bindings/v8/ScriptPromiseResolverTest.cpp
+++ b/Source/bindings/v8/ScriptPromiseResolverTest.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#include "bindings/v8/ScriptPromiseResolver.h"
+#include "RuntimeEnabledFeatures.h"
#include "bindings/v8/DOMWrapperWorld.h"
#include "bindings/v8/ScriptPromise.h"
#include "bindings/v8/V8Binding.h"
@@ -90,20 +91,21 @@ private:
TEST_F(ScriptPromiseResolverTest, initialState)
{
- EXPECT_TRUE(m_resolver->isPending());
+ if (RuntimeEnabledFeatures::scriptPromiseOnV8PromiseEnabled())
+ return;
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
}
TEST_F(ScriptPromiseResolverTest, resolve)
{
- EXPECT_TRUE(m_resolver->isPending());
+ if (RuntimeEnabledFeatures::scriptPromiseOnV8PromiseEnabled())
+ return;
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
m_resolver->resolve(ScriptValue(v8::Integer::New(m_isolate, 3), m_isolate));
- EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
@@ -111,13 +113,13 @@ TEST_F(ScriptPromiseResolverTest, resolve)
TEST_F(ScriptPromiseResolverTest, reject)
{
- EXPECT_TRUE(m_resolver->isPending());
+ if (RuntimeEnabledFeatures::scriptPromiseOnV8PromiseEnabled())
+ return;
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
m_resolver->reject(ScriptValue(v8::Integer::New(m_isolate, 3), m_isolate));
- EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Rejected, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
@@ -125,19 +127,18 @@ TEST_F(ScriptPromiseResolverTest, reject)
TEST_F(ScriptPromiseResolverTest, resolveOverResolve)
{
- EXPECT_TRUE(m_resolver->isPending());
+ if (RuntimeEnabledFeatures::scriptPromiseOnV8PromiseEnabled())
+ return;
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
m_resolver->resolve(ScriptValue(v8::Integer::New(m_isolate, 3), m_isolate));
- EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
m_resolver->resolve(ScriptValue(v8::Integer::New(m_isolate, 4), m_isolate));
- EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
@@ -145,19 +146,18 @@ TEST_F(ScriptPromiseResolverTest, resolveOverResolve)
TEST_F(ScriptPromiseResolverTest, rejectOverResolve)
{
- EXPECT_TRUE(m_resolver->isPending());
+ if (RuntimeEnabledFeatures::scriptPromiseOnV8PromiseEnabled())
+ return;
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
m_resolver->resolve(ScriptValue(v8::Integer::New(m_isolate, 3), m_isolate));
- EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
m_resolver->reject(ScriptValue(v8::Integer::New(m_isolate, 4), m_isolate));
- EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
« no previous file with comments | « Source/bindings/v8/ScriptPromiseResolver.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698