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 | |
19 SessionsHierarchy::~SessionsHierarchy() {} | 13 SessionsHierarchy::~SessionsHierarchy() {} |
20 | 14 |
21 void SessionsHierarchy::AddWindow(const std::string& tab) { | 15 void SessionsHierarchy::AddWindow(const std::string& tab) { |
22 windows_.insert({tab}); | 16 SessionsHierarchy::Window window; |
| 17 window.insert(tab); |
| 18 windows_.insert(window); |
23 } | 19 } |
24 | 20 |
25 void SessionsHierarchy::AddWindow(const std::multiset<std::string>& tabs) { | 21 void SessionsHierarchy::AddWindow(const std::multiset<std::string>& tabs) { |
26 windows_.insert(tabs); | 22 windows_.insert(tabs); |
27 } | 23 } |
28 | 24 |
29 std::string SessionsHierarchy::ToString() const { | 25 std::string SessionsHierarchy::ToString() const { |
30 std::stringstream output; | 26 std::stringstream output; |
31 output << "{"; | 27 output << "{"; |
32 for (WindowContainer::const_iterator window_it = windows_.begin(); | 28 for (WindowContainer::const_iterator window_it = windows_.begin(); |
(...skipping 13 matching lines...) Expand all Loading... |
46 } | 42 } |
47 output << "}"; | 43 output << "}"; |
48 return output.str(); | 44 return output.str(); |
49 } | 45 } |
50 | 46 |
51 bool SessionsHierarchy::Equals(const SessionsHierarchy& other) const { | 47 bool SessionsHierarchy::Equals(const SessionsHierarchy& other) const { |
52 return windows_ == other.windows_; | 48 return windows_ == other.windows_; |
53 } | 49 } |
54 | 50 |
55 } // namespace fake_server | 51 } // namespace fake_server |
OLD | NEW |