| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
| 8 #include "chrome/browser/sync/chrome_sync_client.h" | 8 #include "chrome/browser/sync/chrome_sync_client.h" |
| 9 #include "chrome/browser/sync/profile_sync_service_factory.h" | 9 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 ASSERT_TRUE(SetupSync()); | 296 ASSERT_TRUE(SetupSync()); |
| 297 TestModelTypeSyncBridge* model0 = GetModelTypeSyncBridge(0); | 297 TestModelTypeSyncBridge* model0 = GetModelTypeSyncBridge(0); |
| 298 TestModelTypeSyncBridge* model1 = GetModelTypeSyncBridge(1); | 298 TestModelTypeSyncBridge* model1 = GetModelTypeSyncBridge(1); |
| 299 model0->SetConflictResolution(ConflictResolution::UseNew( | 299 model0->SetConflictResolution(ConflictResolution::UseNew( |
| 300 FakeModelTypeSyncBridge::GenerateEntityData(kKey1, kValue3))); | 300 FakeModelTypeSyncBridge::GenerateEntityData(kKey1, kValue3))); |
| 301 model1->SetConflictResolution(ConflictResolution::UseNew( | 301 model1->SetConflictResolution(ConflictResolution::UseNew( |
| 302 FakeModelTypeSyncBridge::GenerateEntityData(kKey1, kValue3))); | 302 FakeModelTypeSyncBridge::GenerateEntityData(kKey1, kValue3))); |
| 303 | 303 |
| 304 // Write conflicting entities. | 304 // Write conflicting entities. |
| 305 model0->WriteItem(kKey1, kValue1); | 305 model0->WriteItem(kKey1, kValue1); |
| 306 // Wait for the server to see the first commit to avoid a race condition where |
| 307 // both clients commit without seeing each other's update. |
| 308 ASSERT_TRUE(ServerCountMatchStatusChecker(syncer::PREFERENCES, 1).Wait()); |
| 306 model1->WriteItem(kKey1, kValue2); | 309 model1->WriteItem(kKey1, kValue2); |
| 307 | 310 |
| 308 // Wait for them to be resolved to kResolutionValue by the custom conflict | 311 // Wait for them to be resolved to kResolutionValue by the custom conflict |
| 309 // resolution logic in TestModelTypeSyncBridge. | 312 // resolution logic in TestModelTypeSyncBridge. |
| 310 ASSERT_TRUE(DataChecker(model0, kKey1, kValue3).Wait()); | 313 ASSERT_TRUE(DataChecker(model0, kKey1, kValue3).Wait()); |
| 311 ASSERT_TRUE(DataChecker(model1, kKey1, kValue3).Wait()); | 314 ASSERT_TRUE(DataChecker(model1, kKey1, kValue3).Wait()); |
| 312 } | 315 } |
| 313 | 316 |
| 314 IN_PROC_BROWSER_TEST_F(TwoClientUssSyncTest, Error) { | 317 IN_PROC_BROWSER_TEST_F(TwoClientUssSyncTest, Error) { |
| 315 ASSERT_TRUE(SetupSync()); | 318 ASSERT_TRUE(SetupSync()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 361 |
| 359 ASSERT_TRUE(DataChecker(model1, kKey1, kValue2).Wait()); | 362 ASSERT_TRUE(DataChecker(model1, kKey1, kValue2).Wait()); |
| 360 ASSERT_TRUE(DataChecker(model1, kKey2, kValue1).Wait()); | 363 ASSERT_TRUE(DataChecker(model1, kKey2, kValue1).Wait()); |
| 361 ASSERT_TRUE(DataChecker(model1, kKey4, kValue1).Wait()); | 364 ASSERT_TRUE(DataChecker(model1, kKey4, kValue1).Wait()); |
| 362 | 365 |
| 363 ASSERT_TRUE(DataChecker(model0, kKey1, kValue2).Wait()); | 366 ASSERT_TRUE(DataChecker(model0, kKey1, kValue2).Wait()); |
| 364 ASSERT_TRUE(DataChecker(model0, kKey3, kValue1).Wait()); | 367 ASSERT_TRUE(DataChecker(model0, kKey3, kValue1).Wait()); |
| 365 } | 368 } |
| 366 | 369 |
| 367 } // namespace | 370 } // namespace |
| OLD | NEW |