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

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

Issue 1496693005: Update RootFrameViewport::userScroll to distribute scrolls between viewports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 /* 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).Will Repeatedly(Return(IntPoint())); 109 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)).Will Repeatedly(Return(IntPoint()));
110 EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).Will Repeatedly(Return(IntPoint(1000, 1000))); 110 EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)).Will Repeatedly(Return(IntPoint(1000, 1000)));
111 EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(12); 111 EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(12);
112 EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(3); 112 EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(3);
113 113
114 EXPECT_FALSE(scrollAnimator->hasRunningAnimation()); 114 EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
115 115
116 ScrollResultOneDimensional result = scrollAnimator->userScroll(HorizontalScr ollbar, ScrollByLine, 100, -1); 116 ScrollResultOneDimensional result = scrollAnimator->userScroll(HorizontalScr ollbar, ScrollByLine, 100, -1);
117 EXPECT_FALSE(scrollAnimator->hasRunningAnimation()); 117 EXPECT_FALSE(scrollAnimator->hasRunningAnimation());
118 EXPECT_FALSE(result.didScroll); 118 EXPECT_FALSE(result.didScroll);
119 EXPECT_FLOAT_EQ(-100.0, result.unusedScrollDelta); 119 EXPECT_FLOAT_EQ(-1.0f, result.unusedScrollDelta);
120 120
121 result = scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100, 1); 121 result = scrollAnimator->userScroll(HorizontalScrollbar, ScrollByLine, 100, 1);
122 EXPECT_TRUE(scrollAnimator->hasRunningAnimation()); 122 EXPECT_TRUE(scrollAnimator->hasRunningAnimation());
123 EXPECT_TRUE(result.didScroll); 123 EXPECT_TRUE(result.didScroll);
124 EXPECT_FLOAT_EQ(0.0, result.unusedScrollDelta); 124 EXPECT_FLOAT_EQ(0.0, result.unusedScrollDelta);
125 125
126 gMockedTime += 0.05; 126 gMockedTime += 0.05;
127 scrollAnimator->serviceScrollAnimations(); 127 scrollAnimator->serviceScrollAnimations();
128 128
129 EXPECT_NE(100, scrollAnimator->currentPosition().x()); 129 EXPECT_NE(100, scrollAnimator->currentPosition().x());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 EXPECT_EQ(0, scrollAnimator->currentPosition().y()); 194 EXPECT_EQ(0, scrollAnimator->currentPosition().y());
195 reset(*scrollAnimator); 195 reset(*scrollAnimator);
196 196
197 scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPixel, 100, 1); 197 scrollAnimator->userScroll(HorizontalScrollbar, ScrollByPixel, 100, 1);
198 EXPECT_EQ(100, scrollAnimator->currentPosition().x()); 198 EXPECT_EQ(100, scrollAnimator->currentPosition().x());
199 EXPECT_EQ(0, scrollAnimator->currentPosition().y()); 199 EXPECT_EQ(0, scrollAnimator->currentPosition().y());
200 reset(*scrollAnimator); 200 reset(*scrollAnimator);
201 } 201 }
202 202
203 } // namespace blink 203 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698