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

Unified Diff: services/ui/ws/test_change_tracker.cc

Issue 2125663002: mus: Add watcher for all touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Overload copy assignment operator for Change struct. 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/test_change_tracker.cc
diff --git a/services/ui/ws/test_change_tracker.cc b/services/ui/ws/test_change_tracker.cc
index 438069eea1033f35095902ba78e71c5dc0a35cf2..e8f9ddf6ec65b5e2dddfa6e4629eb61a5d739da1 100644
--- a/services/ui/ws/test_change_tracker.cc
+++ b/services/ui/ws/test_change_tracker.cc
@@ -103,16 +103,24 @@ std::string ChangeToDescription(const Change& change,
std::string result = base::StringPrintf(
"InputEvent window=%s event_action=%d",
WindowIdToString(change.window_id).c_str(), change.event_action);
- if (change.event_observer_id != 0)
- base::StringAppendF(&result, " event_observer_id=%u",
- change.event_observer_id);
+ if (!change.event_observer_ids.is_null() &&
+ !change.event_observer_ids.empty()) {
+ for (uint32_t id : change.event_observer_ids) {
+ if (id != 0)
+ base::StringAppendF(&result, " event_observer_id=%u", id);
+ }
+ }
return result;
}
- case CHANGE_TYPE_EVENT_OBSERVED:
- return base::StringPrintf(
- "EventObserved event_action=%d event_observer_id=%u",
- change.event_action, change.event_observer_id);
+ case CHANGE_TYPE_EVENT_OBSERVED: {
+ std::string result = base::StringPrintf(
+ "EventObserved event_action=%d", change.event_action);
+ for (uint32_t id : change.event_observer_ids) {
+ base::StringAppendF(&result, " event_observer_id=%u", id);
+ }
+ return result;
+ }
case CHANGE_TYPE_PROPERTY_CHANGED:
return base::StringPrintf("PropertyChanged window=%s key=%s value=%s",
@@ -216,17 +224,57 @@ Change::Change()
window_id2(0),
window_id3(0),
event_action(0),
- event_observer_id(0u),
direction(mojom::OrderDirection::ABOVE),
bool_value(false),
float_value(0.f),
cursor_id(0),
change_id(0u) {}
-Change::Change(const Change& other) = default;
+Change::Change(const Change& other) {
+ type = other.type;
+ client_id = other.client_id;
+ windows = other.windows;
+ window_id = other.window_id;
+ window_id2 = other.window_id2;
+ window_id3 = other.window_id3;
+ bounds = other.bounds;
+ bounds2 = other.bounds2;
+ event_action = other.event_action;
+ event_observer_ids = other.event_observer_ids.Clone();
+ embed_url = other.embed_url;
+ direction = other.direction;
+ bool_value = other.bool_value;
+ float_value = other.float_value;
+ property_key = other.property_key;
+ property_value = other.property_value;
+ cursor_id = other.cursor_id;
+ change_id = other.change_id;
+}
Change::~Change() {}
+Change& Change::operator=(Change other) {
+ type = other.type;
+ client_id = other.client_id;
+ windows = other.windows;
+ window_id = other.window_id;
+ window_id2 = other.window_id2;
+ window_id3 = other.window_id3;
+ bounds = other.bounds;
+ bounds2 = other.bounds2;
+ event_action = other.event_action;
+ event_observer_ids = other.event_observer_ids.Clone();
+ embed_url = other.embed_url;
+ direction = other.direction;
+ bool_value = other.bool_value;
+ float_value = other.float_value;
+ property_key = other.property_key;
+ property_value = other.property_value;
+ cursor_id = other.cursor_id;
+ change_id = other.change_id;
+ return *this;
+}
+
TestChangeTracker::TestChangeTracker() : delegate_(NULL) {}
TestChangeTracker::~TestChangeTracker() {}
@@ -349,23 +397,23 @@ void TestChangeTracker::OnWindowParentDrawnStateChanged(Id window_id,
AddChange(change);
}
-void TestChangeTracker::OnWindowInputEvent(Id window_id,
- const ui::Event& event,
- uint32_t event_observer_id) {
+void TestChangeTracker::OnWindowInputEvent(
+ Id window_id, const ui::Event& event,
+ mojo::Array<uint32_t> event_observer_ids) {
Change change;
change.type = CHANGE_TYPE_INPUT_EVENT;
change.window_id = window_id;
change.event_action = static_cast<int32_t>(event.type());
- change.event_observer_id = event_observer_id;
+ change.event_observer_ids = std::move(event_observer_ids);
AddChange(change);
}
-void TestChangeTracker::OnEventObserved(const ui::Event& event,
- uint32_t event_observer_id) {
+void TestChangeTracker::OnEventObserved(
+ const ui::Event& event, mojo::Array<uint32_t> event_observer_ids) {
Change change;
change.type = CHANGE_TYPE_EVENT_OBSERVED;
change.event_action = static_cast<int32_t>(event.type());
- change.event_observer_id = event_observer_id;
+ change.event_observer_ids = std::move(event_observer_ids);
AddChange(change);
}

Powered by Google App Engine
This is Rietveld 408576698