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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptedAnimationControllerTest.cpp

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/ScriptedAnimationController.h" 5 #include "core/dom/ScriptedAnimationController.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/FrameRequestCallback.h" 8 #include "core/dom/FrameRequestCallback.h"
9 #include "core/events/Event.h" 9 #include "core/events/Event.h"
10 #include "core/events/EventListener.h" 10 #include "core/events/EventListener.h"
(...skipping 27 matching lines...) Expand all
38 // Document::ensureScriptedAnimationController is called. 38 // Document::ensureScriptedAnimationController is called.
39 m_controller = 39 m_controller =
40 wrapPersistent(ScriptedAnimationController::create(&document())); 40 wrapPersistent(ScriptedAnimationController::create(&document()));
41 } 41 }
42 42
43 namespace { 43 namespace {
44 44
45 class TaskOrderObserver { 45 class TaskOrderObserver {
46 public: 46 public:
47 std::unique_ptr<WTF::Closure> createTask(int id) { 47 std::unique_ptr<WTF::Closure> createTask(int id) {
48 return WTF::bind(&TaskOrderObserver::runTask, unretained(this), id); 48 return WTF::bind(&TaskOrderObserver::runTask, WTF::unretained(this), id);
49 } 49 }
50 const Vector<int>& order() const { return m_order; } 50 const Vector<int>& order() const { return m_order; }
51 51
52 private: 52 private:
53 void runTask(int id) { m_order.append(id); } 53 void runTask(int id) { m_order.append(id); }
54 Vector<int> m_order; 54 Vector<int> m_order;
55 }; 55 };
56 56
57 } // anonymous namespace 57 } // anonymous namespace
58 58
(...skipping 30 matching lines...) Expand all
89 } 89 }
90 90
91 } // anonymous namespace 91 } // anonymous namespace
92 92
93 // A task enqueued while running tasks should not be run immediately after, but 93 // A task enqueued while running tasks should not be run immediately after, but
94 // the next time tasks are run. 94 // the next time tasks are run.
95 TEST_F(ScriptedAnimationControllerTest, EnqueueWithinTask) { 95 TEST_F(ScriptedAnimationControllerTest, EnqueueWithinTask) {
96 TaskOrderObserver observer; 96 TaskOrderObserver observer;
97 97
98 controller().enqueueTask(observer.createTask(1)); 98 controller().enqueueTask(observer.createTask(1));
99 controller().enqueueTask(WTF::bind( 99 controller().enqueueTask(WTF::bind(&enqueueTask,
100 &enqueueTask, wrapPersistent(&controller()), unretained(&observer), 2)); 100 wrapPersistent(&controller()),
101 WTF::unretained(&observer), 2));
101 controller().enqueueTask(observer.createTask(3)); 102 controller().enqueueTask(observer.createTask(3));
102 EXPECT_EQ(0u, observer.order().size()); 103 EXPECT_EQ(0u, observer.order().size());
103 104
104 controller().serviceScriptedAnimations(0); 105 controller().serviceScriptedAnimations(0);
105 EXPECT_EQ(2u, observer.order().size()); 106 EXPECT_EQ(2u, observer.order().size());
106 EXPECT_EQ(1, observer.order()[0]); 107 EXPECT_EQ(1, observer.order()[0]);
107 EXPECT_EQ(3, observer.order()[1]); 108 EXPECT_EQ(3, observer.order()[1]);
108 109
109 controller().serviceScriptedAnimations(0); 110 controller().serviceScriptedAnimations(0);
110 EXPECT_EQ(3u, observer.order().size()); 111 EXPECT_EQ(3u, observer.order().size());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 controller().enqueueTask(observer.createTask(2)); 176 controller().enqueueTask(observer.createTask(2));
176 EXPECT_EQ(0u, observer.order().size()); 177 EXPECT_EQ(0u, observer.order().size());
177 178
178 controller().serviceScriptedAnimations(0); 179 controller().serviceScriptedAnimations(0);
179 EXPECT_EQ(2u, observer.order().size()); 180 EXPECT_EQ(2u, observer.order().size());
180 EXPECT_EQ(2, observer.order()[0]); 181 EXPECT_EQ(2, observer.order()[0]);
181 EXPECT_EQ(1, observer.order()[1]); 182 EXPECT_EQ(1, observer.order()[1]);
182 } 183 }
183 184
184 } // namespace blink 185 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/MessagePort.cpp ('k') | third_party/WebKit/Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698