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

Side by Side Diff: services/ui/ws/test_change_tracker.cc

Issue 2183163002: mus: Change PointerWatcher to observe all pointer events, with moves optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « services/ui/ws/test_change_tracker.h ('k') | services/ui/ws/test_utils.h » ('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 "services/ui/ws/test_change_tracker.h" 5 #include "services/ui/ws/test_change_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 case CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED: 97 case CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED:
98 return base::StringPrintf("DrawnStateChanged window=%s drawn=%s", 98 return base::StringPrintf("DrawnStateChanged window=%s drawn=%s",
99 WindowIdToString(change.window_id).c_str(), 99 WindowIdToString(change.window_id).c_str(),
100 change.bool_value ? "true" : "false"); 100 change.bool_value ? "true" : "false");
101 101
102 case CHANGE_TYPE_INPUT_EVENT: { 102 case CHANGE_TYPE_INPUT_EVENT: {
103 std::string result = base::StringPrintf( 103 std::string result = base::StringPrintf(
104 "InputEvent window=%s event_action=%d", 104 "InputEvent window=%s event_action=%d",
105 WindowIdToString(change.window_id).c_str(), change.event_action); 105 WindowIdToString(change.window_id).c_str(), change.event_action);
106 if (change.event_observer_id != 0) 106 if (change.pointer_watcher_id != 0)
107 base::StringAppendF(&result, " event_observer_id=%u", 107 base::StringAppendF(&result, " pointer_watcher_id=%u",
108 change.event_observer_id); 108 change.pointer_watcher_id);
109 return result; 109 return result;
110 } 110 }
111 111
112 case CHANGE_TYPE_EVENT_OBSERVED: 112 case CHANGE_TYPE_POINTER_WATCHER_EVENT:
113 return base::StringPrintf( 113 return base::StringPrintf(
114 "EventObserved event_action=%d event_observer_id=%u", 114 "PointerWatcherEvent event_action=%d pointer_watcher_id=%u",
115 change.event_action, change.event_observer_id); 115 change.event_action, change.pointer_watcher_id);
116 116
117 case CHANGE_TYPE_PROPERTY_CHANGED: 117 case CHANGE_TYPE_PROPERTY_CHANGED:
118 return base::StringPrintf("PropertyChanged window=%s key=%s value=%s", 118 return base::StringPrintf("PropertyChanged window=%s key=%s value=%s",
119 WindowIdToString(change.window_id).c_str(), 119 WindowIdToString(change.window_id).c_str(),
120 change.property_key.c_str(), 120 change.property_key.c_str(),
121 change.property_value.c_str()); 121 change.property_value.c_str());
122 122
123 case CHANGE_TYPE_FOCUSED: 123 case CHANGE_TYPE_FOCUSED:
124 return base::StringPrintf("Focused id=%s", 124 return base::StringPrintf("Focused id=%s",
125 WindowIdToString(change.window_id).c_str()); 125 WindowIdToString(change.window_id).c_str());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 test_windows->push_back(WindowDataToTestWindow(data[i])); 209 test_windows->push_back(WindowDataToTestWindow(data[i]));
210 } 210 }
211 211
212 Change::Change() 212 Change::Change()
213 : type(CHANGE_TYPE_EMBED), 213 : type(CHANGE_TYPE_EMBED),
214 client_id(0), 214 client_id(0),
215 window_id(0), 215 window_id(0),
216 window_id2(0), 216 window_id2(0),
217 window_id3(0), 217 window_id3(0),
218 event_action(0), 218 event_action(0),
219 event_observer_id(0u), 219 pointer_watcher_id(0u),
220 direction(mojom::OrderDirection::ABOVE), 220 direction(mojom::OrderDirection::ABOVE),
221 bool_value(false), 221 bool_value(false),
222 float_value(0.f), 222 float_value(0.f),
223 cursor_id(0), 223 cursor_id(0),
224 change_id(0u) {} 224 change_id(0u) {}
225 225
226 Change::Change(const Change& other) = default; 226 Change::Change(const Change& other) = default;
227 227
228 Change::~Change() {} 228 Change::~Change() {}
229 229
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 bool drawn) { 344 bool drawn) {
345 Change change; 345 Change change;
346 change.type = CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED; 346 change.type = CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED;
347 change.window_id = window_id; 347 change.window_id = window_id;
348 change.bool_value = drawn; 348 change.bool_value = drawn;
349 AddChange(change); 349 AddChange(change);
350 } 350 }
351 351
352 void TestChangeTracker::OnWindowInputEvent(Id window_id, 352 void TestChangeTracker::OnWindowInputEvent(Id window_id,
353 const ui::Event& event, 353 const ui::Event& event,
354 uint32_t event_observer_id) { 354 uint32_t pointer_watcher_id) {
355 Change change; 355 Change change;
356 change.type = CHANGE_TYPE_INPUT_EVENT; 356 change.type = CHANGE_TYPE_INPUT_EVENT;
357 change.window_id = window_id; 357 change.window_id = window_id;
358 change.event_action = static_cast<int32_t>(event.type()); 358 change.event_action = static_cast<int32_t>(event.type());
359 change.event_observer_id = event_observer_id; 359 change.pointer_watcher_id = pointer_watcher_id;
360 AddChange(change); 360 AddChange(change);
361 } 361 }
362 362
363 void TestChangeTracker::OnEventObserved(const ui::Event& event, 363 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event,
364 uint32_t event_observer_id) { 364 uint32_t pointer_watcher_id) {
365 Change change; 365 Change change;
366 change.type = CHANGE_TYPE_EVENT_OBSERVED; 366 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT;
367 change.event_action = static_cast<int32_t>(event.type()); 367 change.event_action = static_cast<int32_t>(event.type());
368 change.event_observer_id = event_observer_id; 368 change.pointer_watcher_id = pointer_watcher_id;
369 AddChange(change); 369 AddChange(change);
370 } 370 }
371 371
372 void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id, 372 void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id,
373 String name, 373 String name,
374 Array<uint8_t> data) { 374 Array<uint8_t> data) {
375 Change change; 375 Change change;
376 change.type = CHANGE_TYPE_PROPERTY_CHANGED; 376 change.type = CHANGE_TYPE_PROPERTY_CHANGED;
377 change.window_id = window_id; 377 change.window_id = window_id;
378 change.property_key = name; 378 change.property_key = name;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 std::string TestWindow::ToString2() const { 440 std::string TestWindow::ToString2() const {
441 return base::StringPrintf( 441 return base::StringPrintf(
442 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(), 442 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(),
443 WindowIdToString(parent_id).c_str(), visible ? "true" : "false"); 443 WindowIdToString(parent_id).c_str(), visible ? "true" : "false");
444 } 444 }
445 445
446 } // namespace ws 446 } // namespace ws
447 447
448 } // namespace ui 448 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/test_change_tracker.h ('k') | services/ui/ws/test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698