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

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

Issue 2016383002: Set PointerType of pointer event on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "build/build_config.h" 6 #include "build/build_config.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "third_party/WebKit/public/web/WebInputEvent.h" 8 #include "third_party/WebKit/public/web/WebInputEvent.h"
9 #include "ui/display/display.h" 9 #include "ui/display/display.h"
10 #include "ui/display/display_switches.h" 10 #include "ui/display/display_switches.h"
(...skipping 15 matching lines...) Expand all
26 TEST(WebInputEventBuilderTest, TestMouseEventScale) { 26 TEST(WebInputEventBuilderTest, TestMouseEventScale) {
27 if (base::win::GetVersion() < base::win::VERSION_WIN7) 27 if (base::win::GetVersion() < base::win::VERSION_WIN7)
28 return; 28 return;
29 29
30 display::Display::ResetForceDeviceScaleFactorForTesting(); 30 display::Display::ResetForceDeviceScaleFactorForTesting();
31 31
32 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 32 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
33 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "2"); 33 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "2");
34 34
35 // Synthesize a mouse move with x = 300 and y = 200. 35 // Synthesize a mouse move with x = 300 and y = 200.
36 WebMouseEvent mouse_move = 36 WebMouseEvent mouse_move = WebMouseEventBuilder::Build(
37 WebMouseEventBuilder::Build(::GetDesktopWindow(), WM_MOUSEMOVE, 0, 37 ::GetDesktopWindow(), WM_MOUSEMOVE, 0, MAKELPARAM(300, 200), 100,
38 MAKELPARAM(300, 200), 100); 38 blink::WebPointerProperties::PointerType::Mouse);
39 39
40 // The WebMouseEvent.x, WebMouseEvent.y, WebMouseEvent.windowX and 40 // The WebMouseEvent.x, WebMouseEvent.y, WebMouseEvent.windowX and
41 // WebMouseEvent.windowY fields should be in pixels on return and hence 41 // WebMouseEvent.windowY fields should be in pixels on return and hence
42 // should be the same value as the x and y coordinates passed in to the 42 // should be the same value as the x and y coordinates passed in to the
43 // WebMouseEventBuilder::Build function. 43 // WebMouseEventBuilder::Build function.
44 EXPECT_EQ(300, mouse_move.x); 44 EXPECT_EQ(300, mouse_move.x);
45 EXPECT_EQ(200, mouse_move.y); 45 EXPECT_EQ(200, mouse_move.y);
46 46
47 EXPECT_EQ(300, mouse_move.windowX); 47 EXPECT_EQ(300, mouse_move.windowX);
48 EXPECT_EQ(200, mouse_move.windowY); 48 EXPECT_EQ(200, mouse_move.windowY);
49 49
50 // WebMouseEvent.globalX and WebMouseEvent.globalY are calculated in DIPs. 50 // WebMouseEvent.globalX and WebMouseEvent.globalY are calculated in DIPs.
51 EXPECT_EQ(150, mouse_move.globalX); 51 EXPECT_EQ(150, mouse_move.globalX);
52 EXPECT_EQ(100, mouse_move.globalY); 52 EXPECT_EQ(100, mouse_move.globalY);
53 53
54 EXPECT_EQ(blink::WebPointerProperties::PointerType::Mouse,
55 mouse_move.pointerType);
56
54 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "1"); 57 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "1");
55 display::Display::ResetForceDeviceScaleFactorForTesting(); 58 display::Display::ResetForceDeviceScaleFactorForTesting();
56 } 59 }
57 #endif 60 #endif
58 61
59 } // namespace content 62 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698