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

Side by Side Diff: third_party/WebKit/Source/core/animation/CompositorAnimationsSimTest.cpp

Issue 1727443002: Blink CompositorAnimations: Add more tests for integration with CC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebasing. Created 4 years, 10 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 | « no previous file | third_party/WebKit/Source/core/core.gypi » ('j') | 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
6 #include "core/animation/AnimationTimeline.h"
7 #include "core/animation/ElementAnimations.h"
8 #include "web/tests/sim/SimCompositor.h"
9 #include "web/tests/sim/SimDisplayItemList.h"
10 #include "web/tests/sim/SimRequest.h"
11 #include "web/tests/sim/SimTest.h"
12
13 namespace blink {
14
15 class CompositorAnimationsSimTest : public SimTest {
16 public:
17 };
18
19 TEST_F(CompositorAnimationsSimTest, CancelCompositorAnimationIfAnimationDisposed )
20 {
21 const String html = "<html><body>"
22 "<div id=element></div>"
23 "<script>"
24 "element.animate([{opacity: 0}, {opacity: 1}], {duration: 1});"
25 "requestAnimationFrame(() => {"
26 " requestAnimationFrame(() => {"
27 " element.animate([{opacity: 1}, {opacity: 0}], {duration: 1});"
28 " });"
29 "});"
30 "</script>"
31 "</body></html>";
32 SimRequest request("https://example.com/", "text/html");
33
34 loadURL("https://example.com/");
35 request.complete(html);
36
37 // 1st animation frame.
38 compositor().beginFrame();
39
40 Element* element = toHTMLElement(document().getElementById("element"));
41 EXPECT_TRUE(element);
42 EXPECT_TRUE(element->hasAnimations());
43
44 ElementAnimations* animations = element->elementAnimations();
45 EXPECT_EQ(1u, animations->animations().size());
46
47 for (const auto& entry : animations->animations()) {
48 Animation* animation = entry.key;
49 EXPECT_TRUE(animation->hasActiveAnimationsOnCompositor());
50 }
51
52 // Destroy compositor animation players.
53 document().timeline().dispose();
54
55 // 2nd animation frame.
56 // Cancel incompatible compositor animations. This shouldn't crash.
57 compositor().beginFrame();
58
59 EXPECT_EQ(2u, animations->animations().size());
60 for (const auto& entry : animations->animations()) {
61 Animation* animation = entry.key;
62 EXPECT_FALSE(animation->hasActiveAnimationsOnCompositor());
63 }
64 }
65
66 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698