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

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: Rebase. 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
« no previous file with comments | « ui/aura/aura.gyp ('k') | ui/aura/window_event_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 public: 675 public:
676 GestureRecognizerTest() {} 676 GestureRecognizerTest() {}
677 677
678 bool UsingUnifiedGR() { 678 bool UsingUnifiedGR() {
679 return GetParam(); 679 return GetParam();
680 } 680 }
681 681
682 virtual void SetUp() OVERRIDE { 682 virtual void SetUp() OVERRIDE {
683 // TODO(tdresser): Once unified GR has landed, only run these tests once. 683 // TODO(tdresser): Once unified GR has landed, only run these tests once.
684 if (UsingUnifiedGR()) { 684 if (UsingUnifiedGR()) {
685 // TODO(tdresser): use unified GR once it's available. 685 CommandLine::ForCurrentProcess()->AppendSwitch(
686 // CommandLine::ForCurrentProcess()->AppendSwitch( 686 switches::kUseUnifiedGestureDetector);
687 // switches::kUseUnifiedGestureDetector);
688 } 687 }
689 688
690 AuraTestBase::SetUp(); 689 AuraTestBase::SetUp();
691 } 690 }
692 691
693 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerTest); 692 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerTest);
694 }; 693 };
695 694
696 // Check that appropriate touch events generate tap gesture events. 695 // Check that appropriate touch events generate tap gesture events.
697 TEST_P(GestureRecognizerTest, GestureEventTap) { 696 TEST_P(GestureRecognizerTest, GestureEventTap) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 EXPECT_FALSE(delegate->scroll_begin()); 738 EXPECT_FALSE(delegate->scroll_begin());
740 EXPECT_FALSE(delegate->scroll_update()); 739 EXPECT_FALSE(delegate->scroll_update());
741 EXPECT_FALSE(delegate->scroll_end()); 740 EXPECT_FALSE(delegate->scroll_end());
742 741
743 EXPECT_EQ(1, delegate->tap_count()); 742 EXPECT_EQ(1, delegate->tap_count());
744 } 743 }
745 744
746 // Check that appropriate touch events generate tap gesture events 745 // Check that appropriate touch events generate tap gesture events
747 // when information about the touch radii are provided. 746 // when information about the touch radii are provided.
748 TEST_P(GestureRecognizerTest, GestureEventTapRegion) { 747 TEST_P(GestureRecognizerTest, GestureEventTapRegion) {
748 // TODO(tdresser): enable this test with unified GR once we resolve the
749 // bounding box differences. See crbug.com/366641.
750 if (UsingUnifiedGR())
751 return;
752
749 scoped_ptr<GestureEventConsumeDelegate> delegate( 753 scoped_ptr<GestureEventConsumeDelegate> delegate(
750 new GestureEventConsumeDelegate()); 754 new GestureEventConsumeDelegate());
751 TimedEvents tes; 755 TimedEvents tes;
752 const int kWindowWidth = 800; 756 const int kWindowWidth = 800;
753 const int kWindowHeight = 600; 757 const int kWindowHeight = 600;
754 const int kTouchId = 2; 758 const int kTouchId = 2;
755 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); 759 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight);
756 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( 760 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
757 delegate.get(), -1234, bounds, root_window())); 761 delegate.get(), -1234, bounds, root_window()));
758 762
(...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after
3702 EXPECT_FALSE(delegate->tap_down()); 3706 EXPECT_FALSE(delegate->tap_down());
3703 EXPECT_TRUE(delegate->tap_cancel()); 3707 EXPECT_TRUE(delegate->tap_cancel());
3704 EXPECT_FALSE(delegate->begin()); 3708 EXPECT_FALSE(delegate->begin());
3705 EXPECT_FALSE(delegate->scroll_begin()); 3709 EXPECT_FALSE(delegate->scroll_begin());
3706 EXPECT_FALSE(delegate->scroll_update()); 3710 EXPECT_FALSE(delegate->scroll_update());
3707 EXPECT_FALSE(delegate->scroll_end()); 3711 EXPECT_FALSE(delegate->scroll_end());
3708 } 3712 }
3709 3713
3710 TEST_P(GestureRecognizerTest, 3714 TEST_P(GestureRecognizerTest,
3711 TransferEventDispatchesTouchCancel) { 3715 TransferEventDispatchesTouchCancel) {
3716 // TODO(tdresser): enable this test with unified GR once two finger tap is
3717 // supported. See crbug.com/354396.
3718 if (UsingUnifiedGR())
3719 return;
3720
3712 scoped_ptr<GestureEventConsumeDelegate> delegate( 3721 scoped_ptr<GestureEventConsumeDelegate> delegate(
3713 new GestureEventConsumeDelegate()); 3722 new GestureEventConsumeDelegate());
3714 TimedEvents tes; 3723 TimedEvents tes;
3715 const int kWindowWidth = 800; 3724 const int kWindowWidth = 800;
3716 const int kWindowHeight = 600; 3725 const int kWindowHeight = 600;
3717 const int kTouchId = 2; 3726 const int kTouchId = 2;
3718 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); 3727 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight);
3719 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( 3728 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
3720 delegate.get(), -1234, bounds, root_window())); 3729 delegate.get(), -1234, bounds, root_window()));
3721 scoped_ptr<RemoveOnTouchCancelHandler> 3730 scoped_ptr<RemoveOnTouchCancelHandler>
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
4270 DispatchEventUsingWindowDispatcher(&move1); 4279 DispatchEventUsingWindowDispatcher(&move1);
4271 EXPECT_NE(default_flags, delegate->flags()); 4280 EXPECT_NE(default_flags, delegate->flags());
4272 } 4281 }
4273 4282
4274 INSTANTIATE_TEST_CASE_P(GestureRecognizer, 4283 INSTANTIATE_TEST_CASE_P(GestureRecognizer,
4275 GestureRecognizerTest, 4284 GestureRecognizerTest,
4276 ::testing::Bool()); 4285 ::testing::Bool());
4277 4286
4278 } // namespace test 4287 } // namespace test
4279 } // namespace aura 4288 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/aura.gyp ('k') | ui/aura/window_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698