OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/layout/LayoutProgress.h" |
| 6 |
| 7 #include "core/HTMLNames.h" |
| 8 #include "core/html/HTMLElement.h" |
| 9 #include "core/layout/LayoutTestHelper.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class LayoutProgressTest : public RenderingTest { |
| 15 public: |
| 16 static bool isAnimationTimerActive(const LayoutProgress* o) { return o->isAn
imationTimerActive(); } |
| 17 static bool isAnimatiing(const LayoutProgress* o) { return o->isAnimating();
} |
| 18 }; |
| 19 |
| 20 TEST_F(LayoutProgressTest, AnimationScheduling) |
| 21 { |
| 22 RenderingTest::setBodyInnerHTML("<progress id=\"progressElement\" value=0.3
max=1.0></progress>"); |
| 23 document().view()->updateAllLifecyclePhases(); |
| 24 Element* progressElement = document().getElementById(AtomicString("progressE
lement")); |
| 25 LayoutProgress* layoutProgress = toLayoutProgress(progressElement->layoutObj
ect()); |
| 26 |
| 27 // Verify that we do not schedule a timer for a determinant progress element |
| 28 EXPECT_FALSE(LayoutProgressTest::isAnimationTimerActive(layoutProgress)); |
| 29 EXPECT_FALSE(LayoutProgressTest::isAnimatiing(layoutProgress)); |
| 30 |
| 31 progressElement->removeAttribute("value"); |
| 32 document().view()->updateAllLifecyclePhases(); |
| 33 |
| 34 // Verify that we schedule a timer for an indeterminant progress element |
| 35 EXPECT_TRUE(LayoutProgressTest::isAnimationTimerActive(layoutProgress)); |
| 36 EXPECT_TRUE(LayoutProgressTest::isAnimatiing(layoutProgress)); |
| 37 |
| 38 progressElement->setAttribute(HTMLNames::valueAttr, "0.7"); |
| 39 document().view()->updateAllLifecyclePhases(); |
| 40 |
| 41 // Verify that we cancel the timer for a determinant progress element |
| 42 EXPECT_FALSE(LayoutProgressTest::isAnimationTimerActive(layoutProgress)); |
| 43 EXPECT_FALSE(LayoutProgressTest::isAnimatiing(layoutProgress)); |
| 44 } |
| 45 |
| 46 } // namespace blink |
OLD | NEW |