| OLD | NEW |
| 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/base/athena_test_base.h" | 9 #include "athena/test/base/athena_test_base.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 last_from_state_(HomeCard::HIDDEN), | 21 last_from_state_(HomeCard::HIDDEN), |
| 22 last_to_state_(HomeCard::HIDDEN), | 22 last_to_state_(HomeCard::HIDDEN), |
| 23 last_progress_(0.0f), | 23 last_progress_(0.0f), |
| 24 was_fling_(false), | 24 was_fling_(false), |
| 25 last_y_(0), | 25 last_y_(0), |
| 26 progress_count_(0), | 26 progress_count_(0), |
| 27 end_count_(0) {} | 27 end_count_(0) {} |
| 28 virtual ~HomeCardGestureManagerTest() {} | 28 virtual ~HomeCardGestureManagerTest() {} |
| 29 | 29 |
| 30 // testing::Test: | 30 // testing::Test: |
| 31 virtual void SetUp() OVERRIDE { | 31 virtual void SetUp() override { |
| 32 test::AthenaTestBase::SetUp(); | 32 test::AthenaTestBase::SetUp(); |
| 33 gesture_manager_.reset(new HomeCardGestureManager(this, screen_bounds())); | 33 gesture_manager_.reset(new HomeCardGestureManager(this, screen_bounds())); |
| 34 } | 34 } |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 int GetEndCountAndReset() { | 37 int GetEndCountAndReset() { |
| 38 int result = end_count_; | 38 int result = end_count_; |
| 39 end_count_ = 0; | 39 end_count_ = 0; |
| 40 return result; | 40 return result; |
| 41 } | 41 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 float last_progress_; | 90 float last_progress_; |
| 91 bool was_fling_; | 91 bool was_fling_; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 gfx::Rect screen_bounds() const { | 94 gfx::Rect screen_bounds() const { |
| 95 return gfx::Rect(0, 0, 1280, 1024); | 95 return gfx::Rect(0, 0, 1280, 1024); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // HomeCardGestureManager::Delegate: | 98 // HomeCardGestureManager::Delegate: |
| 99 virtual void OnGestureEnded(HomeCard::State final_state, | 99 virtual void OnGestureEnded(HomeCard::State final_state, |
| 100 bool is_fling) OVERRIDE { | 100 bool is_fling) override { |
| 101 final_state_ = final_state; | 101 final_state_ = final_state; |
| 102 was_fling_ = is_fling; | 102 was_fling_ = is_fling; |
| 103 ++end_count_; | 103 ++end_count_; |
| 104 } | 104 } |
| 105 | 105 |
| 106 virtual void OnGestureProgressed(HomeCard::State from_state, | 106 virtual void OnGestureProgressed(HomeCard::State from_state, |
| 107 HomeCard::State to_state, | 107 HomeCard::State to_state, |
| 108 float progress) OVERRIDE { | 108 float progress) override { |
| 109 last_from_state_ = from_state; | 109 last_from_state_ = from_state; |
| 110 last_to_state_ = to_state; | 110 last_to_state_ = to_state; |
| 111 last_progress_ = progress; | 111 last_progress_ = progress; |
| 112 ++progress_count_; | 112 ++progress_count_; |
| 113 } | 113 } |
| 114 | 114 |
| 115 int last_y_; | 115 int last_y_; |
| 116 int progress_count_; | 116 int progress_count_; |
| 117 int end_count_; | 117 int end_count_; |
| 118 scoped_ptr<HomeCardGestureManager> gesture_manager_; | 118 scoped_ptr<HomeCardGestureManager> gesture_manager_; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 ProcessGestureEvent(ui::ET_GESTURE_SCROLL_UPDATE, 1010); | 292 ProcessGestureEvent(ui::ET_GESTURE_SCROLL_UPDATE, 1010); |
| 293 ProcessGestureEvent(ui::ET_GESTURE_SCROLL_UPDATE, | 293 ProcessGestureEvent(ui::ET_GESTURE_SCROLL_UPDATE, |
| 294 screen_height() - kHomeCardHeight); | 294 screen_height() - kHomeCardHeight); |
| 295 ProcessFlingGesture(-150.0f); | 295 ProcessFlingGesture(-150.0f); |
| 296 EXPECT_EQ(1, GetEndCountAndReset()); | 296 EXPECT_EQ(1, GetEndCountAndReset()); |
| 297 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, final_state_); | 297 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, final_state_); |
| 298 EXPECT_TRUE(was_fling_); | 298 EXPECT_TRUE(was_fling_); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace athena | 301 } // namespace athena |
| OLD | NEW |