OLD | NEW |
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 "ash/touch/touch_transformer_controller.h" | 5 #include "ash/touch/touch_transformer_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ui/aura/window_tree_host.h" | 9 #include "ui/aura/window_tree_host.h" |
10 #include "ui/events/devices/device_data_manager.h" | 10 #include "ui/events/devices/device_data_manager.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // Create a default mode. | 25 // Create a default mode. |
26 std::vector<DisplayMode> default_modes( | 26 std::vector<DisplayMode> default_modes( |
27 1, DisplayMode(bounds.size(), 60, false, true)); | 27 1, DisplayMode(bounds.size(), 60, false, true)); |
28 info.SetDisplayModes(default_modes); | 28 info.SetDisplayModes(default_modes); |
29 | 29 |
30 return info; | 30 return info; |
31 } | 31 } |
32 | 32 |
33 ui::TouchscreenDevice CreateTouchscreenDevice(unsigned int id, | 33 ui::TouchscreenDevice CreateTouchscreenDevice(unsigned int id, |
34 const gfx::Size& size) { | 34 const gfx::Size& size) { |
35 return ui::TouchscreenDevice(id, | 35 return ui::TouchscreenDevice(id, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, |
36 ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, | 36 std::string(), size, 0); |
37 std::string(), | |
38 size); | |
39 } | 37 } |
40 | 38 |
41 } // namespace | 39 } // namespace |
42 | 40 |
43 typedef test::AshTestBase TouchTransformerControllerTest; | 41 typedef test::AshTestBase TouchTransformerControllerTest; |
44 | 42 |
45 TEST_F(TouchTransformerControllerTest, TouchTransformerMirrorModeLetterboxing) { | 43 TEST_F(TouchTransformerControllerTest, TouchTransformerMirrorModeLetterboxing) { |
46 // The internal display has native resolution of 2560x1700, and in | 44 // The internal display has native resolution of 2560x1700, and in |
47 // mirror mode it is configured as 1920x1200. This is in letterboxing | 45 // mirror mode it is configured as 1920x1200. This is in letterboxing |
48 // mode. | 46 // mode. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 CreateTouchscreenDevice(5, gfx::Size(1001, 1001)); | 270 CreateTouchscreenDevice(5, gfx::Size(1001, 1001)); |
273 | 271 |
274 TouchTransformerController* tt_controller = | 272 TouchTransformerController* tt_controller = |
275 Shell::GetInstance()->touch_transformer_controller(); | 273 Shell::GetInstance()->touch_transformer_controller(); |
276 // Default touchscreen position range is 1001x1001; | 274 // Default touchscreen position range is 1001x1001; |
277 EXPECT_EQ(sqrt((2560.0 * 1600.0) / (1001.0 * 1001.0)), | 275 EXPECT_EQ(sqrt((2560.0 * 1600.0) / (1001.0 * 1001.0)), |
278 tt_controller->GetTouchResolutionScale(display, touch_device)); | 276 tt_controller->GetTouchResolutionScale(display, touch_device)); |
279 } | 277 } |
280 | 278 |
281 } // namespace ash | 279 } // namespace ash |
OLD | NEW |