Commit 089bee64 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Advance lifecycle to kInStyleRecalc before resolving style in tests.

Trying to add DCHECKs to avoid StyleResolver::StyleForElement() and
PseudoStyleForElement() caused a few unit tests to break. This CL
advances the lifecycle to allow StyleForElement() to be called on a
style-dirty tree in style_resolver_test.cc.

Change-Id: Ice81c60cd704f6b718b2a781adf93bc069294446
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352732Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797592}
parent 5c043568
......@@ -139,6 +139,7 @@ TEST_F(StyleResolverTest, BaseReusableIfFontRelativeUnitsAbsent) {
EXPECT_EQ("50px", ComputedValue("font-size", *StyleForId("div")));
div->SetNeedsAnimationStyleRecalc();
GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInStyleRecalc);
StyleForId("div");
ASSERT_TRUE(div->GetElementAnimations());
......@@ -170,6 +171,7 @@ TEST_F(StyleResolverTest, AnimationNotMaskedByImportant) {
EXPECT_EQ("10px", ComputedValue("height", *StyleForId("div")));
div->SetNeedsAnimationStyleRecalc();
GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInStyleRecalc);
StyleForId("div");
ASSERT_TRUE(div->GetElementAnimations());
......@@ -209,6 +211,7 @@ TEST_F(StyleResolverTest, AnimationNotMaskedWithoutBitset) {
EXPECT_EQ("10px", ComputedValue("height", *StyleForId("div")));
div->SetNeedsAnimationStyleRecalc();
GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInStyleRecalc);
StyleForId("div");
ASSERT_TRUE(div->GetElementAnimations());
......@@ -239,6 +242,7 @@ TEST_F(StyleResolverTest, AnimationMaskedByImportant) {
EXPECT_EQ("10px", ComputedValue("height", *StyleForId("div")));
div->SetNeedsAnimationStyleRecalc();
GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInStyleRecalc);
StyleForId("div");
ASSERT_TRUE(div->GetElementAnimations());
......@@ -387,6 +391,7 @@ TEST_P(StyleResolverFontRelativeUnitTest,
EXPECT_EQ("50px", ComputedValue("font-size", *StyleForId("div")));
div->SetNeedsAnimationStyleRecalc();
GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInStyleRecalc);
auto computed_style = StyleForId("div");
EXPECT_TRUE(computed_style->HasFontRelativeUnits());
......@@ -411,6 +416,7 @@ TEST_P(StyleResolverFontRelativeUnitTest,
EXPECT_EQ("50px", ComputedValue("height", *StyleForId("div")));
div->SetNeedsAnimationStyleRecalc();
GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInStyleRecalc);
auto computed_style = StyleForId("div");
EXPECT_TRUE(computed_style->HasFontRelativeUnits());
......
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