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

Side by Side Diff: chrome/test/live_sync/sessions_helper.h

Issue 7828055: Move sync test code out of chrome/test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/live_sync/preferences_helper.cc ('k') | chrome/test/live_sync/sessions_helper.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 (c) 2011 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 CHROME_TEST_LIVE_SYNC_SESSIONS_HELPER_H_
6 #define CHROME_TEST_LIVE_SYNC_SESSIONS_HELPER_H_
7 #pragma once
8
9 #include <algorithm>
10 #include <vector>
11
12 #include "base/compiler_specific.h"
13 #include "chrome/browser/sessions/session_types.h"
14 #include "chrome/browser/sync/engine/nigori_util.h"
15 #include "chrome/test/live_sync/live_sync_test.h"
16
17 class GURL;
18
19 typedef std::vector<const SyncedSession*> SyncedSessionVector;
20 typedef std::vector<SessionWindow*> SessionWindowVector;
21
22 namespace sessions_helper {
23
24 // Copies the local session windows of profile |index| to |local_windows|.
25 // Returns true if successful.
26 bool GetLocalWindows(int index, SessionWindowVector& local_windows);
27
28 // Creates and verifies the creation of a new window for profile |index| with
29 // one tab displaying |url|. Copies the SessionWindow associated with the new
30 // window to |local_windows|. Returns true if successful.
31 bool OpenTabAndGetLocalWindows(int index,
32 const GURL& url,
33 SessionWindowVector& local_windows);
34
35 // Checks that window count and foreign session count are 0.
36 bool CheckInitialState(int index);
37
38 // Returns number of open windows for a profile.
39 int GetNumWindows(int index);
40
41 // Returns number of foreign sessions for a profile.
42 int GetNumForeignSessions(int index);
43
44 // Fills the sessions vector with the model associator's foreign session data.
45 // Caller owns |sessions|, but not SyncedSessions objects within.
46 bool GetSessionData(int index, SyncedSessionVector* sessions);
47
48 // Compare session windows based on their first tab's url.
49 // Returns true if the virtual url of the lhs is < the rhs.
50 bool CompareSessionWindows(SessionWindow* lhs, SessionWindow* rhs);
51
52 // Sort session windows using our custom comparator (first tab url
53 // comparison).
54 void SortSessionWindows(SessionWindowVector& windows);
55
56 // Compares a foreign session based on the first session window.
57 // Returns true based on the comparison of the session windows.
58 bool CompareSyncedSessions(const SyncedSession* lhs, const SyncedSession* rhs);
59
60 // Sort a SyncedSession vector using our custom SyncedSession comparator.
61 void SortSyncedSessions(SyncedSessionVector* sessions);
62
63 // Compares two tab navigations base on the parameters we sync.
64 // (Namely, we don't sync state or type mask)
65 bool NavigationEquals(const TabNavigation& expected,
66 const TabNavigation& actual);
67
68 // Verifies that two SessionWindows match.
69 // Returns:
70 // - true if all the following match:
71 // 1. number of SessionWindows,
72 // 2. number of tabs per SessionWindow,
73 // 3. number of tab navigations per tab,
74 // 4. actual tab navigations contents
75 // - false otherwise.
76 bool WindowsMatch(const SessionWindowVector& win1,
77 const SessionWindowVector& win2);
78
79 // Retrieves the foreign sessions for a particular profile and compares them
80 // with a reference SessionWindow list.
81 // Returns true if the session windows of the foreign session matches the
82 // reference.
83 bool CheckForeignSessionsAgainst(
84 int index,
85 const std::vector<SessionWindowVector*>& windows);
86
87 // Open a single tab and block until the session model associator is aware
88 // of it. Returns true upon success, false otherwise.
89 bool OpenTab(int index, const GURL& url);
90
91 // Open multiple tabs and block until the session model associator is aware
92 // of all of them. Returns true on success, false on failure.
93 bool OpenMultipleTabs(int index, const std::vector<GURL>& urls);
94
95 // Wait for a session change to propagate to the model associator. Will not
96 // return until each url in |urls| has been found.
97 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls);
98
99 // Check if the session model associator's knows that the current open tab
100 // has this url.
101 bool ModelAssociatorHasTabWithUrl(int index, const GURL& url);
102
103 // Stores a pointer to the local session for a given profile in |session|.
104 // Returns true on success, false on failure.
105 bool GetLocalSession(int index, const SyncedSession** session);
106
107 } // namespace sessions_helper
108
109 #endif // CHROME_TEST_LIVE_SYNC_SESSIONS_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/test/live_sync/preferences_helper.cc ('k') | chrome/test/live_sync/sessions_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698