| 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 "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" |
| 11 #include "mojo/common/common_type_converters.h" | 11 #include "mojo/common/common_type_converters.h" |
| 12 #include "mojo/public/cpp/bindings/map.h" | 12 #include "mojo/public/cpp/bindings/map.h" |
| 13 #include "services/ui/common/util.h" | 13 #include "services/ui/common/util.h" |
| 14 | 14 |
| 15 using mojo::Array; | 15 using mojo::Array; |
| 16 using mojo::String; | |
| 17 | 16 |
| 18 namespace ui { | 17 namespace ui { |
| 19 | 18 |
| 20 namespace ws { | 19 namespace ws { |
| 21 | 20 |
| 22 std::string WindowIdToString(Id id) { | 21 std::string WindowIdToString(Id id) { |
| 23 return (id == 0) ? "null" | 22 return (id == 0) ? "null" |
| 24 : base::StringPrintf("%d,%d", HiWord(id), LoWord(id)); | 23 : base::StringPrintf("%d,%d", HiWord(id), LoWord(id)); |
| 25 } | 24 } |
| 26 | 25 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event, | 368 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event, |
| 370 uint32_t window_id) { | 369 uint32_t window_id) { |
| 371 Change change; | 370 Change change; |
| 372 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT; | 371 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT; |
| 373 change.event_action = static_cast<int32_t>(event.type()); | 372 change.event_action = static_cast<int32_t>(event.type()); |
| 374 change.window_id = window_id; | 373 change.window_id = window_id; |
| 375 AddChange(change); | 374 AddChange(change); |
| 376 } | 375 } |
| 377 | 376 |
| 378 void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id, | 377 void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id, |
| 379 String name, | 378 std::string name, |
| 380 Array<uint8_t> data) { | 379 Array<uint8_t> data) { |
| 381 Change change; | 380 Change change; |
| 382 change.type = CHANGE_TYPE_PROPERTY_CHANGED; | 381 change.type = CHANGE_TYPE_PROPERTY_CHANGED; |
| 383 change.window_id = window_id; | 382 change.window_id = window_id; |
| 384 change.property_key = name; | 383 change.property_key = name; |
| 385 if (data.is_null()) | 384 if (data.is_null()) |
| 386 change.property_value = "NULL"; | 385 change.property_value = "NULL"; |
| 387 else | 386 else |
| 388 change.property_value = data.To<std::string>(); | 387 change.property_value = data.To<std::string>(); |
| 389 AddChange(change); | 388 AddChange(change); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 458 |
| 460 std::string TestWindow::ToString2() const { | 459 std::string TestWindow::ToString2() const { |
| 461 return base::StringPrintf( | 460 return base::StringPrintf( |
| 462 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(), | 461 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(), |
| 463 WindowIdToString(parent_id).c_str(), visible ? "true" : "false"); | 462 WindowIdToString(parent_id).c_str(), visible ? "true" : "false"); |
| 464 } | 463 } |
| 465 | 464 |
| 466 } // namespace ws | 465 } // namespace ws |
| 467 | 466 |
| 468 } // namespace ui | 467 } // namespace ui |
| OLD | NEW |