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

Side by Side Diff: sync/test/fake_server/sessions_hierarchy.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
« no previous file with comments | « sync/test/fake_server/permanent_entity.cc ('k') | sync/test/fake_server/sessions_hierarchy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SYNC_TEST_FAKE_SERVER_SESSIONS_HIERARCHY_H_
6 #define SYNC_TEST_FAKE_SERVER_SESSIONS_HIERARCHY_H_
7
8 #include <set>
9 #include <string>
10
11 #include "base/macros.h"
12
13 namespace fake_server {
14
15 class SessionsHierarchy;
16
17 // A representation of the Sync Sessions hierarchy (windows and the URLs of
18 // their tabs).
19 class SessionsHierarchy {
20 public:
21 // Creates an empty (no windows) SessionsHierachy.
22 SessionsHierarchy();
23
24 ~SessionsHierarchy();
25
26 // Add a window to the builder with one tab.
27 void AddWindow(const std::string& tab);
28
29 // Add a window to the builder with multiple tabs.
30 void AddWindow(const std::multiset<std::string>& tabs);
31
32 // Creates and returns a human-readable string version of this object's data.
33 std::string ToString() const;
34
35 // Returns true when this object and |other| have equivalent data.
36 //
37 // Two SessionHierarchy objects A and B have equivalent data iff:
38 // 1) A and B contain the same number of Windows, and
39 // 2) Each Window of A is equal (as a multiset) to exactly one Window of B
40 // (and vice versa).
41 //
42 // Examples of equivalent hierarchies:
43 // {} and {}, {{X}} and {{X}}, {{X,Y}} and {{Y,X}}, {{X},{Y}} and {{Y},{X}}
44 // Examples of nonequivalent hierarchies:
45 // {{X}} and {{Y}}, {{X}} and {{X,X}}, {{X}} and {{X},{X}}
46 bool Equals(const SessionsHierarchy& other) const;
47
48 private:
49 // A collection of tab URLs.
50 typedef std::multiset<std::string> Window;
51
52 // A collection of Windows (an instance of this collection represents a
53 // sessions hierarchy).
54 typedef std::multiset<Window> WindowContainer;
55
56 // The windows of the sessions hierarchy.
57 WindowContainer windows_;
58 };
59
60 } // namespace fake_server
61
62 #endif // SYNC_TEST_FAKE_SERVER_SESSIONS_HIERARCHY_H_
OLDNEW
« no previous file with comments | « sync/test/fake_server/permanent_entity.cc ('k') | sync/test/fake_server/sessions_hierarchy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698