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

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

Issue 6465005: [Sync] Initial support for encrypting any datatype (no UI hookup yet). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_TEST_LIVE_SYNC_LIVE_SESSIONS_SYNC_TEST_H_ 5 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_SESSIONS_SYNC_TEST_H_
6 #define CHROME_TEST_LIVE_SYNC_LIVE_SESSIONS_SYNC_TEST_H_ 6 #define CHROME_TEST_LIVE_SYNC_LIVE_SESSIONS_SYNC_TEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 GetSessionService(i), GetProfile(i)); 183 GetSessionService(i), GetProfile(i));
184 test_session_services_.push_back(new_tester); 184 test_session_services_.push_back(new_tester);
185 GetHelper(i)->SetUp(); 185 GetHelper(i)->SetUp();
186 186
187 browsers_.push_back(Browser::Create(GetProfile(i))); 187 browsers_.push_back(Browser::Create(GetProfile(i)));
188 } 188 }
189 189
190 return true; 190 return true;
191 } 191 }
192 192
193 // Encrypt sessions datatype.
194 bool EnableEncryption(int index) {
195 return GetClient(index)->EnableEncryptionForType(syncable::SESSIONS);
196 }
197
198 // Check if Sessions are encrypted.
199 bool IsEncrypted(int index) {
200 return GetClient(index)->IsTypeEncrypted(syncable::SESSIONS);
201 }
202
193 // Open a single tab and return the TabContents. TabContents must be checked 203 // Open a single tab and return the TabContents. TabContents must be checked
194 // to ensure the tab opened successsfully. 204 // to ensure the tab opened successsfully.
195 TabContents* OpenTab(int index, GURL url) WARN_UNUSED_RESULT { 205 TabContents* OpenTab(int index, GURL url) WARN_UNUSED_RESULT {
196 TabContents* tab = GetBrowser(index)-> 206 TabContents* tab = GetBrowser(index)->
197 AddSelectedTabWithURL(url, PageTransition::START_PAGE)->tab_contents(); 207 AddSelectedTabWithURL(url, PageTransition::START_PAGE)->tab_contents();
198 208
199 // Wait for the page to finish loading. 209 // Wait for the page to finish loading.
200 ui_test_utils::WaitForNavigation( 210 ui_test_utils::WaitForNavigation(
201 &GetBrowser(index)->GetSelectedTabContents()->controller()); 211 &GetBrowser(index)->GetSelectedTabContents()->controller());
202 212
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // We don't own windows. 247 // We don't own windows.
238 std::vector<SessionWindow*>* windows = GetHelper(index)->ReadWindows(); 248 std::vector<SessionWindow*>* windows = GetHelper(index)->ReadWindows();
239 return windows->size(); 249 return windows->size();
240 } 250 }
241 251
242 // Returns number of foreign sessions for a profile. 252 // Returns number of foreign sessions for a profile.
243 int GetNumForeignSessions(int index) { 253 int GetNumForeignSessions(int index) {
244 std::vector<const ForeignSession*> sessions; 254 std::vector<const ForeignSession*> sessions;
245 if (!GetProfile(index)->GetProfileSyncService()-> 255 if (!GetProfile(index)->GetProfileSyncService()->
246 GetSessionModelAssociator()->GetAllForeignSessions(&sessions)) 256 GetSessionModelAssociator()->GetAllForeignSessions(&sessions))
247 return 0; 257 return 0;
248 return sessions.size(); 258 return sessions.size();
249 } 259 }
250 260
251 // Fills the sessions vector with the model associator's foreign session data. 261 // Fills the sessions vector with the model associator's foreign session data.
252 // Caller owns |sessions|, but not ForeignSession objects within. 262 // Caller owns |sessions|, but not ForeignSession objects within.
253 bool GetSessionData(int index, std::vector<const ForeignSession*>* sessions) 263 bool GetSessionData(int index, std::vector<const ForeignSession*>* sessions)
254 WARN_UNUSED_RESULT { 264 WARN_UNUSED_RESULT {
255 if (!GetProfile(index)->GetProfileSyncService()-> 265 if (!GetProfile(index)->GetProfileSyncService()->
256 GetSessionModelAssociator()->GetAllForeignSessions(sessions)) 266 GetSessionModelAssociator()->GetAllForeignSessions(sessions))
257 return false; 267 return false;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 public: 437 public:
428 MultipleClientLiveSessionsSyncTest() 438 MultipleClientLiveSessionsSyncTest()
429 : LiveSessionsSyncTest(MULTIPLE_CLIENT) {} 439 : LiveSessionsSyncTest(MULTIPLE_CLIENT) {}
430 virtual ~MultipleClientLiveSessionsSyncTest() {} 440 virtual ~MultipleClientLiveSessionsSyncTest() {}
431 441
432 private: 442 private:
433 DISALLOW_COPY_AND_ASSIGN(MultipleClientLiveSessionsSyncTest); 443 DISALLOW_COPY_AND_ASSIGN(MultipleClientLiveSessionsSyncTest);
434 }; 444 };
435 445
436 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SESSIONS_SYNC_TEST_H_ 446 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SESSIONS_SYNC_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698