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

Side by Side Diff: chrome/browser/sync/test/live_sync/multiple_client_sessions_sync_test.cc

Issue 7841007: Rename browser/sync/test/live_sync directory to browser/sync/test/integration (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
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 #include "base/memory/scoped_vector.h"
6 #include "base/stringprintf.h"
7 #include "chrome/browser/sessions/session_service.h"
8 #include "chrome/browser/sync/profile_sync_service_harness.h"
9 #include "chrome/browser/sync/test/live_sync/live_sync_test.h"
10 #include "chrome/browser/sync/test/live_sync/sessions_helper.h"
11
12 using sessions_helper::CheckForeignSessionsAgainst;
13 using sessions_helper::CheckInitialState;
14 using sessions_helper::OpenTabAndGetLocalWindows;
15
16 class MultipleClientSessionsSyncTest : public LiveSyncTest {
17 public:
18 MultipleClientSessionsSyncTest() : LiveSyncTest(MULTIPLE_CLIENT) {}
19 virtual ~MultipleClientSessionsSyncTest() {}
20
21 private:
22 DISALLOW_COPY_AND_ASSIGN(MultipleClientSessionsSyncTest);
23 };
24
25 IN_PROC_BROWSER_TEST_F(MultipleClientSessionsSyncTest, AllChanged) {
26 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
27 ScopedVector<SessionWindowVector> client_windows;
28
29 for (int i = 0; i < num_clients(); ++i) {
30 ASSERT_TRUE(CheckInitialState(i));
31 }
32
33 // Open tabs on all clients and retain window information.
34 for (int i = 0; i < num_clients(); ++i) {
35 SessionWindowVector* windows = new SessionWindowVector();
36 ASSERT_TRUE(OpenTabAndGetLocalWindows(
37 i, GURL(StringPrintf("about:bubba%i", i)), *windows));
38 client_windows.push_back(windows);
39 }
40
41 // Wait for sync.
42 ASSERT_TRUE(AwaitQuiescence());
43
44 // Get foreign session data from all clients and check it against all
45 // client_windows.
46 for (int i = 0; i < num_clients(); ++i) {
47 ASSERT_TRUE(CheckForeignSessionsAgainst(i, client_windows.get()));
48 }
49 }
50
51 IN_PROC_BROWSER_TEST_F(MultipleClientSessionsSyncTest,
52 EncryptedAndChanged) {
53 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
54 ScopedVector<SessionWindowVector> client_windows;
55
56 for (int i = 0; i < num_clients(); ++i) {
57 ASSERT_TRUE(CheckInitialState(i));
58 }
59
60 // Enable encryption on client 0, should propagate to all other clients.
61 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS));
62
63 // Wait for sync.
64 // TODO(zea): Fix sync completion detection so we don't need this. For now,
65 // the profile sync service harness detects completion before all encryption
66 // changes are propagated.
67 ASSERT_TRUE(GetClient(0)->AwaitGroupSyncCycleCompletion(clients()));
68
69 // Open tabs on all clients and retain window information.
70 for (int i = 0; i < num_clients(); ++i) {
71 SessionWindowVector* windows = new SessionWindowVector();
72 ASSERT_TRUE(OpenTabAndGetLocalWindows(
73 i, GURL(StringPrintf("about:bubba%i", i)), *windows));
74 client_windows.push_back(windows);
75 }
76
77 // Wait for sync.
78 ASSERT_TRUE(AwaitQuiescence());
79
80 // Get foreign session data from all clients and check it against all
81 // client_windows.
82 for (int i = 0; i < num_clients(); ++i) {
83 ASSERT_TRUE(IsEncrypted(i, syncable::SESSIONS));
84 ASSERT_TRUE(CheckForeignSessionsAgainst(i, client_windows.get()));
85 }
86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698