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

Side by Side Diff: athena/home/home_card_gesture_manager_unittest.cc

Issue 577833003: Revert of Clean up GestureEventDetails constructors and fix unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 // 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 "athena/home/home_card_gesture_manager.h" 5 #include "athena/home/home_card_gesture_manager.h"
6 6
7 #include "athena/home/home_card_constants.h" 7 #include "athena/home/home_card_constants.h"
8 #include "athena/home/public/home_card.h" 8 #include "athena/home/public/home_card.h"
9 #include "athena/test/athena_test_base.h" 9 #include "athena/test/athena_test_base.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 28 matching lines...) Expand all
39 return result; 39 return result;
40 } 40 }
41 int GetProgressCountAndReset() { 41 int GetProgressCountAndReset() {
42 int result = progress_count_; 42 int result = progress_count_;
43 progress_count_ = 0; 43 progress_count_ = 0;
44 return result; 44 return result;
45 } 45 }
46 46
47 // Process a gesture event for our use case. 47 // Process a gesture event for our use case.
48 bool ProcessGestureEvent(ui::EventType type, int y) { 48 bool ProcessGestureEvent(ui::EventType type, int y) {
49 ui::GestureEventDetails details; 49 ui::GestureEvent event(0, y, ui::EF_NONE, base::TimeDelta(),
50 if (type == ui::ET_GESTURE_SCROLL_BEGIN || 50 ui::GestureEventDetails(type, 0, (y - last_y_)));
51 type == ui::ET_GESTURE_SCROLL_UPDATE)
52 details = ui::GestureEventDetails(type, 0, (y - last_y_));
53 else
54 details = ui::GestureEventDetails(type);
55 ui::GestureEvent event(0, y, ui::EF_NONE, base::TimeDelta(), details);
56 if (type == ui::ET_GESTURE_SCROLL_BEGIN) { 51 if (type == ui::ET_GESTURE_SCROLL_BEGIN) {
57 // Compute the position that the home card would have wrt to the top of 52 // Compute the position that the home card would have wrt to the top of
58 // the screen if the screen had screen_bounds(). 53 // the screen if the screen had screen_bounds().
59 HomeCard::State state = HomeCard::Get()->GetState(); 54 HomeCard::State state = HomeCard::Get()->GetState();
60 int home_card_top = 0; 55 int home_card_top = 0;
61 if (state == HomeCard::VISIBLE_BOTTOM) 56 if (state == HomeCard::VISIBLE_BOTTOM)
62 home_card_top = screen_bounds().height() - kHomeCardHeight; 57 home_card_top = screen_bounds().height() - kHomeCardHeight;
63 else if (state == HomeCard::VISIBLE_MINIMIZED) 58 else if (state == HomeCard::VISIBLE_MINIMIZED)
64 home_card_top = screen_bounds().height() - kHomeCardMinimizedHeight; 59 home_card_top = screen_bounds().height() - kHomeCardMinimizedHeight;
65 60
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 EXPECT_EQ(0, GetProgressCountAndReset()); 222 EXPECT_EQ(0, GetProgressCountAndReset());
228 223
229 ProcessGestureEvent(ui::ET_GESTURE_SCROLL_UPDATE, 1010); 224 ProcessGestureEvent(ui::ET_GESTURE_SCROLL_UPDATE, 1010);
230 ProcessGestureEvent(ui::ET_GESTURE_SCROLL_UPDATE, 800); 225 ProcessGestureEvent(ui::ET_GESTURE_SCROLL_UPDATE, 800);
231 ProcessFlingGesture(-30.0f); 226 ProcessFlingGesture(-30.0f);
232 EXPECT_EQ(1, GetEndCountAndReset()); 227 EXPECT_EQ(1, GetEndCountAndReset());
233 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, final_state_); 228 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, final_state_);
234 } 229 }
235 230
236 } // namespace athena 231 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698