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

Side by Side Diff: chrome/browser/sync/test/integration/sessions_helper.h

Issue 2343463003: [Sync] Fix namespaces for the sync_sessions component. (Closed)
Patch Set: Fix gn. Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "chrome/browser/sync/test/integration/sync_test.h" 13 #include "chrome/browser/sync/test/integration/sync_test.h"
13 #include "components/sessions/core/session_types.h" 14 #include "components/sessions/core/session_types.h"
14 #include "components/sync/syncable/nigori_util.h" 15 #include "components/sync/syncable/nigori_util.h"
15 #include "components/sync_sessions/synced_session.h" 16 #include "components/sync_sessions/synced_session.h"
16 17
17 class GURL; 18 class GURL;
18 19
19 namespace sessions_helper { 20 namespace sessions_helper {
20 21
21 typedef std::vector<const sync_driver::SyncedSession*> SyncedSessionVector; 22 typedef std::vector<const sync_sessions::SyncedSession*> SyncedSessionVector;
22 typedef sync_driver::SyncedSession::SyncedWindowMap SessionWindowMap; 23 typedef sync_sessions::SyncedSession::SyncedWindowMap SessionWindowMap;
23 24
24 // Wrapper around a SyncedWindowMap that will automatically delete the 25 // Wrapper around a SyncedWindowMap that will automatically delete the
25 // SessionWindow pointers it holds. 26 // SessionWindow pointers it holds.
26 class ScopedWindowMap { 27 class ScopedWindowMap {
27 public: 28 public:
28 ScopedWindowMap(); 29 ScopedWindowMap();
29 explicit ScopedWindowMap(SessionWindowMap* windows); 30 explicit ScopedWindowMap(SessionWindowMap* windows);
30 ~ScopedWindowMap(); 31 ~ScopedWindowMap();
31 32
32 const SessionWindowMap* Get() const; 33 const SessionWindowMap* Get() const;
(...skipping 23 matching lines...) Expand all
56 // Returns number of foreign sessions for a profile. 57 // Returns number of foreign sessions for a profile.
57 int GetNumForeignSessions(int index); 58 int GetNumForeignSessions(int index);
58 59
59 // Fills the sessions vector with the model associator's foreign session data. 60 // Fills the sessions vector with the model associator's foreign session data.
60 // Caller owns |sessions|, but not SyncedSessions objects within. 61 // Caller owns |sessions|, but not SyncedSessions objects within.
61 // Returns true if foreign sessions were found, false otherwise. 62 // Returns true if foreign sessions were found, false otherwise.
62 bool GetSessionData(int index, SyncedSessionVector* sessions); 63 bool GetSessionData(int index, SyncedSessionVector* sessions);
63 64
64 // Compares a foreign session based on the first session window. 65 // Compares a foreign session based on the first session window.
65 // Returns true based on the comparison of the session windows. 66 // Returns true based on the comparison of the session windows.
66 bool CompareSyncedSessions(const sync_driver::SyncedSession* lhs, 67 bool CompareSyncedSessions(const sync_sessions::SyncedSession* lhs,
67 const sync_driver::SyncedSession* rhs); 68 const sync_sessions::SyncedSession* rhs);
68 69
69 // Sort a SyncedSession vector using our custom SyncedSession comparator. 70 // Sort a SyncedSession vector using our custom SyncedSession comparator.
70 void SortSyncedSessions(SyncedSessionVector* sessions); 71 void SortSyncedSessions(SyncedSessionVector* sessions);
71 72
72 // Compares two tab navigations base on the parameters we sync. 73 // Compares two tab navigations base on the parameters we sync.
73 // (Namely, we don't sync state or type mask) 74 // (Namely, we don't sync state or type mask)
74 bool NavigationEquals(const sessions::SerializedNavigationEntry& expected, 75 bool NavigationEquals(const sessions::SerializedNavigationEntry& expected,
75 const sessions::SerializedNavigationEntry& actual); 76 const sessions::SerializedNavigationEntry& actual);
76 77
77 // Verifies that two SessionWindows match. 78 // Verifies that two SessionWindows match.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Wait for a session change to propagate to the model associator. Will not 111 // Wait for a session change to propagate to the model associator. Will not
111 // return until each url in |urls| has been found. 112 // return until each url in |urls| has been found.
112 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls); 113 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls);
113 114
114 // Check if the session model associator's knows that the current open tab 115 // Check if the session model associator's knows that the current open tab
115 // has this url. 116 // has this url.
116 bool ModelAssociatorHasTabWithUrl(int index, const GURL& url); 117 bool ModelAssociatorHasTabWithUrl(int index, const GURL& url);
117 118
118 // Stores a pointer to the local session for a given profile in |session|. 119 // Stores a pointer to the local session for a given profile in |session|.
119 // Returns true on success, false on failure. 120 // Returns true on success, false on failure.
120 bool GetLocalSession(int index, const sync_driver::SyncedSession** session); 121 bool GetLocalSession(int index, const sync_sessions::SyncedSession** session);
121 122
122 // Deletes the foreign session with tag |session_tag| from the profile specified 123 // Deletes the foreign session with tag |session_tag| from the profile specified
123 // by |index|. This will affect all synced clients. 124 // by |index|. This will affect all synced clients.
124 // Note: We pass the session_tag in by value to ensure it's not a reference 125 // Note: We pass the session_tag in by value to ensure it's not a reference
125 // to the session tag within the SyncedSession we plan to delete. 126 // to the session tag within the SyncedSession we plan to delete.
126 void DeleteForeignSession(int index, std::string session_tag); 127 void DeleteForeignSession(int index, std::string session_tag);
127 128
128 } // namespace sessions_helper 129 } // namespace sessions_helper
129 130
130 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ 131 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698