OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/timer.h" | 8 #include "base/timer.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 delegate->scroll_begin_position().ToString()); | 924 delegate->scroll_begin_position().ToString()); |
925 EXPECT_EQ(gfx::Rect(kPositionX + kScrollAmount - radius, | 925 EXPECT_EQ(gfx::Rect(kPositionX + kScrollAmount - radius, |
926 kPositionY + kScrollAmount - radius, | 926 kPositionY + kScrollAmount - radius, |
927 radius * 2, | 927 radius * 2, |
928 radius * 2).ToString(), | 928 radius * 2).ToString(), |
929 delegate->bounding_box().ToString()); | 929 delegate->bounding_box().ToString()); |
930 | 930 |
931 // Release the touch. This should end the scroll. | 931 // Release the touch. This should end the scroll. |
932 delegate->Reset(); | 932 delegate->Reset(); |
933 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, | 933 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, |
934 gfx::Point(kPositionX, kPositionY), | 934 gfx::Point(kPositionX + kScrollAmount, |
| 935 kPositionY + kScrollAmount), |
935 kTouchId, press.time_stamp() + | 936 kTouchId, press.time_stamp() + |
936 base::TimeDelta::FromMilliseconds(50)); | 937 base::TimeDelta::FromMilliseconds(50)); |
937 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); | 938 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); |
938 EXPECT_EQ(gfx::Rect(kPositionX - radius, | 939 EXPECT_EQ(gfx::Rect(kPositionX + kScrollAmount - radius, |
939 kPositionY - radius, | 940 kPositionY + kScrollAmount - radius, |
940 radius * 2, | 941 radius * 2, |
941 radius * 2).ToString(), | 942 radius * 2).ToString(), |
942 delegate->bounding_box().ToString()); | 943 delegate->bounding_box().ToString()); |
943 } | 944 } |
944 ui::GestureConfiguration::set_default_radius(0); | 945 ui::GestureConfiguration::set_default_radius(0); |
945 } | 946 } |
946 | 947 |
947 // Check Scroll End Events report correct velocities | 948 // Check Scroll End Events report correct velocities |
948 // if the user was on a horizontal rail | 949 // if the user was on a horizontal rail |
949 TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) { | 950 TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) { |
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3015 press1.time_stamp() + base::TimeDelta::FromMilliseconds(40)); | 3016 press1.time_stamp() + base::TimeDelta::FromMilliseconds(40)); |
3016 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); | 3017 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4); |
3017 EXPECT_TRUE(delegate->scroll_update()); | 3018 EXPECT_TRUE(delegate->scroll_update()); |
3018 EXPECT_EQ(-1, delegate->scroll_y()); | 3019 EXPECT_EQ(-1, delegate->scroll_y()); |
3019 | 3020 |
3020 delegate->Reset(); | 3021 delegate->Reset(); |
3021 } | 3022 } |
3022 | 3023 |
3023 } // namespace test | 3024 } // namespace test |
3024 } // namespace aura | 3025 } // namespace aura |
OLD | NEW |