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

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

Issue 26004002: Decouple ScriptPromise creation from ScriptPromiseResolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 years, 2 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
Index: Source/bindings/v8/ScriptPromiseResolverTest.cpp
diff --git a/Source/bindings/v8/ScriptPromiseResolverTest.cpp b/Source/bindings/v8/ScriptPromiseResolverTest.cpp
index 0c6cdab3eb4060191b4c2b008ccd48d6b64bf422..2a2deee1c744ae459215cf44f15edb0d3ac65f68 100644
--- a/Source/bindings/v8/ScriptPromiseResolverTest.cpp
+++ b/Source/bindings/v8/ScriptPromiseResolverTest.cpp
@@ -56,8 +56,8 @@ public:
{
m_perContextData = V8PerContextData::create(m_context.newLocal(m_isolate));
m_perContextData->init();
- m_resolver = ScriptPromiseResolver::create();
- m_promise = m_resolver->promise();
+ m_promise = ScriptPromise::createPending();
+ m_resolver = ScriptPromiseResolver::create(m_promise);
}
void TearDown()
@@ -100,20 +100,6 @@ TEST_F(ScriptPromiseResolverTest, initialState)
EXPECT_TRUE(result()->IsUndefined());
}
-TEST_F(ScriptPromiseResolverTest, fulfill)
-{
- EXPECT_TRUE(m_resolver->isPending());
- EXPECT_EQ(V8PromiseCustom::Pending, state());
- EXPECT_TRUE(result()->IsUndefined());
-
- m_resolver->fulfill(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
-
- EXPECT_FALSE(m_resolver->isPending());
- EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
- ASSERT_TRUE(result()->IsNumber());
- EXPECT_EQ(3, result().As<v8::Integer>()->Value());
-}
-
TEST_F(ScriptPromiseResolverTest, resolve)
{
EXPECT_TRUE(m_resolver->isPending());
@@ -142,33 +128,33 @@ TEST_F(ScriptPromiseResolverTest, reject)
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
}
-TEST_F(ScriptPromiseResolverTest, fulfillOverFulfill)
+TEST_F(ScriptPromiseResolverTest, resolveOverResolve)
{
EXPECT_TRUE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
- m_resolver->fulfill(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
+ m_resolver->resolve(ScriptValue(v8::Integer::New(3, m_isolate), 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->fulfill(ScriptValue(v8::Integer::New(4, m_isolate), m_isolate));
+ m_resolver->resolve(ScriptValue(v8::Integer::New(4, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
}
-TEST_F(ScriptPromiseResolverTest, rejectOverFulfill)
+TEST_F(ScriptPromiseResolverTest, rejectOverResolve)
{
EXPECT_TRUE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
- m_resolver->fulfill(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
+ m_resolver->resolve(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
@@ -182,19 +168,6 @@ TEST_F(ScriptPromiseResolverTest, rejectOverFulfill)
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
}
-TEST_F(ScriptPromiseResolverTest, detach)
-{
- EXPECT_TRUE(m_resolver->isPending());
- EXPECT_EQ(V8PromiseCustom::Pending, state());
- EXPECT_TRUE(result()->IsUndefined());
-
- m_resolver->detach();
-
- EXPECT_FALSE(m_resolver->isPending());
- EXPECT_EQ(V8PromiseCustom::Rejected, state());
- EXPECT_TRUE(result()->IsUndefined());
-}
-
} // namespace
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698