| 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/view_manager/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/view_manager/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" |
| 11 | 11 |
| 12 using mojo::Array; | 12 using mojo::Array; |
| 13 using mojo::Id; | 13 using mojo::Id; |
| 14 using mojo::ViewDataPtr; | 14 using mojo::ViewDataPtr; |
| 15 using mojo::String; | 15 using mojo::String; |
| 16 | 16 |
| 17 namespace view_manager { | 17 namespace view_manager { |
| 18 | 18 |
| 19 std::string ViewIdToString(Id id) { | 19 std::string ViewIdToString(Id id) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 Change::Change() | 159 Change::Change() |
| 160 : type(CHANGE_TYPE_EMBED), | 160 : type(CHANGE_TYPE_EMBED), |
| 161 connection_id(0), | 161 connection_id(0), |
| 162 view_id(0), | 162 view_id(0), |
| 163 view_id2(0), | 163 view_id2(0), |
| 164 view_id3(0), | 164 view_id3(0), |
| 165 event_action(0), | 165 event_action(0), |
| 166 direction(mojo::ORDER_DIRECTION_ABOVE), | 166 direction(mojo::ORDER_DIRECTION_ABOVE), |
| 167 bool_value(false) { | 167 bool_value(false) {} |
| 168 } | |
| 169 | 168 |
| 170 Change::~Change() { | 169 Change::~Change() {} |
| 171 } | |
| 172 | 170 |
| 173 TestChangeTracker::TestChangeTracker() | 171 TestChangeTracker::TestChangeTracker() : delegate_(NULL) {} |
| 174 : delegate_(NULL) { | |
| 175 } | |
| 176 | 172 |
| 177 TestChangeTracker::~TestChangeTracker() { | 173 TestChangeTracker::~TestChangeTracker() {} |
| 178 } | |
| 179 | 174 |
| 180 void TestChangeTracker::OnEmbed(mojo::ConnectionSpecificId connection_id, | 175 void TestChangeTracker::OnEmbed(mojo::ConnectionSpecificId connection_id, |
| 181 ViewDataPtr root) { | 176 ViewDataPtr root) { |
| 182 Change change; | 177 Change change; |
| 183 change.type = CHANGE_TYPE_EMBED; | 178 change.type = CHANGE_TYPE_EMBED; |
| 184 change.connection_id = connection_id; | 179 change.connection_id = connection_id; |
| 185 change.views.push_back(ViewDataToTestView(root)); | 180 change.views.push_back(ViewDataToTestView(root)); |
| 186 AddChange(change); | 181 AddChange(change); |
| 187 } | 182 } |
| 188 | 183 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 313 |
| 319 TestView::~TestView() {} | 314 TestView::~TestView() {} |
| 320 | 315 |
| 321 std::string TestView::ToString() const { | 316 std::string TestView::ToString() const { |
| 322 return base::StringPrintf("view=%s parent=%s", | 317 return base::StringPrintf("view=%s parent=%s", |
| 323 ViewIdToString(view_id).c_str(), | 318 ViewIdToString(view_id).c_str(), |
| 324 ViewIdToString(parent_id).c_str()); | 319 ViewIdToString(parent_id).c_str()); |
| 325 } | 320 } |
| 326 | 321 |
| 327 std::string TestView::ToString2() const { | 322 std::string TestView::ToString2() const { |
| 328 return base::StringPrintf("view=%s parent=%s visible=%s drawn=%s", | 323 return base::StringPrintf( |
| 329 ViewIdToString(view_id).c_str(), | 324 "view=%s parent=%s visible=%s drawn=%s", ViewIdToString(view_id).c_str(), |
| 330 ViewIdToString(parent_id).c_str(), | 325 ViewIdToString(parent_id).c_str(), visible ? "true" : "false", |
| 331 visible ? "true" : "false", | 326 drawn ? "true" : "false"); |
| 332 drawn ? "true" : "false"); | |
| 333 } | 327 } |
| 334 | 328 |
| 335 } // namespace view_manager | 329 } // namespace view_manager |
| OLD | NEW |