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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp

Issue 2644243002: Move ScrollableArea timer to TaskRunnerTimer. (Closed)
Patch Set: use derived class in unique_ptr Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 13 matching lines...) Expand all
24 */ 24 */
25 25
26 // Tests for the ScrollAnimator class. 26 // Tests for the ScrollAnimator class.
27 27
28 #include "platform/scroll/ScrollAnimator.h" 28 #include "platform/scroll/ScrollAnimator.h"
29 29
30 #include "platform/geometry/FloatPoint.h" 30 #include "platform/geometry/FloatPoint.h"
31 #include "platform/geometry/IntRect.h" 31 #include "platform/geometry/IntRect.h"
32 #include "platform/scroll/ScrollAnimatorBase.h" 32 #include "platform/scroll/ScrollAnimatorBase.h"
33 #include "platform/scroll/ScrollableArea.h" 33 #include "platform/scroll/ScrollableArea.h"
34 #include "public/platform/Platform.h"
35 #include "public/platform/WebScheduler.h"
36 #include "public/platform/WebThread.h"
34 #include "testing/gmock/include/gmock/gmock.h" 37 #include "testing/gmock/include/gmock/gmock.h"
35 #include "testing/gtest/include/gtest/gtest.h" 38 #include "testing/gtest/include/gtest/gtest.h"
36 39
37 namespace blink { 40 namespace blink {
38 41
39 using testing::AtLeast; 42 using testing::AtLeast;
40 using testing::Return; 43 using testing::Return;
41 using testing::_; 44 using testing::_;
42 45
43 static double gMockedTime = 0.0; 46 static double gMockedTime = 0.0;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 104 }
102 105
103 void setScrollOffset(const ScrollOffset& offset, 106 void setScrollOffset(const ScrollOffset& offset,
104 ScrollType type, 107 ScrollType type,
105 ScrollBehavior behavior = ScrollBehaviorInstant) { 108 ScrollBehavior behavior = ScrollBehaviorInstant) {
106 if (animator) 109 if (animator)
107 animator->setCurrentOffset(offset); 110 animator->setCurrentOffset(offset);
108 ScrollableArea::setScrollOffset(offset, type, behavior); 111 ScrollableArea::setScrollOffset(offset, type, behavior);
109 } 112 }
110 113
114 RefPtr<WebTaskRunner> getTimerTaskRunner() const final {
115 return Platform::current()->currentThread()->scheduler()->timerTaskRunner();
116 }
117
111 DEFINE_INLINE_VIRTUAL_TRACE() { 118 DEFINE_INLINE_VIRTUAL_TRACE() {
112 visitor->trace(animator); 119 visitor->trace(animator);
113 ScrollableArea::trace(visitor); 120 ScrollableArea::trace(visitor);
114 } 121 }
115 122
116 private: 123 private:
117 explicit MockScrollableArea(bool scrollAnimatorEnabled, 124 explicit MockScrollableArea(bool scrollAnimatorEnabled,
118 const ScrollOffset& minOffset, 125 const ScrollOffset& minOffset,
119 const ScrollOffset& maxOffset) 126 const ScrollOffset& maxOffset)
120 : m_scrollAnimatorEnabled(scrollAnimatorEnabled), 127 : m_scrollAnimatorEnabled(scrollAnimatorEnabled),
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 ScrollAnimatorCompositorCoordinator::RunState::PostAnimationCleanup); 652 ScrollAnimatorCompositorCoordinator::RunState::PostAnimationCleanup);
646 EXPECT_EQ(ScrollOffset(110, 90), animator->desiredTargetOffset()); 653 EXPECT_EQ(ScrollOffset(110, 90), animator->desiredTargetOffset());
647 654
648 reset(*animator); 655 reset(*animator);
649 656
650 // Forced GC in order to finalize objects depending on the mock object. 657 // Forced GC in order to finalize objects depending on the mock object.
651 ThreadState::current()->collectAllGarbage(); 658 ThreadState::current()->collectAllGarbage();
652 } 659 }
653 660
654 } // namespace blink 661 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698