Commit 9ba7f1df authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

[Code health] Move the position of a test in paint_worklet_test.cc

This CL moves the position of a test so that these tests are grouped
together.

Bug: None
Change-Id: Ib84a2898bb6d5566b4a4c19f37c6e85de0ccacfc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872010Reviewed-by: default avatarYi Gu <yigu@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707788}
parent 9b44d19a
...@@ -291,6 +291,32 @@ TEST_P(MainOrOffThreadPaintWorkletTest, ConsistentGlobalScopeOnMainThread) { ...@@ -291,6 +291,32 @@ TEST_P(MainOrOffThreadPaintWorkletTest, ConsistentGlobalScopeOnMainThread) {
EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("bar")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("bar"));
} }
TEST_P(MainOrOffThreadPaintWorkletTest, AllGlobalScopesMustBeCreated) {
PaintWorklet* paint_worklet_to_test =
MakeGarbageCollected<PaintWorklet>(&GetFrame());
EXPECT_TRUE(paint_worklet_to_test->GetGlobalScopesForTesting().IsEmpty());
std::unique_ptr<PaintWorkletPaintDispatcher> dispatcher =
std::make_unique<PaintWorkletPaintDispatcher>();
Persistent<PaintWorkletProxyClient> proxy_client =
MakeGarbageCollected<PaintWorkletProxyClient>(
1, paint_worklet_to_test, dispatcher->GetWeakPtr(), nullptr);
paint_worklet_to_test->SetProxyClientForTesting(proxy_client);
while (paint_worklet_to_test->NeedsToCreateGlobalScopeForTesting()) {
paint_worklet_to_test->AddGlobalScopeForTesting();
}
if (RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled()) {
EXPECT_EQ(paint_worklet_to_test->GetGlobalScopesForTesting().size(),
2 * PaintWorklet::kNumGlobalScopesPerThread);
} else {
EXPECT_EQ(paint_worklet_to_test->GetGlobalScopesForTesting().size(),
PaintWorklet::kNumGlobalScopesPerThread);
}
}
TEST_F(PaintWorkletTest, ConsistentGlobalScopeCrossThread) { TEST_F(PaintWorkletTest, ConsistentGlobalScopeCrossThread) {
ScopedOffMainThreadCSSPaintForTest off_main_thread_css_paint(true); ScopedOffMainThreadCSSPaintForTest off_main_thread_css_paint(true);
PaintWorklet* paint_worklet_to_test = PaintWorklet* paint_worklet_to_test =
...@@ -516,30 +542,4 @@ TEST_F(PaintWorkletTest, GeneratorNotifiedAfterAllRegistrations) { ...@@ -516,30 +542,4 @@ TEST_F(PaintWorkletTest, GeneratorNotifiedAfterAllRegistrations) {
EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo")); EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo"));
} }
TEST_P(MainOrOffThreadPaintWorkletTest, AllGlobalScopesMustBeCreated) {
PaintWorklet* paint_worklet_to_test =
MakeGarbageCollected<PaintWorklet>(&GetFrame());
EXPECT_TRUE(paint_worklet_to_test->GetGlobalScopesForTesting().IsEmpty());
std::unique_ptr<PaintWorkletPaintDispatcher> dispatcher =
std::make_unique<PaintWorkletPaintDispatcher>();
Persistent<PaintWorkletProxyClient> proxy_client =
MakeGarbageCollected<PaintWorkletProxyClient>(
1, paint_worklet_to_test, dispatcher->GetWeakPtr(), nullptr);
paint_worklet_to_test->SetProxyClientForTesting(proxy_client);
while (paint_worklet_to_test->NeedsToCreateGlobalScopeForTesting()) {
paint_worklet_to_test->AddGlobalScopeForTesting();
}
if (RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled()) {
EXPECT_EQ(paint_worklet_to_test->GetGlobalScopesForTesting().size(),
2 * PaintWorklet::kNumGlobalScopesPerThread);
} else {
EXPECT_EQ(paint_worklet_to_test->GetGlobalScopesForTesting().size(),
PaintWorklet::kNumGlobalScopesPerThread);
}
}
} // namespace blink } // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment