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

Side by Side Diff: ui/aura/gestures/gesture_recognizer_unittest.cc

Issue 289373009: Support tap_count in ui::GestureProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small cleanup. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after
3359 EXPECT_FALSE(delegate->begin()); 3359 EXPECT_FALSE(delegate->begin());
3360 EXPECT_TRUE(delegate->end()); 3360 EXPECT_TRUE(delegate->end());
3361 EXPECT_FALSE(delegate->scroll_begin()); 3361 EXPECT_FALSE(delegate->scroll_begin());
3362 EXPECT_FALSE(delegate->scroll_update()); 3362 EXPECT_FALSE(delegate->scroll_update());
3363 EXPECT_FALSE(delegate->scroll_end()); 3363 EXPECT_FALSE(delegate->scroll_end());
3364 EXPECT_FALSE(delegate->fling()); 3364 EXPECT_FALSE(delegate->fling());
3365 } 3365 }
3366 3366
3367 // Check that appropriate touch events generate double tap gesture events. 3367 // Check that appropriate touch events generate double tap gesture events.
3368 TEST_P(GestureRecognizerTest, GestureEventDoubleTap) { 3368 TEST_P(GestureRecognizerTest, GestureEventDoubleTap) {
3369 // TODO(tdresser): enable this test with unified GR once double / triple tap
3370 // gestures work. See crbug.com/357270.
3371 if (UsingUnifiedGR())
3372 return;
3373
3374 scoped_ptr<GestureEventConsumeDelegate> delegate( 3369 scoped_ptr<GestureEventConsumeDelegate> delegate(
3375 new GestureEventConsumeDelegate()); 3370 new GestureEventConsumeDelegate());
3376 const int kWindowWidth = 123; 3371 const int kWindowWidth = 123;
3377 const int kWindowHeight = 45; 3372 const int kWindowHeight = 45;
3378 const int kTouchId = 2; 3373 const int kTouchId = 2;
3379 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); 3374 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight);
3380 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( 3375 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
3381 delegate.get(), -1234, bounds, root_window())); 3376 delegate.get(), -1234, bounds, root_window()));
3382 TimedEvents tes; 3377 TimedEvents tes;
3383 3378
(...skipping 21 matching lines...) Expand all
3405 EXPECT_TRUE(delegate->end()); 3400 EXPECT_TRUE(delegate->end());
3406 EXPECT_FALSE(delegate->scroll_begin()); 3401 EXPECT_FALSE(delegate->scroll_begin());
3407 EXPECT_FALSE(delegate->scroll_update()); 3402 EXPECT_FALSE(delegate->scroll_update());
3408 EXPECT_FALSE(delegate->scroll_end()); 3403 EXPECT_FALSE(delegate->scroll_end());
3409 3404
3410 EXPECT_EQ(2, delegate->tap_count()); 3405 EXPECT_EQ(2, delegate->tap_count());
3411 } 3406 }
3412 3407
3413 // Check that appropriate touch events generate triple tap gesture events. 3408 // Check that appropriate touch events generate triple tap gesture events.
3414 TEST_P(GestureRecognizerTest, GestureEventTripleTap) { 3409 TEST_P(GestureRecognizerTest, GestureEventTripleTap) {
3415 // TODO(tdresser): enable this test with unified GR once double / triple tap
3416 // gestures work. See crbug.com/357270.
3417 if (UsingUnifiedGR())
3418 return;
3419
3420 scoped_ptr<GestureEventConsumeDelegate> delegate( 3410 scoped_ptr<GestureEventConsumeDelegate> delegate(
3421 new GestureEventConsumeDelegate()); 3411 new GestureEventConsumeDelegate());
3422 const int kWindowWidth = 123; 3412 const int kWindowWidth = 123;
3423 const int kWindowHeight = 45; 3413 const int kWindowHeight = 45;
3424 const int kTouchId = 2; 3414 const int kTouchId = 2;
3425 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); 3415 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight);
3426 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( 3416 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
3427 delegate.get(), -1234, bounds, root_window())); 3417 delegate.get(), -1234, bounds, root_window()));
3428 TimedEvents tes; 3418 TimedEvents tes;
3429 3419
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
4260 int default_flags = delegate->flags(); 4250 int default_flags = delegate->flags();
4261 4251
4262 ui::TouchEvent move1( 4252 ui::TouchEvent move1(
4263 ui::ET_TOUCH_MOVED, gfx::Point(397, 149), kTouchId, tes.LeapForward(50)); 4253 ui::ET_TOUCH_MOVED, gfx::Point(397, 149), kTouchId, tes.LeapForward(50));
4264 move1.set_flags(992); 4254 move1.set_flags(992);
4265 4255
4266 DispatchEventUsingWindowDispatcher(&move1); 4256 DispatchEventUsingWindowDispatcher(&move1);
4267 EXPECT_NE(default_flags, delegate->flags()); 4257 EXPECT_NE(default_flags, delegate->flags());
4268 } 4258 }
4269 4259
4270 // TODO - re-enable these tests once memory management issues have been sorted
4271 // out. See crbug.com/371990.
4272 INSTANTIATE_TEST_CASE_P(GestureRecognizer, 4260 INSTANTIATE_TEST_CASE_P(GestureRecognizer,
4273 GestureRecognizerTest, 4261 GestureRecognizerTest,
4274 ::testing::Bool()); 4262 ::testing::Bool());
4275 4263
4276 } // namespace test 4264 } // namespace test
4277 } // namespace aura 4265 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698