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

Side by Side Diff: ui/android/overscroll_refresh_unittest.cc

Issue 2528823002: Separate SwipeRefreshHandler and ContentViewCore (Closed)
Patch Set: Fix non-Android compile issue 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/android/scoped_java_ref.h"
5 #include "cc/layers/layer.h" 6 #include "cc/layers/layer.h"
6 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/android/overscroll_refresh.h" 8 #include "ui/android/overscroll_refresh.h"
8 9
9 namespace ui { 10 namespace ui {
10 11
11 class OverscrollRefreshTest : public OverscrollRefreshHandler, 12 class OverscrollRefreshTest : public OverscrollRefreshHandler,
12 public testing::Test { 13 public testing::Test {
13 public: 14 public:
14 OverscrollRefreshTest() {} 15 OverscrollRefreshTest()
16 : OverscrollRefreshHandler(base::android::JavaRef<jobject>()) {}
15 17
16 // OverscrollRefreshHandler implementation. 18 // OverscrollRefreshHandler implementation.
17 bool PullStart() override { 19 bool PullStart() {
boliu 2016/12/03 01:05:28 why remove overrides?
rlanday 2016/12/05 19:53:57 The override keyword can only be used with virtual
boliu 2016/12/06 00:46:34 Err, then are you sure this test still works? I th
18 started_ = true; 20 started_ = true;
19 return true; 21 return true;
20 } 22 }
21 23
22 void PullUpdate(float delta) override { delta_ += delta; } 24 void PullUpdate(float delta) { delta_ += delta; }
23 25
24 void PullRelease(bool allow_refresh) override { 26 void PullRelease(bool allow_refresh) {
25 released_ = true; 27 released_ = true;
26 refresh_allowed_ = allow_refresh; 28 refresh_allowed_ = allow_refresh;
27 } 29 }
28 30
29 void PullReset() override { reset_ = true; } 31 void PullReset() { reset_ = true; }
30 32
31 bool GetAndResetPullStarted() { 33 bool GetAndResetPullStarted() {
32 bool result = started_; 34 bool result = started_;
33 started_ = false; 35 started_ = false;
34 return result; 36 return result;
35 } 37 }
36 38
37 float GetAndResetPullDelta() { 39 float GetAndResetPullDelta() {
38 float result = delta_; 40 float result = delta_;
39 delta_ = 0; 41 delta_ = 0;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 EXPECT_TRUE(GetAndResetPullStarted()); 234 EXPECT_TRUE(GetAndResetPullStarted());
233 235
234 // An early reset should prevent the refresh action from firing. 236 // An early reset should prevent the refresh action from firing.
235 effect.Reset(); 237 effect.Reset();
236 EXPECT_TRUE(GetAndResetPullReset()); 238 EXPECT_TRUE(GetAndResetPullReset());
237 effect.OnScrollEnd(gfx::Vector2dF()); 239 effect.OnScrollEnd(gfx::Vector2dF());
238 EXPECT_FALSE(GetAndResetPullReleased()); 240 EXPECT_FALSE(GetAndResetPullReleased());
239 } 241 }
240 242
241 } // namespace ui 243 } // namespace ui
OLDNEW
« ui/android/overscroll_refresh.h ('K') | « ui/android/overscroll_refresh_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698