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

Side by Side Diff: Source/web/tests/ScrollAnimatorNoneTest.cpp

Issue 1174283002: Fix unit test style in Source/web/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove static Created 5 years, 6 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 | Annotate | Revision Log
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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 // Tests for the ScrollAnimatorNone class. 26 // Tests for the ScrollAnimatorNone class.
27 27
28 #include "config.h" 28 #include "config.h"
29
30 #include "platform/scroll/ScrollAnimatorNone.h" 29 #include "platform/scroll/ScrollAnimatorNone.h"
31 30
32 #include "platform/Logging.h" 31 #include "platform/Logging.h"
33 #include "platform/geometry/FloatPoint.h" 32 #include "platform/geometry/FloatPoint.h"
34 #include "platform/geometry/IntRect.h" 33 #include "platform/geometry/IntRect.h"
35 #include "platform/scroll/ScrollAnimator.h" 34 #include "platform/scroll/ScrollAnimator.h"
36 #include "platform/scroll/ScrollableArea.h" 35 #include "platform/scroll/ScrollableArea.h"
37 #include <gmock/gmock.h> 36 #include <gmock/gmock.h>
38 #include <gtest/gtest.h> 37 #include <gtest/gtest.h>
39 38
40 using namespace blink; 39 namespace blink {
41 40
42 using testing::AtLeast; 41 using testing::AtLeast;
43 using testing::Return; 42 using testing::Return;
44 using testing::_; 43 using testing::_;
45 44
46 class MockScrollableArea : public ScrollableArea { 45 class MockScrollableArea : public ScrollableArea {
47 public: 46 public:
48 MockScrollableArea(bool scrollAnimatorEnabled) 47 MockScrollableArea(bool scrollAnimatorEnabled)
49 : m_scrollAnimatorEnabled(scrollAnimatorEnabled) { } 48 : m_scrollAnimatorEnabled(scrollAnimatorEnabled) { }
50 49
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 MockScrollableArea m_mockScrollableArea; 208 MockScrollableArea m_mockScrollableArea;
210 RefPtr<MockScrollAnimatorNone> m_mockScrollAnimatorNone; 209 RefPtr<MockScrollAnimatorNone> m_mockScrollAnimatorNone;
211 }; 210 };
212 211
213 ScrollAnimatorNoneTest() 212 ScrollAnimatorNoneTest()
214 : m_mockScrollableArea(true) 213 : m_mockScrollableArea(true)
215 , m_mockScrollAnimatorNone(MockScrollAnimatorNone::create(&m_mockScrolla bleArea)) 214 , m_mockScrollAnimatorNone(MockScrollAnimatorNone::create(&m_mockScrolla bleArea))
216 { 215 {
217 } 216 }
218 217
219 virtual void SetUp() 218 void SetUp() override
220 { 219 {
221 m_currentPosition = 100; 220 m_currentPosition = 100;
222 m_data = new ScrollAnimatorNone::PerAxisData(&m_currentPosition, 768); 221 m_data = new ScrollAnimatorNone::PerAxisData(&m_currentPosition, 768);
223 } 222 }
224 virtual void TearDown() 223 void TearDown() override
225 { 224 {
226 delete m_data; 225 delete m_data;
227 } 226 }
228 227
229 void reset(); 228 void reset();
230 bool updateDataFromParameters(float step, float multiplier, float scrollable Size, double currentTime, ScrollAnimatorNone::Parameters*); 229 bool updateDataFromParameters(float step, float multiplier, float scrollable Size, double currentTime, ScrollAnimatorNone::Parameters*);
231 bool animateScroll(double currentTime); 230 bool animateScroll(double currentTime);
232 231
233 double attackArea(ScrollAnimatorNone::Curve, double startT, double endT); 232 double attackArea(ScrollAnimatorNone::Curve, double startT, double endT);
234 double releaseArea(ScrollAnimatorNone::Curve, double startT, double endT); 233 double releaseArea(ScrollAnimatorNone::Curve, double startT, double endT);
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 EXPECT_TRUE(result); 1046 EXPECT_TRUE(result);
1048 result = result && animateScroll(t); 1047 result = result && animateScroll(t);
1049 double after = m_currentPosition; 1048 double after = m_currentPosition;
1050 EXPECT_GE(before, after); 1049 EXPECT_GE(before, after);
1051 1050
1052 t += kAnimationTime; 1051 t += kAnimationTime;
1053 for (; result && t < kEndTime; t += kAnimationTime) 1052 for (; result && t < kEndTime; t += kAnimationTime)
1054 result = result && animateScroll(t); 1053 result = result && animateScroll(t);
1055 EXPECT_GE(before, m_currentPosition); 1054 EXPECT_GE(before, m_currentPosition);
1056 } 1055 }
1056
1057 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/tests/ProgrammaticScrollTest.cpp ('k') | Source/web/tests/ScrollingCoordinatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698