OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "chrome/browser/sessions/session_service.h" | 6 #include "chrome/browser/sessions/session_service.h" |
7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/profile_sync_service_harness.h" |
8 #include "chrome/browser/sync/test/integration/sync_test.h" | 8 #include "chrome/browser/sync/test/integration/sync_test.h" |
9 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 9 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
10 | 10 |
11 using sessions_helper::CheckInitialState; | 11 using sessions_helper::CheckInitialState; |
12 using sessions_helper::GetLocalWindows; | 12 using sessions_helper::GetLocalWindows; |
13 using sessions_helper::GetSessionData; | 13 using sessions_helper::GetSessionData; |
14 using sessions_helper::OpenTabAndGetLocalWindows; | 14 using sessions_helper::OpenTabAndGetLocalWindows; |
| 15 using sessions_helper::ScopedWindowMap; |
| 16 using sessions_helper::SyncedSessionVector; |
15 using sessions_helper::WindowsMatch; | 17 using sessions_helper::WindowsMatch; |
16 | 18 |
17 class SingleClientSessionsSyncTest : public SyncTest { | 19 class SingleClientSessionsSyncTest : public SyncTest { |
18 public: | 20 public: |
19 SingleClientSessionsSyncTest() : SyncTest(SINGLE_CLIENT) {} | 21 SingleClientSessionsSyncTest() : SyncTest(SINGLE_CLIENT) {} |
20 virtual ~SingleClientSessionsSyncTest() {} | 22 virtual ~SingleClientSessionsSyncTest() {} |
21 | 23 |
22 private: | 24 private: |
23 DISALLOW_COPY_AND_ASSIGN(SingleClientSessionsSyncTest); | 25 DISALLOW_COPY_AND_ASSIGN(SingleClientSessionsSyncTest); |
24 }; | 26 }; |
25 | 27 |
26 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, Sanity) { | 28 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, Sanity) { |
27 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 29 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
28 | 30 |
29 ASSERT_TRUE(CheckInitialState(0)); | 31 ASSERT_TRUE(CheckInitialState(0)); |
30 | 32 |
31 ScopedVector<SessionWindow> old_windows; | 33 ScopedWindowMap old_windows; |
32 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, | 34 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, |
33 GURL("about:bubba"), | 35 GURL("about:bubba"), |
34 old_windows.get())); | 36 old_windows.get())); |
35 | 37 |
36 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 38 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
37 "Waiting for session change.")); | 39 "Waiting for session change.")); |
38 | 40 |
39 // Get foreign session data from client 0. | 41 // Get foreign session data from client 0. |
40 SyncedSessionVector sessions; | 42 SyncedSessionVector sessions; |
41 ASSERT_FALSE(GetSessionData(0, &sessions)); | 43 ASSERT_FALSE(GetSessionData(0, &sessions)); |
42 ASSERT_EQ(0U, sessions.size()); | 44 ASSERT_EQ(0U, sessions.size()); |
43 | 45 |
44 // Verify client didn't change. | 46 // Verify client didn't change. |
45 ScopedVector<SessionWindow> new_windows; | 47 ScopedWindowMap new_windows; |
46 ASSERT_TRUE(GetLocalWindows(0, new_windows.get())); | 48 ASSERT_TRUE(GetLocalWindows(0, new_windows.get())); |
47 ASSERT_TRUE(WindowsMatch(old_windows.get(), new_windows.get())); | 49 ASSERT_TRUE(WindowsMatch(*old_windows.get(), *new_windows.get())); |
48 } | 50 } |
OLD | NEW |