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

Side by Side Diff: ui/events/devices/mojo/input_device_struct_traits.cc

Issue 2100893002: Add tests for InputDevice/TouchscreenDevice StructTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win. Created 4 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 unified diff | Download patch
« no previous file with comments | « ui/events/devices/mojo/input_device_struct_traits.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/events/devices/mojo/input_device_struct_traits.h" 5 #include "ui/events/devices/mojo/input_device_struct_traits.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" 8 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ui::mojom::InputDeviceDataView data, 48 ui::mojom::InputDeviceDataView data,
49 ui::InputDevice* out) { 49 ui::InputDevice* out) {
50 out->id = data.id(); 50 out->id = data.id();
51 51
52 if (!data.ReadType(&out->type)) 52 if (!data.ReadType(&out->type))
53 return false; 53 return false;
54 54
55 if (!data.ReadName(&out->name)) 55 if (!data.ReadName(&out->name))
56 return false; 56 return false;
57 57
58 base::StringPiece sys_path_string; 58 std::string sys_path_string;
59 if (!data.ReadSysPath(&sys_path_string)) 59 if (!data.ReadSysPath(&sys_path_string))
60 return false; 60 return false;
61 out->sys_path = base::FilePath::FromUTF8Unsafe(sys_path_string); 61 out->sys_path = base::FilePath::FromUTF8Unsafe(sys_path_string);
62 62
63 out->vendor_id = data.vendor_id(); 63 out->vendor_id = data.vendor_id();
64 out->product_id = data.product_id(); 64 out->product_id = data.product_id();
65 65
66 return true; 66 return true;
67 } 67 }
68 68
69 bool StructTraits<ui::mojom::TouchscreenDevice, ui::TouchscreenDevice>::Read( 69 bool StructTraits<ui::mojom::TouchscreenDevice, ui::TouchscreenDevice>::Read(
70 ui::mojom::TouchscreenDeviceDataView data, 70 ui::mojom::TouchscreenDeviceDataView data,
71 ui::TouchscreenDevice* out) { 71 ui::TouchscreenDevice* out) {
72 if (!data.ReadInputDevice(static_cast<ui::InputDevice*>(out))) 72 if (!data.ReadInputDevice(static_cast<ui::InputDevice*>(out)))
73 return false; 73 return false;
74 74
75 if (!data.ReadSize(&out->size)) 75 if (!data.ReadSize(&out->size))
76 return false; 76 return false;
77 77
78 out->touch_points = data.touch_points(); 78 out->touch_points = data.touch_points();
79 79
80 return true; 80 return true;
81 } 81 }
82 82
83 } // namespace mojo 83 } // namespace mojo
OLDNEW
« no previous file with comments | « ui/events/devices/mojo/input_device_struct_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698