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

Unified Diff: ash/touch/touchscreen_util_unittest.cc

Issue 618283003: Adds special support to the device manager for keyboards devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to master. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/touch/touchscreen_util.cc ('k') | ui/events/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/touch/touchscreen_util_unittest.cc
diff --git a/ash/touch/touchscreen_util_unittest.cc b/ash/touch/touchscreen_util_unittest.cc
index fd88fc1ad91076bbcadd952f09d5e8adbdf1038e..3ac903f29f590ac12a5b8fad6c15aa5b8338e169 100644
--- a/ash/touch/touchscreen_util_unittest.cc
+++ b/ash/touch/touchscreen_util_unittest.cc
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <string>
#include <vector>
#include "ash/display/display_info.h"
#include "ash/touch/touchscreen_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/events/input_device.h"
namespace ash {
@@ -76,65 +78,77 @@ TEST_F(TouchscreenUtilTest, NoTouchscreens) {
TEST_F(TouchscreenUtilTest, OneToOneMapping) {
std::vector<ui::TouchscreenDevice> devices;
- devices.push_back(ui::TouchscreenDevice(1, gfx::Size(800, 600), false));
- devices.push_back(ui::TouchscreenDevice(2, gfx::Size(1024, 768), false));
+ devices.push_back(ui::TouchscreenDevice(
+ 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "", gfx::Size(800, 600)));
+ devices.push_back(ui::TouchscreenDevice(
+ 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "", gfx::Size(1024, 768)));
AssociateTouchscreens(&displays_, devices);
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[0].touch_device_id());
- EXPECT_EQ(1, displays_[1].touch_device_id());
+ EXPECT_EQ(1u, displays_[1].touch_device_id());
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[2].touch_device_id());
- EXPECT_EQ(2, displays_[3].touch_device_id());
+ EXPECT_EQ(2u, displays_[3].touch_device_id());
}
TEST_F(TouchscreenUtilTest, MapToCorrectDisplaySize) {
std::vector<ui::TouchscreenDevice> devices;
- devices.push_back(ui::TouchscreenDevice(2, gfx::Size(1024, 768), false));
+ devices.push_back(ui::TouchscreenDevice(
+ 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "", gfx::Size(1024, 768)));
AssociateTouchscreens(&displays_, devices);
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[0].touch_device_id());
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[1].touch_device_id());
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[2].touch_device_id());
- EXPECT_EQ(2, displays_[3].touch_device_id());
+ EXPECT_EQ(2u, displays_[3].touch_device_id());
}
TEST_F(TouchscreenUtilTest, MapWhenSizeDiffersByOne) {
std::vector<ui::TouchscreenDevice> devices;
- devices.push_back(ui::TouchscreenDevice(1, gfx::Size(801, 600), false));
- devices.push_back(ui::TouchscreenDevice(2, gfx::Size(1023, 768), false));
+ devices.push_back(ui::TouchscreenDevice(
+ 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "", gfx::Size(801, 600)));
+ devices.push_back(ui::TouchscreenDevice(
+ 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "", gfx::Size(1023, 768)));
AssociateTouchscreens(&displays_, devices);
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[0].touch_device_id());
- EXPECT_EQ(1, displays_[1].touch_device_id());
+ EXPECT_EQ(1u, displays_[1].touch_device_id());
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[2].touch_device_id());
- EXPECT_EQ(2, displays_[3].touch_device_id());
+ EXPECT_EQ(2u, displays_[3].touch_device_id());
}
TEST_F(TouchscreenUtilTest, MapWhenSizesDoNotMatch) {
std::vector<ui::TouchscreenDevice> devices;
- devices.push_back(ui::TouchscreenDevice(1, gfx::Size(1022, 768), false));
- devices.push_back(ui::TouchscreenDevice(2, gfx::Size(802, 600), false));
+ devices.push_back(ui::TouchscreenDevice(
+ 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "", gfx::Size(1022, 768)));
+ devices.push_back(ui::TouchscreenDevice(
+ 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "", gfx::Size(802, 600)));
AssociateTouchscreens(&displays_, devices);
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[0].touch_device_id());
- EXPECT_EQ(1, displays_[1].touch_device_id());
+ EXPECT_EQ(1u, displays_[1].touch_device_id());
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[2].touch_device_id());
- EXPECT_EQ(2, displays_[3].touch_device_id());
+ EXPECT_EQ(2u, displays_[3].touch_device_id());
}
TEST_F(TouchscreenUtilTest, MapInternalTouchscreen) {
std::vector<ui::TouchscreenDevice> devices;
- devices.push_back(ui::TouchscreenDevice(1, gfx::Size(1920, 1080), false));
- devices.push_back(ui::TouchscreenDevice(2, gfx::Size(9999, 888), true));
+ devices.push_back(
+ ui::TouchscreenDevice(1,
+ ui::InputDeviceType::INPUT_DEVICE_EXTERNAL,
+ "",
+ gfx::Size(1920, 1080)));
+ devices.push_back(ui::TouchscreenDevice(
+ 2, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "", gfx::Size(9999, 888)));
AssociateTouchscreens(&displays_, devices);
// Internal touchscreen is always mapped to internal display.
- EXPECT_EQ(2, displays_[0].touch_device_id());
- EXPECT_EQ(1, displays_[1].touch_device_id());
+ EXPECT_EQ(2u, displays_[0].touch_device_id());
+ EXPECT_EQ(1u, displays_[1].touch_device_id());
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[2].touch_device_id());
EXPECT_EQ(ui::TouchscreenDevice::kInvalidId, displays_[3].touch_device_id());
}
« no previous file with comments | « ash/touch/touchscreen_util.cc ('k') | ui/events/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698