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/sessions/session_state.h" | 8 #include "chrome/browser/sync/sessions/session_state.h" |
9 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
10 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 10 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 GetClient(1)->GetLastSessionSnapshot()-> | 249 GetClient(1)->GetLastSessionSnapshot()-> |
250 num_conflicting_updates); // The encrypted nodes. | 250 num_conflicting_updates); // The encrypted nodes. |
251 | 251 |
252 // These changes are either made with the old passphrase or not encrypted at | 252 // These changes are either made with the old passphrase or not encrypted at |
253 // all depending on when client 0's changes are propagated. | 253 // all depending on when client 0's changes are propagated. |
254 ScopedWindowMap client1_windows; | 254 ScopedWindowMap client1_windows; |
255 ASSERT_TRUE(OpenTabAndGetLocalWindows(1, GURL(kURL1), | 255 ASSERT_TRUE(OpenTabAndGetLocalWindows(1, GURL(kURL1), |
256 client1_windows.GetMutable())); | 256 client1_windows.GetMutable())); |
257 | 257 |
258 // At this point we enter the passphrase, triggering a resync, in which the | 258 // At this point we enter the passphrase, triggering a resync, in which the |
259 // local changes of client 1 get overwritten for now. | 259 // local changes of client 1 get sent to client 0. |
260 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); | 260 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); |
261 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); | 261 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); |
262 ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS)); | 262 ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS)); |
| 263 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
263 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> | 264 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> |
264 num_conflicting_updates); | 265 num_conflicting_updates); |
265 | 266 |
266 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS)); | 267 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS)); |
267 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS)); | 268 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS)); |
268 // The session data from client 1 got overwritten. As a result, client 0 | |
269 // should have no foreign session data. TODO(zea): update this once bug 76596 | |
270 // is resolved and we don't choose server wins on encryption conflicts. | |
271 SyncedSessionVector sessions0; | 269 SyncedSessionVector sessions0; |
272 SyncedSessionVector sessions1; | 270 SyncedSessionVector sessions1; |
273 ASSERT_FALSE(GetSessionData(0, &sessions0)); | 271 ASSERT_TRUE(GetSessionData(0, &sessions0)); |
274 ASSERT_FALSE(GetSessionData(1, &sessions1)); | 272 ASSERT_FALSE(GetSessionData(1, &sessions1)); |
275 } | 273 } |
276 | 274 |
277 // Flaky. http://crbug.com/85294 | 275 // Flaky. http://crbug.com/85294 |
278 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, | 276 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, |
279 FLAKY_SecondChangesBeforeEncrAndPassphraseChange) { | 277 FLAKY_SecondChangesBeforeEncrAndPassphraseChange) { |
280 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 278 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
281 | 279 |
282 ASSERT_TRUE(CheckInitialState(0)); | 280 ASSERT_TRUE(CheckInitialState(0)); |
283 ASSERT_TRUE(CheckInitialState(1)); | 281 ASSERT_TRUE(CheckInitialState(1)); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 ASSERT_FALSE(GetSessionData(1, &sessions1)); | 424 ASSERT_FALSE(GetSessionData(1, &sessions1)); |
427 | 425 |
428 // Client 0 becomes active again with a new tab. | 426 // Client 0 becomes active again with a new tab. |
429 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL2), | 427 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL2), |
430 client0_windows.GetMutable())); | 428 client0_windows.GetMutable())); |
431 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 429 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
432 ASSERT_TRUE(GetSessionData(1, &sessions1)); | 430 ASSERT_TRUE(GetSessionData(1, &sessions1)); |
433 ASSERT_EQ(1U, sessions1.size()); | 431 ASSERT_EQ(1U, sessions1.size()); |
434 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get())); | 432 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get())); |
435 } | 433 } |
OLD | NEW |