| 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 15 matching lines...) Expand all Loading... |
| 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, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, | 35 return ui::TouchscreenDevice(id, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, |
| 36 std::string(), size, 0); | 36 size, 0); |
| 37 } | 37 } |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 typedef test::AshTestBase TouchTransformerControllerTest; | 41 typedef test::AshTestBase TouchTransformerControllerTest; |
| 42 | 42 |
| 43 TEST_F(TouchTransformerControllerTest, MirrorModeLetterboxing) { | 43 TEST_F(TouchTransformerControllerTest, MirrorModeLetterboxing) { |
| 44 // The internal display has native resolution of 2560x1700, and in | 44 // The internal display has native resolution of 2560x1700, and in |
| 45 // mirror mode it is configured as 1920x1200. This is in letterboxing | 45 // mirror mode it is configured as 1920x1200. This is in letterboxing |
| 46 // mode. | 46 // mode. |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 CreateTouchscreenDevice(5, gfx::Size(1001, 1001)); | 345 CreateTouchscreenDevice(5, gfx::Size(1001, 1001)); |
| 346 | 346 |
| 347 TouchTransformerController* tt_controller = | 347 TouchTransformerController* tt_controller = |
| 348 Shell::GetInstance()->touch_transformer_controller(); | 348 Shell::GetInstance()->touch_transformer_controller(); |
| 349 // Default touchscreen position range is 1001x1001; | 349 // Default touchscreen position range is 1001x1001; |
| 350 EXPECT_EQ(sqrt((2560.0 * 1600.0) / (1001.0 * 1001.0)), | 350 EXPECT_EQ(sqrt((2560.0 * 1600.0) / (1001.0 * 1001.0)), |
| 351 tt_controller->GetTouchResolutionScale(display, touch_device)); | 351 tt_controller->GetTouchResolutionScale(display, touch_device)); |
| 352 } | 352 } |
| 353 | 353 |
| 354 } // namespace ash | 354 } // namespace ash |
| OLD | NEW |