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

Side by Side Diff: ash/host/ash_window_tree_host_x11_unittest.cc

Issue 1071193002: Change device IDs from unsigned to signed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check for negative IDs Created 5 years, 8 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
« no previous file with comments | « ash/display/display_info.h ('k') | ash/touch/touch_transformer_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/host/ash_window_tree_host_x11.h" 5 #include "ash/host/ash_window_tree_host_x11.h"
6 6
7 #undef None 7 #undef None
8 #undef Bool 8 #undef Bool
9 9
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Send X touch events to one WindowTreeHost. The WindowTreeHost's 85 // Send X touch events to one WindowTreeHost. The WindowTreeHost's
86 // delegate will get corresponding ui::TouchEvent if the touch events 86 // delegate will get corresponding ui::TouchEvent if the touch events
87 // are targeting this WindowTreeHost. 87 // are targeting this WindowTreeHost.
88 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) { 88 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) {
89 scoped_ptr<aura::WindowTreeHostX11> window_tree_host( 89 scoped_ptr<aura::WindowTreeHostX11> window_tree_host(
90 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); 90 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700)));
91 window_tree_host->InitHost(); 91 window_tree_host->InitHost();
92 scoped_ptr<RootWindowEventHandler> handler( 92 scoped_ptr<RootWindowEventHandler> handler(
93 new RootWindowEventHandler(window_tree_host.get())); 93 new RootWindowEventHandler(window_tree_host.get()));
94 94
95 std::vector<unsigned int> devices; 95 std::vector<int> devices;
96 devices.push_back(0); 96 devices.push_back(0);
97 ui::SetUpTouchDevicesForTest(devices); 97 ui::SetUpTouchDevicesForTest(devices);
98 std::vector<ui::Valuator> valuators; 98 std::vector<ui::Valuator> valuators;
99 99
100 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); 100 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type());
101 EXPECT_EQ(-1, handler->last_touch_id()); 101 EXPECT_EQ(-1, handler->last_touch_id());
102 102
103 ui::ScopedXI2Event scoped_xevent; 103 ui::ScopedXI2Event scoped_xevent;
104 // This touch is out of bounds. 104 // This touch is out of bounds.
105 scoped_xevent.InitTouchEvent( 105 scoped_xevent.InitTouchEvent(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 scoped_ptr<RootWindowEventHandler> handler1( 148 scoped_ptr<RootWindowEventHandler> handler1(
149 new RootWindowEventHandler(window_tree_host1.get())); 149 new RootWindowEventHandler(window_tree_host1.get()));
150 150
151 int host2_y_offset = 1700; 151 int host2_y_offset = 1700;
152 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2( 152 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2(
153 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); 153 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080)));
154 window_tree_host2->InitHost(); 154 window_tree_host2->InitHost();
155 scoped_ptr<RootWindowEventHandler> handler2( 155 scoped_ptr<RootWindowEventHandler> handler2(
156 new RootWindowEventHandler(window_tree_host2.get())); 156 new RootWindowEventHandler(window_tree_host2.get()));
157 157
158 std::vector<unsigned int> devices; 158 std::vector<int> devices;
159 devices.push_back(0); 159 devices.push_back(0);
160 ui::SetUpTouchDevicesForTest(devices); 160 ui::SetUpTouchDevicesForTest(devices);
161 std::vector<ui::Valuator> valuators; 161 std::vector<ui::Valuator> valuators;
162 162
163 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); 163 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type());
164 EXPECT_EQ(-1, handler1->last_touch_id()); 164 EXPECT_EQ(-1, handler1->last_touch_id());
165 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type()); 165 EXPECT_EQ(ui::ET_UNKNOWN, handler2->last_touch_type());
166 EXPECT_EQ(-1, handler2->last_touch_id()); 166 EXPECT_EQ(-1, handler2->last_touch_id());
167 167
168 // 2 Touch events are targeted at the second WindowTreeHost. 168 // 2 Touch events are targeted at the second WindowTreeHost.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); 243 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location());
244 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); 244 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type());
245 EXPECT_EQ(1, handler2->last_touch_id()); 245 EXPECT_EQ(1, handler2->last_touch_id());
246 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); 246 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location());
247 247
248 handler1.reset(); 248 handler1.reset();
249 handler2.reset(); 249 handler2.reset();
250 } 250 }
251 251
252 } // namespace aura 252 } // namespace aura
OLDNEW
« no previous file with comments | « ash/display/display_info.h ('k') | ash/touch/touch_transformer_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698