OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sync/test/fake_server/sessions_hierarchy.h" | 5 #include "components/sync/test/fake_server/sessions_hierarchy.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 namespace fake_server { | 9 namespace fake_server { |
10 | 10 |
11 SessionsHierarchy::SessionsHierarchy() {} | 11 SessionsHierarchy::SessionsHierarchy() {} |
12 | 12 |
| 13 SessionsHierarchy::SessionsHierarchy(const SessionsHierarchy& other) = default; |
| 14 |
| 15 SessionsHierarchy::SessionsHierarchy( |
| 16 std::initializer_list<std::multiset<std::string>> windows) |
| 17 : windows_(windows) {} |
| 18 |
13 SessionsHierarchy::~SessionsHierarchy() {} | 19 SessionsHierarchy::~SessionsHierarchy() {} |
14 | 20 |
15 void SessionsHierarchy::AddWindow(const std::string& tab) { | 21 void SessionsHierarchy::AddWindow(const std::string& tab) { |
16 SessionsHierarchy::Window window; | 22 windows_.insert({tab}); |
17 window.insert(tab); | |
18 windows_.insert(window); | |
19 } | 23 } |
20 | 24 |
21 void SessionsHierarchy::AddWindow(const std::multiset<std::string>& tabs) { | 25 void SessionsHierarchy::AddWindow(const std::multiset<std::string>& tabs) { |
22 windows_.insert(tabs); | 26 windows_.insert(tabs); |
23 } | 27 } |
24 | 28 |
25 std::string SessionsHierarchy::ToString() const { | 29 std::string SessionsHierarchy::ToString() const { |
26 std::stringstream output; | 30 std::stringstream output; |
27 output << "{"; | 31 output << "{"; |
28 for (WindowContainer::const_iterator window_it = windows_.begin(); | 32 for (WindowContainer::const_iterator window_it = windows_.begin(); |
(...skipping 13 matching lines...) Expand all Loading... |
42 } | 46 } |
43 output << "}"; | 47 output << "}"; |
44 return output.str(); | 48 return output.str(); |
45 } | 49 } |
46 | 50 |
47 bool SessionsHierarchy::Equals(const SessionsHierarchy& other) const { | 51 bool SessionsHierarchy::Equals(const SessionsHierarchy& other) const { |
48 return windows_ == other.windows_; | 52 return windows_ == other.windows_; |
49 } | 53 } |
50 | 54 |
51 } // namespace fake_server | 55 } // namespace fake_server |
OLD | NEW |