| 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/ws/test_change_tracker.h" | 5 #include "components/mus/ws/test_change_tracker.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 std::string result; | 142 std::string result; |
| 143 for (auto& change : changes) { | 143 for (auto& change : changes) { |
| 144 if (!result.empty()) | 144 if (!result.empty()) |
| 145 result += "\n"; | 145 result += "\n"; |
| 146 result += ChangeToDescription1(change); | 146 result += ChangeToDescription1(change); |
| 147 } | 147 } |
| 148 return result; | 148 return result; |
| 149 } | 149 } |
| 150 | 150 |
| 151 std::string SingleWindowDescription(const std::vector<TestWindow>& windows) { | 151 std::string SingleWindowDescription(const std::vector<TestWindow>& windows) { |
| 152 if (windows.size() != 1u) | 152 if (windows.empty()) |
| 153 return "more than one changes and expected only one"; | 153 return "no windows"; |
| 154 return windows[0].ToString(); | 154 std::string result; |
| 155 for (const TestWindow& window : windows) |
| 156 result += window.ToString(); |
| 157 return result; |
| 155 } | 158 } |
| 156 | 159 |
| 157 std::string ChangeWindowDescription(const std::vector<Change>& changes) { | 160 std::string ChangeWindowDescription(const std::vector<Change>& changes) { |
| 158 if (changes.size() != 1) | 161 if (changes.size() != 1) |
| 159 return std::string(); | 162 return std::string(); |
| 160 std::vector<std::string> window_strings(changes[0].windows.size()); | 163 std::vector<std::string> window_strings(changes[0].windows.size()); |
| 161 for (size_t i = 0; i < changes[0].windows.size(); ++i) | 164 for (size_t i = 0; i < changes[0].windows.size(); ++i) |
| 162 window_strings[i] = "[" + changes[0].windows[i].ToString() + "]"; | 165 window_strings[i] = "[" + changes[0].windows[i].ToString() + "]"; |
| 163 return base::JoinString(window_strings, ","); | 166 return base::JoinString(window_strings, ","); |
| 164 } | 167 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 std::string TestWindow::ToString2() const { | 391 std::string TestWindow::ToString2() const { |
| 389 return base::StringPrintf( | 392 return base::StringPrintf( |
| 390 "window=%s parent=%s visible=%s drawn=%s", | 393 "window=%s parent=%s visible=%s drawn=%s", |
| 391 WindowIdToString(window_id).c_str(), WindowIdToString(parent_id).c_str(), | 394 WindowIdToString(window_id).c_str(), WindowIdToString(parent_id).c_str(), |
| 392 visible ? "true" : "false", drawn ? "true" : "false"); | 395 visible ? "true" : "false", drawn ? "true" : "false"); |
| 393 } | 396 } |
| 394 | 397 |
| 395 } // namespace ws | 398 } // namespace ws |
| 396 | 399 |
| 397 } // namespace mus | 400 } // namespace mus |
| OLD | NEW |