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

Side by Side Diff: services/view_manager/test_change_tracker.cc

Issue 880743002: Plumb ViewportMetrics change notifications around the world and back. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix typo Created 5 years, 10 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
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/view_manager/test_change_tracker.h" 5 #include "services/view_manager/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 "mojo/common/common_type_converters.h" 9 #include "mojo/common/common_type_converters.h"
10 #include "mojo/services/view_manager/public/cpp/util.h" 10 #include "mojo/services/view_manager/public/cpp/util.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return base::StringPrintf("OnEmbeddedAppDisconnected view=%s", 42 return base::StringPrintf("OnEmbeddedAppDisconnected view=%s",
43 ViewIdToString(change.view_id).c_str()); 43 ViewIdToString(change.view_id).c_str());
44 44
45 case CHANGE_TYPE_NODE_BOUNDS_CHANGED: 45 case CHANGE_TYPE_NODE_BOUNDS_CHANGED:
46 return base::StringPrintf( 46 return base::StringPrintf(
47 "BoundsChanged view=%s old_bounds=%s new_bounds=%s", 47 "BoundsChanged view=%s old_bounds=%s new_bounds=%s",
48 ViewIdToString(change.view_id).c_str(), 48 ViewIdToString(change.view_id).c_str(),
49 RectToString(change.bounds).c_str(), 49 RectToString(change.bounds).c_str(),
50 RectToString(change.bounds2).c_str()); 50 RectToString(change.bounds2).c_str());
51 51
52 case CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED:
53 // TODO(sky): Not implemented.
54 return "ViewportMetricsChanged";
55
52 case CHANGE_TYPE_NODE_HIERARCHY_CHANGED: 56 case CHANGE_TYPE_NODE_HIERARCHY_CHANGED:
53 return base::StringPrintf( 57 return base::StringPrintf(
54 "HierarchyChanged view=%s new_parent=%s old_parent=%s", 58 "HierarchyChanged view=%s new_parent=%s old_parent=%s",
55 ViewIdToString(change.view_id).c_str(), 59 ViewIdToString(change.view_id).c_str(),
56 ViewIdToString(change.view_id2).c_str(), 60 ViewIdToString(change.view_id2).c_str(),
57 ViewIdToString(change.view_id3).c_str()); 61 ViewIdToString(change.view_id3).c_str());
58 62
59 case CHANGE_TYPE_NODE_REORDERED: 63 case CHANGE_TYPE_NODE_REORDERED:
60 return base::StringPrintf("Reordered view=%s relative=%s direction=%s", 64 return base::StringPrintf("Reordered view=%s relative=%s direction=%s",
61 ViewIdToString(change.view_id).c_str(), 65 ViewIdToString(change.view_id).c_str(),
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 change.bounds.y = old_bounds->y; 195 change.bounds.y = old_bounds->y;
192 change.bounds.width = old_bounds->width; 196 change.bounds.width = old_bounds->width;
193 change.bounds.height = old_bounds->height; 197 change.bounds.height = old_bounds->height;
194 change.bounds2.x = new_bounds->x; 198 change.bounds2.x = new_bounds->x;
195 change.bounds2.y = new_bounds->y; 199 change.bounds2.y = new_bounds->y;
196 change.bounds2.width = new_bounds->width; 200 change.bounds2.width = new_bounds->width;
197 change.bounds2.height = new_bounds->height; 201 change.bounds2.height = new_bounds->height;
198 AddChange(change); 202 AddChange(change);
199 } 203 }
200 204
205 void TestChangeTracker::OnViewViewportMetricsChanged(
206 mojo::ViewportMetricsPtr old_metrics,
207 mojo::ViewportMetricsPtr new_metrics) {
208 Change change;
209 change.type = CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED;
210 // NOT IMPLEMENTED
211 AddChange(change);
212 }
213
201 void TestChangeTracker::OnViewHierarchyChanged(Id view_id, 214 void TestChangeTracker::OnViewHierarchyChanged(Id view_id,
202 Id new_parent_id, 215 Id new_parent_id,
203 Id old_parent_id, 216 Id old_parent_id,
204 Array<ViewDataPtr> views) { 217 Array<ViewDataPtr> views) {
205 Change change; 218 Change change;
206 change.type = CHANGE_TYPE_NODE_HIERARCHY_CHANGED; 219 change.type = CHANGE_TYPE_NODE_HIERARCHY_CHANGED;
207 change.view_id = view_id; 220 change.view_id = view_id;
208 change.view_id2 = new_parent_id; 221 change.view_id2 = new_parent_id;
209 change.view_id3 = old_parent_id; 222 change.view_id3 = old_parent_id;
210 ViewDatasToTestViews(views, &change.views); 223 ViewDatasToTestViews(views, &change.views);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 305
293 std::string TestView::ToString2() const { 306 std::string TestView::ToString2() const {
294 return base::StringPrintf("view=%s parent=%s visible=%s drawn=%s", 307 return base::StringPrintf("view=%s parent=%s visible=%s drawn=%s",
295 ViewIdToString(view_id).c_str(), 308 ViewIdToString(view_id).c_str(),
296 ViewIdToString(parent_id).c_str(), 309 ViewIdToString(parent_id).c_str(),
297 visible ? "true" : "false", 310 visible ? "true" : "false",
298 drawn ? "true" : "false"); 311 drawn ? "true" : "false");
299 } 312 }
300 313
301 } // namespace view_manager 314 } // namespace view_manager
OLDNEW
« no previous file with comments | « services/view_manager/test_change_tracker.h ('k') | services/view_manager/view_manager_service_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698