OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/test/live_sync/live_sessions_sync_test.h" |
| 6 |
| 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/ |
| 9 // single-tab functionality. |
| 10 |
| 11 IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest, SingleClientChanged) { |
| 12 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 13 |
| 14 ASSERT_TRUE(CheckInitialState(0)); |
| 15 ASSERT_TRUE(CheckInitialState(1)); |
| 16 |
| 17 std::vector<SessionWindow*>* client0_windows = |
| 18 InitializeNewWindowWithTab(0, GURL("about:bubba")); |
| 19 ASSERT_TRUE(client0_windows); |
| 20 |
| 21 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)); |
| 22 |
| 23 // Get foreign session data from client 1. |
| 24 ScopedVector<ForeignSession> sessions1; |
| 25 ASSERT_TRUE(GetSessionData(1, &sessions1.get())); |
| 26 |
| 27 // Verify client 1's foreign session matches client 0 current window. |
| 28 ASSERT_EQ(1U, sessions1.size()); |
| 29 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows)); |
| 30 } |
| 31 |
| 32 IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest, BothChanged) { |
| 33 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 34 |
| 35 ASSERT_TRUE(CheckInitialState(0)); |
| 36 ASSERT_TRUE(CheckInitialState(1)); |
| 37 |
| 38 // Open tabs on both clients and retain window information. |
| 39 std::vector<SessionWindow*>* client0_windows = |
| 40 InitializeNewWindowWithTab(0, GURL("about:bubba0")); |
| 41 ASSERT_TRUE(client0_windows); |
| 42 std::vector<SessionWindow*>* client1_windows = |
| 43 InitializeNewWindowWithTab(1, GURL("about:bubba1")); |
| 44 ASSERT_TRUE(client1_windows); |
| 45 |
| 46 // Wait for sync. |
| 47 ASSERT_TRUE(AwaitQuiescence()); |
| 48 |
| 49 // Get foreign session data from client 0 and 1. |
| 50 ScopedVector<ForeignSession> sessions0; |
| 51 ScopedVector<ForeignSession> sessions1; |
| 52 ASSERT_TRUE(GetSessionData(0, &sessions0.get())); |
| 53 ASSERT_TRUE(GetSessionData(1, &sessions1.get())); |
| 54 |
| 55 // Verify client 1's foreign session matches client 0's current window and |
| 56 // vice versa. |
| 57 ASSERT_EQ(1U, sessions0.size()); |
| 58 ASSERT_EQ(1U, sessions1.size()); |
| 59 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows)); |
| 60 ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows)); |
| 61 } |
| 62 |
OLD | NEW |