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

Unified Diff: ui/display/chromeos/touchscreen_delegate_impl_unittest.cc

Issue 394063004: Associate internal touchscreen to internal display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove using external script is_touchscreen_internal Created 6 years, 5 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
Index: ui/display/chromeos/touchscreen_delegate_impl_unittest.cc
diff --git a/ui/display/chromeos/touchscreen_delegate_impl_unittest.cc b/ui/display/chromeos/touchscreen_delegate_impl_unittest.cc
index b41fbdbacc0d973064ad703717d4d6f10475d9d4..9e80712177d5e3813304868658b5c9e842fe3020 100644
--- a/ui/display/chromeos/touchscreen_delegate_impl_unittest.cc
+++ b/ui/display/chromeos/touchscreen_delegate_impl_unittest.cc
@@ -48,8 +48,9 @@ class TouchscreenDelegateImplTest : public testing::Test {
delegate_.reset(new TouchscreenDelegateImpl(
scoped_ptr<TouchscreenDeviceManager>(device_manager_)));
- // Internal display. Must not be matched to a touch screen unless the size
- // matches.
+ // Internal display will always match to internal touchscreen. If internal
+ // touchscreen can't be detected, it is then associated to a touch screen
+ // with matching size.
TestDisplaySnapshot* snapshot = new TestDisplaySnapshot();
DisplayMode* mode = new DisplayMode(gfx::Size(1920, 1080), false, 60.0);
snapshot->set_type(DISPLAY_CONNECTION_TYPE_INTERNAL);
@@ -110,8 +111,8 @@ TEST_F(TouchscreenDelegateImplTest, NoTouchscreens) {
}
TEST_F(TouchscreenDelegateImplTest, OneToOneMapping) {
- device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(800, 600)));
- device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1024, 768)));
+ device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(800, 600), false));
+ device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1024, 768), false));
std::vector<DisplayConfigurator::DisplayState> display_states =
GetDisplayStates();
@@ -124,7 +125,7 @@ TEST_F(TouchscreenDelegateImplTest, OneToOneMapping) {
}
TEST_F(TouchscreenDelegateImplTest, MapToCorrectDisplaySize) {
- device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1024, 768)));
+ device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1024, 768), false));
std::vector<DisplayConfigurator::DisplayState> display_states =
GetDisplayStates();
@@ -137,8 +138,8 @@ TEST_F(TouchscreenDelegateImplTest, MapToCorrectDisplaySize) {
}
TEST_F(TouchscreenDelegateImplTest, MapWhenSizeDiffersByOne) {
- device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(801, 600)));
- device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1023, 768)));
+ device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(801, 600), false));
+ device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(1023, 768), false));
std::vector<DisplayConfigurator::DisplayState> display_states =
GetDisplayStates();
@@ -151,8 +152,8 @@ TEST_F(TouchscreenDelegateImplTest, MapWhenSizeDiffersByOne) {
}
TEST_F(TouchscreenDelegateImplTest, MapWhenSizesDoNotMatch) {
- device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(1022, 768)));
- device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(802, 600)));
+ device_manager_->AddDevice(TouchscreenDevice(1, gfx::Size(1022, 768), false));
+ device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(802, 600), false));
std::vector<DisplayConfigurator::DisplayState> display_states =
GetDisplayStates();
@@ -164,4 +165,20 @@ TEST_F(TouchscreenDelegateImplTest, MapWhenSizesDoNotMatch) {
EXPECT_EQ(2, display_states[3].touch_device_id);
}
+TEST_F(TouchscreenDelegateImplTest, MapInternalTouchscreen) {
+ device_manager_->AddDevice(
+ TouchscreenDevice(1, gfx::Size(1920, 1080), false));
+ device_manager_->AddDevice(TouchscreenDevice(2, gfx::Size(9999, 888), true));
+
+ std::vector<DisplayConfigurator::DisplayState> display_states =
+ GetDisplayStates();
+ delegate_->AssociateTouchscreens(&display_states);
+
+ // Internal touchscreen is always mapped to internal display.
+ EXPECT_EQ(2, display_states[0].touch_device_id);
+ EXPECT_EQ(1, display_states[1].touch_device_id);
+ EXPECT_EQ(TouchscreenDevice::kInvalidId, display_states[2].touch_device_id);
+ EXPECT_EQ(TouchscreenDevice::kInvalidId, display_states[3].touch_device_id);
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698