| 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/test_change_tracker.h" | 5 #include "components/mus/test_change_tracker.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "components/mus/public/cpp/util.h" | 9 #include "components/mus/public/cpp/util.h" |
| 10 #include "mojo/common/common_type_converters.h" | 10 #include "mojo/common/common_type_converters.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 case CHANGE_TYPE_EMBED: | 36 case CHANGE_TYPE_EMBED: |
| 37 return "OnEmbed"; | 37 return "OnEmbed"; |
| 38 | 38 |
| 39 case CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED: | 39 case CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED: |
| 40 return base::StringPrintf("OnEmbeddedAppDisconnected view=%s", | 40 return base::StringPrintf("OnEmbeddedAppDisconnected view=%s", |
| 41 ViewIdToString(change.view_id).c_str()); | 41 ViewIdToString(change.view_id).c_str()); |
| 42 | 42 |
| 43 case CHANGE_TYPE_UNEMBED: | 43 case CHANGE_TYPE_UNEMBED: |
| 44 return "OnUnembed"; | 44 return "OnUnembed"; |
| 45 | 45 |
| 46 case CHANGE_TYPE_LOST_CAPTURE: |
| 47 return base::StringPrintf("OnLostCapture view=%s", |
| 48 ViewIdToString(change.view_id).c_str()); |
| 49 |
| 46 case CHANGE_TYPE_NODE_BOUNDS_CHANGED: | 50 case CHANGE_TYPE_NODE_BOUNDS_CHANGED: |
| 47 return base::StringPrintf( | 51 return base::StringPrintf( |
| 48 "BoundsChanged view=%s old_bounds=%s new_bounds=%s", | 52 "BoundsChanged view=%s old_bounds=%s new_bounds=%s", |
| 49 ViewIdToString(change.view_id).c_str(), | 53 ViewIdToString(change.view_id).c_str(), |
| 50 RectToString(change.bounds).c_str(), | 54 RectToString(change.bounds).c_str(), |
| 51 RectToString(change.bounds2).c_str()); | 55 RectToString(change.bounds2).c_str()); |
| 52 | 56 |
| 53 case CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED: | 57 case CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED: |
| 54 // TODO(sky): Not implemented. | 58 // TODO(sky): Not implemented. |
| 55 return "ViewportMetricsChanged"; | 59 return "ViewportMetricsChanged"; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 change.bounds2.height = new_bounds->height; | 207 change.bounds2.height = new_bounds->height; |
| 204 AddChange(change); | 208 AddChange(change); |
| 205 } | 209 } |
| 206 | 210 |
| 207 void TestChangeTracker::OnUnembed() { | 211 void TestChangeTracker::OnUnembed() { |
| 208 Change change; | 212 Change change; |
| 209 change.type = CHANGE_TYPE_UNEMBED; | 213 change.type = CHANGE_TYPE_UNEMBED; |
| 210 AddChange(change); | 214 AddChange(change); |
| 211 } | 215 } |
| 212 | 216 |
| 217 void TestChangeTracker::OnLostCapture(Id view_id) { |
| 218 Change change; |
| 219 change.type = CHANGE_TYPE_LOST_CAPTURE; |
| 220 change.view_id = view_id; |
| 221 AddChange(change); |
| 222 } |
| 223 |
| 213 void TestChangeTracker::OnViewViewportMetricsChanged( | 224 void TestChangeTracker::OnViewViewportMetricsChanged( |
| 214 mojo::ViewportMetricsPtr old_metrics, | 225 mojo::ViewportMetricsPtr old_metrics, |
| 215 mojo::ViewportMetricsPtr new_metrics) { | 226 mojo::ViewportMetricsPtr new_metrics) { |
| 216 Change change; | 227 Change change; |
| 217 change.type = CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED; | 228 change.type = CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED; |
| 218 // NOT IMPLEMENTED | 229 // NOT IMPLEMENTED |
| 219 AddChange(change); | 230 AddChange(change); |
| 220 } | 231 } |
| 221 | 232 |
| 222 void TestChangeTracker::OnViewHierarchyChanged(Id view_id, | 233 void TestChangeTracker::OnViewHierarchyChanged(Id view_id, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 330 } |
| 320 | 331 |
| 321 std::string TestView::ToString2() const { | 332 std::string TestView::ToString2() const { |
| 322 return base::StringPrintf( | 333 return base::StringPrintf( |
| 323 "view=%s parent=%s visible=%s drawn=%s", ViewIdToString(view_id).c_str(), | 334 "view=%s parent=%s visible=%s drawn=%s", ViewIdToString(view_id).c_str(), |
| 324 ViewIdToString(parent_id).c_str(), visible ? "true" : "false", | 335 ViewIdToString(parent_id).c_str(), visible ? "true" : "false", |
| 325 drawn ? "true" : "false"); | 336 drawn ? "true" : "false"); |
| 326 } | 337 } |
| 327 | 338 |
| 328 } // namespace mus | 339 } // namespace mus |
| OLD | NEW |