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

Side by Side Diff: mojo/services/view_manager/test_change_tracker.h

Issue 557573002: Changes view manager to report visibility and drawn state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 2 trunk Created 6 years, 3 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 #ifndef MOJO_SERVICES_VIEW_MANAGER_TEST_CHANGE_TRACKER_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_TEST_CHANGE_TRACKER_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_TEST_CHANGE_TRACKER_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_TEST_CHANGE_TRACKER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "mojo/public/cpp/bindings/array.h" 11 #include "mojo/public/cpp/bindings/array.h"
12 #include "mojo/services/public/cpp/view_manager/types.h" 12 #include "mojo/services/public/cpp/view_manager/types.h"
13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" 13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 namespace service { 17 namespace service {
18 18
19 enum ChangeType { 19 enum ChangeType {
20 CHANGE_TYPE_EMBED, 20 CHANGE_TYPE_EMBED,
21 // TODO(sky): NODE->VIEW.
21 CHANGE_TYPE_NODE_BOUNDS_CHANGED, 22 CHANGE_TYPE_NODE_BOUNDS_CHANGED,
22 CHANGE_TYPE_NODE_HIERARCHY_CHANGED, 23 CHANGE_TYPE_NODE_HIERARCHY_CHANGED,
23 CHANGE_TYPE_NODE_REORDERED, 24 CHANGE_TYPE_NODE_REORDERED,
25 CHANGE_TYPE_NODE_VISIBILITY_CHANGED,
26 CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED,
24 CHANGE_TYPE_NODE_DELETED, 27 CHANGE_TYPE_NODE_DELETED,
25 CHANGE_TYPE_INPUT_EVENT, 28 CHANGE_TYPE_INPUT_EVENT,
26 CHANGE_TYPE_DELEGATE_EMBED, 29 CHANGE_TYPE_DELEGATE_EMBED,
27 }; 30 };
28 31
29 // TODO(sky): consider nuking and converting directly to ViewData. 32 // TODO(sky): consider nuking and converting directly to ViewData.
30 struct TestView { 33 struct TestView {
31 // Returns a string description of this. 34 // Returns a string description of this.
32 std::string ToString() const; 35 std::string ToString() const;
33 36
37 // Returns a string description that includes visible and drawn.
38 std::string ToString2() const;
39
34 Id parent_id; 40 Id parent_id;
35 Id view_id; 41 Id view_id;
42 bool visible;
43 bool drawn;
36 }; 44 };
37 45
38 // Tracks a call to ViewManagerClient. See the individual functions for the 46 // Tracks a call to ViewManagerClient. See the individual functions for the
39 // fields that are used. 47 // fields that are used.
40 struct Change { 48 struct Change {
41 Change(); 49 Change();
42 ~Change(); 50 ~Change();
43 51
44 ChangeType type; 52 ChangeType type;
45 ConnectionSpecificId connection_id; 53 ConnectionSpecificId connection_id;
46 std::vector<TestView> views; 54 std::vector<TestView> views;
47 Id view_id; 55 Id view_id;
48 Id view_id2; 56 Id view_id2;
49 Id view_id3; 57 Id view_id3;
50 gfx::Rect bounds; 58 gfx::Rect bounds;
51 gfx::Rect bounds2; 59 gfx::Rect bounds2;
52 int32 event_action; 60 int32 event_action;
53 String creator_url; 61 String creator_url;
54 String embed_url; 62 String embed_url;
55 OrderDirection direction; 63 OrderDirection direction;
64 bool bool_value;
56 }; 65 };
57 66
58 // Converts Changes to string descriptions. 67 // Converts Changes to string descriptions.
59 std::vector<std::string> ChangesToDescription1( 68 std::vector<std::string> ChangesToDescription1(
60 const std::vector<Change>& changes); 69 const std::vector<Change>& changes);
61 70
62 // Returns a string description of |changes[0].views|. Returns an empty string 71 // Returns a string description of |changes[0].views|. Returns an empty string
63 // if change.size() != 1. 72 // if change.size() != 1.
64 std::string ChangeViewDescription(const std::vector<Change>& changes); 73 std::string ChangeViewDescription(const std::vector<Change>& changes);
65 74
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 ViewDataPtr root); 106 ViewDataPtr root);
98 void OnViewBoundsChanged(Id view_id, RectPtr old_bounds, RectPtr new_bounds); 107 void OnViewBoundsChanged(Id view_id, RectPtr old_bounds, RectPtr new_bounds);
99 void OnViewHierarchyChanged(Id view_id, 108 void OnViewHierarchyChanged(Id view_id,
100 Id new_parent_id, 109 Id new_parent_id,
101 Id old_parent_id, 110 Id old_parent_id,
102 Array<ViewDataPtr> views); 111 Array<ViewDataPtr> views);
103 void OnViewReordered(Id view_id, 112 void OnViewReordered(Id view_id,
104 Id relative_view_id, 113 Id relative_view_id,
105 OrderDirection direction); 114 OrderDirection direction);
106 void OnViewDeleted(Id view_id); 115 void OnViewDeleted(Id view_id);
116 void OnViewVisibilityChanged(Id view_id, bool visible);
117 void OnViewDrawnStateChanged(Id view_id, bool drawn);
107 void OnViewInputEvent(Id view_id, EventPtr event); 118 void OnViewInputEvent(Id view_id, EventPtr event);
108 void DelegateEmbed(const String& url); 119 void DelegateEmbed(const String& url);
109 120
110 private: 121 private:
111 void AddChange(const Change& change); 122 void AddChange(const Change& change);
112 123
113 Delegate* delegate_; 124 Delegate* delegate_;
114 std::vector<Change> changes_; 125 std::vector<Change> changes_;
115 126
116 DISALLOW_COPY_AND_ASSIGN(TestChangeTracker); 127 DISALLOW_COPY_AND_ASSIGN(TestChangeTracker);
117 }; 128 };
118 129
119 } // namespace service 130 } // namespace service
120 } // namespace mojo 131 } // namespace mojo
121 132
122 #endif // MOJO_SERVICES_VIEW_MANAGER_TEST_CHANGE_TRACKER_H_ 133 #endif // MOJO_SERVICES_VIEW_MANAGER_TEST_CHANGE_TRACKER_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/server_view_delegate.h ('k') | mojo/services/view_manager/test_change_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698