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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 328733003: Fix slop region boundary handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows compile. Created 6 years, 6 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 1795
1796 const IPC::Message *message = sink_->GetFirstMessageMatching( 1796 const IPC::Message *message = sink_->GetFirstMessageMatching(
1797 ViewMsg_Resize::ID); 1797 ViewMsg_Resize::ID);
1798 ASSERT_TRUE(message != NULL); 1798 ASSERT_TRUE(message != NULL);
1799 1799
1800 ViewMsg_Resize::Param params; 1800 ViewMsg_Resize::Param params;
1801 ViewMsg_Resize::Read(message, &params); 1801 ViewMsg_Resize::Read(message, &params);
1802 EXPECT_EQ(60, params.a.visible_viewport_size.height()); 1802 EXPECT_EQ(60, params.a.visible_viewport_size.height());
1803 } 1803 }
1804 1804
1805 // Ensures that touch event positions are never truncated to integers.
1806 TEST_F(RenderWidgetHostViewAuraTest, TouchEventPositionsArentRounded) {
1807 const float kX = 30.58f;
1808 const float kY = 50.23f;
1809
1810 view_->InitAsChild(NULL);
1811 view_->Show();
1812
1813 ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
1814 gfx::PointF(kX, kY),
1815 0,
1816 ui::EventTimeForNow());
1817
1818 view_->OnTouchEvent(&press);
1819 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type);
1820 EXPECT_TRUE(view_->touch_event_.cancelable);
1821 EXPECT_EQ(1U, view_->touch_event_.touchesLength);
1822 EXPECT_EQ(blink::WebTouchPoint::StatePressed,
1823 view_->touch_event_.touches[0].state);
1824 EXPECT_EQ(kX, view_->touch_event_.touches[0].screenPosition.x);
1825 EXPECT_EQ(kX, view_->touch_event_.touches[0].position.x);
1826 EXPECT_EQ(kY, view_->touch_event_.touches[0].screenPosition.y);
1827 EXPECT_EQ(kY, view_->touch_event_.touches[0].position.y);
1828 }
1829
1805 // Tests that scroll ACKs are correctly handled by the overscroll-navigation 1830 // Tests that scroll ACKs are correctly handled by the overscroll-navigation
1806 // controller. 1831 // controller.
1807 TEST_F(RenderWidgetHostViewAuraOverscrollTest, WheelScrollEventOverscrolls) { 1832 TEST_F(RenderWidgetHostViewAuraOverscrollTest, WheelScrollEventOverscrolls) {
1808 SetUpOverscrollEnvironment(); 1833 SetUpOverscrollEnvironment();
1809 1834
1810 // Simulate wheel events. 1835 // Simulate wheel events.
1811 SimulateWheelEvent(-5, 0, 0, true); // sent directly 1836 SimulateWheelEvent(-5, 0, 0, true); // sent directly
1812 SimulateWheelEvent(-1, 1, 0, true); // enqueued 1837 SimulateWheelEvent(-1, 1, 0, true); // enqueued
1813 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event 1838 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event
1814 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event 1839 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); 2688 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode());
2664 2689
2665 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, 2690 SimulateGestureEvent(WebInputEvent::GestureScrollEnd,
2666 blink::WebGestureDeviceTouchscreen); 2691 blink::WebGestureDeviceTouchscreen);
2667 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); 2692 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode());
2668 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); 2693 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode());
2669 EXPECT_EQ(3U, sink_->message_count()); 2694 EXPECT_EQ(3U, sink_->message_count());
2670 } 2695 }
2671 2696
2672 } // namespace content 2697 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698