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

Side by Side Diff: ash/touch/touchscreen_util_unittest.cc

Issue 2196923002: Make ash::DisplayMode more like ui::DisplayMode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 4 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/common/display/display_info.h" 8 #include "ash/common/display/display_info.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/test/display_manager_test_api.h" 10 #include "ash/test/display_manager_test_api.h"
11 #include "ash/touch/touchscreen_util.h" 11 #include "ash/touch/touchscreen_util.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/events/devices/input_device.h" 13 #include "ui/events/devices/input_device.h"
14 14
15 namespace ash { 15 namespace ash {
16 16
17 class TouchscreenUtilTest : public test::AshTestBase { 17 class TouchscreenUtilTest : public test::AshTestBase {
18 public: 18 public:
19 TouchscreenUtilTest() {} 19 TouchscreenUtilTest() {}
20 ~TouchscreenUtilTest() override {} 20 ~TouchscreenUtilTest() override {}
21 21
22 void SetUp() override { 22 void SetUp() override {
23 test::AshTestBase::SetUp(); 23 test::AshTestBase::SetUp();
24 // Internal display will always match to internal touchscreen. If internal 24 // Internal display will always match to internal touchscreen. If internal
25 // touchscreen can't be detected, it is then associated to a touch screen 25 // touchscreen can't be detected, it is then associated to a touch screen
26 // with matching size. 26 // with matching size.
27 { 27 {
28 DisplayInfo display(1, "1", false); 28 DisplayInfo display(1, "1", false);
29 DisplayMode mode(gfx::Size(1920, 1080), 60.0, false, true); 29 scoped_refptr<DisplayMode> mode(
30 mode.native = true; 30 new DisplayMode(gfx::Size(1920, 1080), 60.0, false /* interlaced */,
31 std::vector<DisplayMode> modes(1, mode); 31 true /* native */, 1.0 /* ui_scale */,
32 1.0 /* device_scale_factor */));
33 DisplayInfo::DisplayModeList modes(1, mode);
32 display.SetDisplayModes(modes); 34 display.SetDisplayModes(modes);
33 displays_.push_back(display); 35 displays_.push_back(display);
34 } 36 }
35 37
36 { 38 {
37 DisplayInfo display(2, "2", false); 39 DisplayInfo display(2, "2", false);
38 DisplayMode mode(gfx::Size(800, 600), 60.0, false, true); 40
39 mode.native = true; 41 scoped_refptr<DisplayMode> mode(new DisplayMode(
40 std::vector<DisplayMode> modes(1, mode); 42 gfx::Size(800, 600), 60.0, false /* interlaced */, true /* native */,
43 1.0 /* ui_scale */, 1.0 /* device_scale_factor */));
44 DisplayInfo::DisplayModeList modes(1, mode);
41 display.SetDisplayModes(modes); 45 display.SetDisplayModes(modes);
42 displays_.push_back(display); 46 displays_.push_back(display);
43 } 47 }
44 48
45 // Display without native mode. Must not be matched to any touch screen. 49 // Display without native mode. Must not be matched to any touch screen.
46 { 50 {
47 DisplayInfo display(3, "3", false); 51 DisplayInfo display(3, "3", false);
48 displays_.push_back(display); 52 displays_.push_back(display);
49 } 53 }
50 54
51 { 55 {
52 DisplayInfo display(4, "4", false); 56 DisplayInfo display(4, "4", false);
53 DisplayMode mode(gfx::Size(1024, 768), 60.0, false, true); 57
54 mode.native = true; 58 scoped_refptr<DisplayMode> mode(
55 std::vector<DisplayMode> modes(1, mode); 59 new DisplayMode(gfx::Size(1024, 768), 60.0, false /* interlaced */,
60 /* native */ true, 1.0 /* ui_scale */,
61 1.0 /* device_scale_factor */));
62 DisplayInfo::DisplayModeList modes(1, mode);
56 display.SetDisplayModes(modes); 63 display.SetDisplayModes(modes);
57 displays_.push_back(display); 64 displays_.push_back(display);
58 } 65 }
59 } 66 }
60 67
61 void TearDown() override { 68 void TearDown() override {
62 displays_.clear(); 69 displays_.clear();
63 test::AshTestBase::TearDown(); 70 test::AshTestBase::TearDown();
64 } 71 }
65 72
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 AssociateTouchscreens(&displays_, devices); 264 AssociateTouchscreens(&displays_, devices);
258 265
259 EXPECT_EQ(1u, displays_[0].input_devices().size()); 266 EXPECT_EQ(1u, displays_[0].input_devices().size());
260 EXPECT_EQ(1, displays_[0].input_devices()[0]); 267 EXPECT_EQ(1, displays_[0].input_devices()[0]);
261 EXPECT_EQ(0u, displays_[1].input_devices().size()); 268 EXPECT_EQ(0u, displays_[1].input_devices().size());
262 EXPECT_EQ(0u, displays_[2].input_devices().size()); 269 EXPECT_EQ(0u, displays_[2].input_devices().size());
263 EXPECT_EQ(0u, displays_[3].input_devices().size()); 270 EXPECT_EQ(0u, displays_[3].input_devices().size());
264 } 271 }
265 272
266 } // namespace ash 273 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698