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

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

Issue 251543003: Unified Gesture Recognizer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows linking 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 public: 680 public:
681 GestureRecognizerTest() {} 681 GestureRecognizerTest() {}
682 682
683 bool UsingUnifiedGR() { 683 bool UsingUnifiedGR() {
684 return GetParam(); 684 return GetParam();
685 } 685 }
686 686
687 virtual void SetUp() OVERRIDE { 687 virtual void SetUp() OVERRIDE {
688 // TODO(tdresser): Once unified GR has landed, only run these tests once. 688 // TODO(tdresser): Once unified GR has landed, only run these tests once.
689 if (UsingUnifiedGR()) { 689 if (UsingUnifiedGR()) {
690 // TODO(tdresser): use unified GR once it's available. 690 CommandLine::ForCurrentProcess()->AppendSwitch(
691 // CommandLine::ForCurrentProcess()->AppendSwitch( 691 switches::kUseUnifiedGestureDetector);
692 // switches::kUseUnifiedGestureDetector);
693 } 692 }
694 693
695 AuraTestBase::SetUp(); 694 AuraTestBase::SetUp();
696 } 695 }
697 696
698 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerTest); 697 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerTest);
699 }; 698 };
700 699
701 // Check that appropriate touch events generate tap gesture events. 700 // Check that appropriate touch events generate tap gesture events.
702 TEST_P(GestureRecognizerTest, GestureEventTap) { 701 TEST_P(GestureRecognizerTest, GestureEventTap) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 EXPECT_FALSE(delegate->scroll_begin()); 743 EXPECT_FALSE(delegate->scroll_begin());
745 EXPECT_FALSE(delegate->scroll_update()); 744 EXPECT_FALSE(delegate->scroll_update());
746 EXPECT_FALSE(delegate->scroll_end()); 745 EXPECT_FALSE(delegate->scroll_end());
747 746
748 EXPECT_EQ(1, delegate->tap_count()); 747 EXPECT_EQ(1, delegate->tap_count());
749 } 748 }
750 749
751 // Check that appropriate touch events generate tap gesture events 750 // Check that appropriate touch events generate tap gesture events
752 // when information about the touch radii are provided. 751 // when information about the touch radii are provided.
753 TEST_P(GestureRecognizerTest, GestureEventTapRegion) { 752 TEST_P(GestureRecognizerTest, GestureEventTapRegion) {
753 // TODO(tdresser): enable this test with unified GR once we resolve the
754 // bounding box differences. See crbug.com/366641.
755 if (UsingUnifiedGR())
756 return;
757
754 scoped_ptr<GestureEventConsumeDelegate> delegate( 758 scoped_ptr<GestureEventConsumeDelegate> delegate(
755 new GestureEventConsumeDelegate()); 759 new GestureEventConsumeDelegate());
756 TimedEvents tes; 760 TimedEvents tes;
757 const int kWindowWidth = 800; 761 const int kWindowWidth = 800;
758 const int kWindowHeight = 600; 762 const int kWindowHeight = 600;
759 const int kTouchId = 2; 763 const int kTouchId = 2;
760 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); 764 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight);
761 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( 765 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
762 delegate.get(), -1234, bounds, root_window())); 766 delegate.get(), -1234, bounds, root_window()));
763 767
(...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after
3707 EXPECT_FALSE(delegate->tap_down()); 3711 EXPECT_FALSE(delegate->tap_down());
3708 EXPECT_TRUE(delegate->tap_cancel()); 3712 EXPECT_TRUE(delegate->tap_cancel());
3709 EXPECT_FALSE(delegate->begin()); 3713 EXPECT_FALSE(delegate->begin());
3710 EXPECT_FALSE(delegate->scroll_begin()); 3714 EXPECT_FALSE(delegate->scroll_begin());
3711 EXPECT_FALSE(delegate->scroll_update()); 3715 EXPECT_FALSE(delegate->scroll_update());
3712 EXPECT_FALSE(delegate->scroll_end()); 3716 EXPECT_FALSE(delegate->scroll_end());
3713 } 3717 }
3714 3718
3715 TEST_P(GestureRecognizerTest, 3719 TEST_P(GestureRecognizerTest,
3716 TransferEventDispatchesTouchCancel) { 3720 TransferEventDispatchesTouchCancel) {
3721 // TODO(tdresser): enable this test with unified GR once two finger tap is
3722 // supported. See crbug.com/354396.
3723 if (UsingUnifiedGR())
3724 return;
3725
3717 scoped_ptr<GestureEventConsumeDelegate> delegate( 3726 scoped_ptr<GestureEventConsumeDelegate> delegate(
3718 new GestureEventConsumeDelegate()); 3727 new GestureEventConsumeDelegate());
3719 TimedEvents tes; 3728 TimedEvents tes;
3720 const int kWindowWidth = 800; 3729 const int kWindowWidth = 800;
3721 const int kWindowHeight = 600; 3730 const int kWindowHeight = 600;
3722 const int kTouchId = 2; 3731 const int kTouchId = 2;
3723 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); 3732 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight);
3724 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( 3733 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
3725 delegate.get(), -1234, bounds, root_window())); 3734 delegate.get(), -1234, bounds, root_window()));
3726 scoped_ptr<RemoveOnTouchCancelHandler> 3735 scoped_ptr<RemoveOnTouchCancelHandler>
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
4275 DispatchEventUsingWindowDispatcher(&move1); 4284 DispatchEventUsingWindowDispatcher(&move1);
4276 EXPECT_NE(default_flags, delegate->flags()); 4285 EXPECT_NE(default_flags, delegate->flags());
4277 } 4286 }
4278 4287
4279 INSTANTIATE_TEST_CASE_P(GestureRecognizer, 4288 INSTANTIATE_TEST_CASE_P(GestureRecognizer,
4280 GestureRecognizerTest, 4289 GestureRecognizerTest,
4281 ::testing::Bool()); 4290 ::testing::Bool());
4282 4291
4283 } // namespace test 4292 } // namespace test
4284 } // namespace aura 4293 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698