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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutProgressTest.cpp

Issue 1721943002: Don't animate a progress bar if it isn't animated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutProgress.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutProgress.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698