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

Side by Side Diff: chrome/test/live_sync/two_client_live_sessions_sync_test.cc

Issue 5705004: [SYNC] Sessions datatype refactor. Most things related to sessions under-the-... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebase Created 9 years, 11 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/single_client_live_sessions_sync_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/test/live_sync/live_sessions_sync_test.h" 5 #include "chrome/test/live_sync/live_sessions_sync_test.h"
6 6
7 // @TODO(zea): Test each individual session command we care about separately. 7 // @TODO(zea): Test each individual session command we care about separately.
8 // (as well as multi-window). We're currently only checking basic single-window/ 8 // (as well as multi-window). We're currently only checking basic single-window/
9 // single-tab functionality. 9 // single-tab functionality.
10 10
11 IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest, SingleClientChanged) { 11 IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest, SingleClientChanged) {
12 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 12 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
13 13
14 ASSERT_TRUE(CheckInitialState(0)); 14 ASSERT_TRUE(CheckInitialState(0));
15 ASSERT_TRUE(CheckInitialState(1)); 15 ASSERT_TRUE(CheckInitialState(1));
16 16
17 std::vector<SessionWindow*>* client0_windows = 17 std::vector<SessionWindow*>* client0_windows =
18 InitializeNewWindowWithTab(0, GURL("about:bubba")); 18 InitializeNewWindowWithTab(0, GURL("about:bubba"));
19 ASSERT_TRUE(client0_windows); 19 ASSERT_TRUE(client0_windows);
20 20
21 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)); 21 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1));
22 22
23 // Get foreign session data from client 1. 23 // Get foreign session data from client 1.
24 ScopedVector<ForeignSession> sessions1; 24 std::vector<const ForeignSession*> sessions1;
25 ASSERT_TRUE(GetSessionData(1, &sessions1.get())); 25 ASSERT_TRUE(GetSessionData(1, &sessions1));
26 26
27 // Verify client 1's foreign session matches client 0 current window. 27 // Verify client 1's foreign session matches client 0 current window.
28 ASSERT_EQ(1U, sessions1.size()); 28 ASSERT_EQ(1U, sessions1.size());
29 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows)); 29 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows));
30 } 30 }
31 31
32 IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest, BothChanged) { 32 IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest, BothChanged) {
33 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 33 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
34 34
35 ASSERT_TRUE(CheckInitialState(0)); 35 ASSERT_TRUE(CheckInitialState(0));
36 ASSERT_TRUE(CheckInitialState(1)); 36 ASSERT_TRUE(CheckInitialState(1));
37 37
38 // Open tabs on both clients and retain window information. 38 // Open tabs on both clients and retain window information.
39 std::vector<SessionWindow*>* client0_windows = 39 std::vector<SessionWindow*>* client0_windows =
40 InitializeNewWindowWithTab(0, GURL("about:bubba0")); 40 InitializeNewWindowWithTab(0, GURL("about:bubba0"));
41 ASSERT_TRUE(client0_windows); 41 ASSERT_TRUE(client0_windows);
42 std::vector<SessionWindow*>* client1_windows = 42 std::vector<SessionWindow*>* client1_windows =
43 InitializeNewWindowWithTab(1, GURL("about:bubba1")); 43 InitializeNewWindowWithTab(1, GURL("about:bubba1"));
44 ASSERT_TRUE(client1_windows); 44 ASSERT_TRUE(client1_windows);
45 45
46 // Wait for sync. 46 // Wait for sync.
47 ASSERT_TRUE(AwaitQuiescence()); 47 ASSERT_TRUE(AwaitQuiescence());
48 48
49 // Get foreign session data from client 0 and 1. 49 // Get foreign session data from client 0 and 1.
50 ScopedVector<ForeignSession> sessions0; 50 std::vector<const ForeignSession*> sessions0;
51 ScopedVector<ForeignSession> sessions1; 51 std::vector<const ForeignSession*> sessions1;
52 ASSERT_TRUE(GetSessionData(0, &sessions0.get())); 52 ASSERT_TRUE(GetSessionData(0, &sessions0));
53 ASSERT_TRUE(GetSessionData(1, &sessions1.get())); 53 ASSERT_TRUE(GetSessionData(1, &sessions1));
54 54
55 // Verify client 1's foreign session matches client 0's current window and 55 // Verify client 1's foreign session matches client 0's current window and
56 // vice versa. 56 // vice versa.
57 ASSERT_EQ(1U, sessions0.size()); 57 ASSERT_EQ(1U, sessions0.size());
58 ASSERT_EQ(1U, sessions1.size()); 58 ASSERT_EQ(1U, sessions1.size());
59 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows)); 59 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows));
60 ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows)); 60 ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows));
61 } 61 }
62
OLDNEW
« no previous file with comments | « chrome/test/live_sync/single_client_live_sessions_sync_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698