| OLD | NEW |
| 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 "components/mus/ws/test_change_tracker.h" | 5 #include "components/mus/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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return base::StringPrintf("VisibilityChanged window=%s visible=%s", | 103 return base::StringPrintf("VisibilityChanged window=%s visible=%s", |
| 104 WindowIdToString(change.window_id).c_str(), | 104 WindowIdToString(change.window_id).c_str(), |
| 105 change.bool_value ? "true" : "false"); | 105 change.bool_value ? "true" : "false"); |
| 106 | 106 |
| 107 case CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED: | 107 case CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED: |
| 108 return base::StringPrintf("DrawnStateChanged window=%s drawn=%s", | 108 return base::StringPrintf("DrawnStateChanged window=%s drawn=%s", |
| 109 WindowIdToString(change.window_id).c_str(), | 109 WindowIdToString(change.window_id).c_str(), |
| 110 change.bool_value ? "true" : "false"); | 110 change.bool_value ? "true" : "false"); |
| 111 | 111 |
| 112 case CHANGE_TYPE_INPUT_EVENT: | 112 case CHANGE_TYPE_INPUT_EVENT: |
| 113 return base::StringPrintf("InputEvent window=%s event_action=%d", | 113 return base::StringPrintf( |
| 114 WindowIdToString(change.window_id).c_str(), | 114 "InputEvent window=%s event_action=%d matched_observer=%s", |
| 115 WindowIdToString(change.window_id).c_str(), change.event_action, |
| 116 change.bool_value ? "true" : "false"); |
| 117 |
| 118 case CHANGE_TYPE_EVENT_OBSERVED: |
| 119 return base::StringPrintf("EventObserved event_action=%d", |
| 115 change.event_action); | 120 change.event_action); |
| 116 | 121 |
| 117 case CHANGE_TYPE_PROPERTY_CHANGED: | 122 case CHANGE_TYPE_PROPERTY_CHANGED: |
| 118 return base::StringPrintf("PropertyChanged window=%s key=%s value=%s", | 123 return base::StringPrintf("PropertyChanged window=%s key=%s value=%s", |
| 119 WindowIdToString(change.window_id).c_str(), | 124 WindowIdToString(change.window_id).c_str(), |
| 120 change.property_key.c_str(), | 125 change.property_key.c_str(), |
| 121 change.property_value.c_str()); | 126 change.property_value.c_str()); |
| 122 | 127 |
| 123 case CHANGE_TYPE_FOCUSED: | 128 case CHANGE_TYPE_FOCUSED: |
| 124 return base::StringPrintf("Focused id=%s", | 129 return base::StringPrintf("Focused id=%s", |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 void TestChangeTracker::OnWindowParentDrawnStateChanged(Id window_id, | 360 void TestChangeTracker::OnWindowParentDrawnStateChanged(Id window_id, |
| 356 bool drawn) { | 361 bool drawn) { |
| 357 Change change; | 362 Change change; |
| 358 change.type = CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED; | 363 change.type = CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED; |
| 359 change.window_id = window_id; | 364 change.window_id = window_id; |
| 360 change.bool_value = drawn; | 365 change.bool_value = drawn; |
| 361 AddChange(change); | 366 AddChange(change); |
| 362 } | 367 } |
| 363 | 368 |
| 364 void TestChangeTracker::OnWindowInputEvent(Id window_id, | 369 void TestChangeTracker::OnWindowInputEvent(Id window_id, |
| 365 mojom::EventPtr event) { | 370 mojom::EventPtr event, |
| 371 bool matched_observer) { |
| 366 Change change; | 372 Change change; |
| 367 change.type = CHANGE_TYPE_INPUT_EVENT; | 373 change.type = CHANGE_TYPE_INPUT_EVENT; |
| 368 change.window_id = window_id; | 374 change.window_id = window_id; |
| 369 change.event_action = static_cast<int32_t>(event->action); | 375 change.event_action = static_cast<int32_t>(event->action); |
| 376 change.bool_value = matched_observer; |
| 370 AddChange(change); | 377 AddChange(change); |
| 371 } | 378 } |
| 372 | 379 |
| 380 void TestChangeTracker::OnEventObserved(mojom::EventPtr event) { |
| 381 Change change; |
| 382 change.type = CHANGE_TYPE_EVENT_OBSERVED; |
| 383 change.event_action = static_cast<int32_t>(event->action); |
| 384 AddChange(change); |
| 385 } |
| 386 |
| 373 void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id, | 387 void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id, |
| 374 String name, | 388 String name, |
| 375 Array<uint8_t> data) { | 389 Array<uint8_t> data) { |
| 376 Change change; | 390 Change change; |
| 377 change.type = CHANGE_TYPE_PROPERTY_CHANGED; | 391 change.type = CHANGE_TYPE_PROPERTY_CHANGED; |
| 378 change.window_id = window_id; | 392 change.window_id = window_id; |
| 379 change.property_key = name; | 393 change.property_key = name; |
| 380 if (data.is_null()) | 394 if (data.is_null()) |
| 381 change.property_value = "NULL"; | 395 change.property_value = "NULL"; |
| 382 else | 396 else |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 454 |
| 441 std::string TestWindow::ToString2() const { | 455 std::string TestWindow::ToString2() const { |
| 442 return base::StringPrintf( | 456 return base::StringPrintf( |
| 443 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(), | 457 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(), |
| 444 WindowIdToString(parent_id).c_str(), visible ? "true" : "false"); | 458 WindowIdToString(parent_id).c_str(), visible ? "true" : "false"); |
| 445 } | 459 } |
| 446 | 460 |
| 447 } // namespace ws | 461 } // namespace ws |
| 448 | 462 |
| 449 } // namespace mus | 463 } // namespace mus |
| OLD | NEW |