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

Side by Side Diff: content/browser/renderer_host/input/touch_emulator_unittest.cc

Issue 859973003: Touch emulator: enables double tap support for pages similar to Chrome on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: frame_metadata_util Created 5 years, 11 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
OLDNEW
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 <vector> 5 #include <vector>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // testing::Test 47 // testing::Test
48 void SetUp() override { 48 void SetUp() override {
49 #if defined(USE_AURA) 49 #if defined(USE_AURA)
50 aura::Env::CreateInstance(true); 50 aura::Env::CreateInstance(true);
51 screen_.reset(aura::TestScreen::Create(gfx::Size())); 51 screen_.reset(aura::TestScreen::Create(gfx::Size()));
52 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); 52 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
53 #endif 53 #endif
54 54
55 emulator_.reset(new TouchEmulator(this)); 55 emulator_.reset(new TouchEmulator(this));
56 emulator_->SetDoubleTapSupportForPageEnabled(false);
56 emulator_->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); 57 emulator_->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
57 } 58 }
58 59
59 void TearDown() override { 60 void TearDown() override {
60 emulator_->Disable(); 61 emulator_->Disable();
61 EXPECT_EQ("", ExpectedEvents()); 62 EXPECT_EQ("", ExpectedEvents());
62 63
63 #if defined(USE_AURA) 64 #if defined(USE_AURA)
64 aura::Env::DeleteInstance(); 65 aura::Env::DeleteInstance();
65 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr); 66 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 EXPECT_EQ("", ExpectedEvents()); 277 EXPECT_EQ("", ExpectedEvents());
277 MouseDown(100, 200); 278 MouseDown(100, 200);
278 EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents()); 279 EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents());
279 MouseUp(200, 200); 280 MouseUp(200, 200);
280 EXPECT_EQ( 281 EXPECT_EQ(
281 "TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate" 282 "TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate"
282 " TouchEnd GestureScrollEnd", 283 " TouchEnd GestureScrollEnd",
283 ExpectedEvents()); 284 ExpectedEvents());
284 } 285 }
285 286
287 TEST_F(TouchEmulatorTest, DoubleTapSupport) {
288 emulator()->SetDoubleTapSupportForPageEnabled(true);
289 MouseMove(100, 200);
290 EXPECT_EQ("", ExpectedEvents());
291 MouseDown(100, 200);
292 EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents());
293 MouseUp(100, 200);
294 EXPECT_EQ("TouchEnd GestureTapUnconfirmed", ExpectedEvents());
295 MouseDown(100, 200);
296 EXPECT_EQ("TouchStart GestureTapCancel GestureTapDown", ExpectedEvents());
297 MouseUp(100, 200);
298 EXPECT_EQ("TouchEnd GestureTapCancel GestureDoubleTap", ExpectedEvents());
299 }
300
286 TEST_F(TouchEmulatorTest, MultipleTouches) { 301 TEST_F(TouchEmulatorTest, MultipleTouches) {
287 MouseMove(100, 200); 302 MouseMove(100, 200);
288 EXPECT_EQ("", ExpectedEvents()); 303 EXPECT_EQ("", ExpectedEvents());
289 MouseDown(100, 200); 304 MouseDown(100, 200);
290 EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents()); 305 EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents());
291 MouseUp(200, 200); 306 MouseUp(200, 200);
292 EXPECT_EQ( 307 EXPECT_EQ(
293 "TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate" 308 "TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate"
294 " TouchEnd GestureScrollEnd", 309 " TouchEnd GestureScrollEnd",
295 ExpectedEvents()); 310 ExpectedEvents());
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 569
555 TEST_F(TouchEmulatorTest, CancelAfterDisableDoesNotCrash) { 570 TEST_F(TouchEmulatorTest, CancelAfterDisableDoesNotCrash) {
556 DisableSynchronousTouchAck(); 571 DisableSynchronousTouchAck();
557 MouseDown(100, 200); 572 MouseDown(100, 200);
558 emulator()->Disable(); 573 emulator()->Disable();
559 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents()); 574 EXPECT_EQ("TouchStart TouchCancel", ExpectedEvents());
560 emulator()->CancelTouch(); 575 emulator()->CancelTouch();
561 } 576 }
562 577
563 } // namespace content 578 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/touch_emulator.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698