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

Side by Side Diff: components/mus/ws/test_change_tracker.cc

Issue 1352043005: mus: Implement Window Server Capture Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added capture unit tests Created 5 years, 1 month 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 "components/mus/ws/test_change_tracker.h" 5 #include "components/mus/ws/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/common/util.h" 9 #include "components/mus/common/util.h"
10 #include "mojo/common/common_type_converters.h" 10 #include "mojo/common/common_type_converters.h"
(...skipping 26 matching lines...) Expand all
37 case CHANGE_TYPE_EMBED: 37 case CHANGE_TYPE_EMBED:
38 return "OnEmbed"; 38 return "OnEmbed";
39 39
40 case CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED: 40 case CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED:
41 return base::StringPrintf("OnEmbeddedAppDisconnected window=%s", 41 return base::StringPrintf("OnEmbeddedAppDisconnected window=%s",
42 WindowIdToString(change.window_id).c_str()); 42 WindowIdToString(change.window_id).c_str());
43 43
44 case CHANGE_TYPE_UNEMBED: 44 case CHANGE_TYPE_UNEMBED:
45 return "OnUnembed"; 45 return "OnUnembed";
46 46
47 case CHANGE_TYPE_LOST_CAPTURE:
48 return base::StringPrintf("OnLostCapture window=%s",
49 WindowIdToString(change.window_id).c_str());
50
47 case CHANGE_TYPE_NODE_ADD_TRANSIENT_WINDOW: 51 case CHANGE_TYPE_NODE_ADD_TRANSIENT_WINDOW:
48 return base::StringPrintf("AddTransientWindow parent = %s child = %s", 52 return base::StringPrintf("AddTransientWindow parent = %s child = %s",
49 WindowIdToString(change.window_id).c_str(), 53 WindowIdToString(change.window_id).c_str(),
50 WindowIdToString(change.window_id2).c_str()); 54 WindowIdToString(change.window_id2).c_str());
51 55
52 case CHANGE_TYPE_NODE_BOUNDS_CHANGED: 56 case CHANGE_TYPE_NODE_BOUNDS_CHANGED:
53 return base::StringPrintf( 57 return base::StringPrintf(
54 "BoundsChanged window=%s old_bounds=%s new_bounds=%s", 58 "BoundsChanged window=%s old_bounds=%s new_bounds=%s",
55 WindowIdToString(change.window_id).c_str(), 59 WindowIdToString(change.window_id).c_str(),
56 RectToString(change.bounds).c_str(), 60 RectToString(change.bounds).c_str(),
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 237
234 void TestChangeTracker::OnTransientWindowRemoved(Id window_id, 238 void TestChangeTracker::OnTransientWindowRemoved(Id window_id,
235 Id transient_window_id) { 239 Id transient_window_id) {
236 Change change; 240 Change change;
237 change.type = CHANGE_TYPE_NODE_REMOVE_TRANSIENT_WINDOW_FROM_PARENT; 241 change.type = CHANGE_TYPE_NODE_REMOVE_TRANSIENT_WINDOW_FROM_PARENT;
238 change.window_id = window_id; 242 change.window_id = window_id;
239 change.window_id2 = transient_window_id; 243 change.window_id2 = transient_window_id;
240 AddChange(change); 244 AddChange(change);
241 } 245 }
242 246
247 void TestChangeTracker::OnLostCapture(Id window_id) {
248 Change change;
249 change.type = CHANGE_TYPE_LOST_CAPTURE;
250 change.window_id = window_id;
251 AddChange(change);
252 }
253
243 void TestChangeTracker::OnWindowViewportMetricsChanged( 254 void TestChangeTracker::OnWindowViewportMetricsChanged(
244 mojom::ViewportMetricsPtr old_metrics, 255 mojom::ViewportMetricsPtr old_metrics,
245 mojom::ViewportMetricsPtr new_metrics) { 256 mojom::ViewportMetricsPtr new_metrics) {
246 Change change; 257 Change change;
247 change.type = CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED; 258 change.type = CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED;
248 // NOT IMPLEMENTED 259 // NOT IMPLEMENTED
249 AddChange(change); 260 AddChange(change);
250 } 261 }
251 262
252 void TestChangeTracker::OnWindowHierarchyChanged( 263 void TestChangeTracker::OnWindowHierarchyChanged(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 std::string TestWindow::ToString2() const { 364 std::string TestWindow::ToString2() const {
354 return base::StringPrintf( 365 return base::StringPrintf(
355 "window=%s parent=%s visible=%s drawn=%s", 366 "window=%s parent=%s visible=%s drawn=%s",
356 WindowIdToString(window_id).c_str(), WindowIdToString(parent_id).c_str(), 367 WindowIdToString(window_id).c_str(), WindowIdToString(parent_id).c_str(),
357 visible ? "true" : "false", drawn ? "true" : "false"); 368 visible ? "true" : "false", drawn ? "true" : "false");
358 } 369 }
359 370
360 } // namespace ws 371 } // namespace ws
361 372
362 } // namespace mus 373 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698