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

Side by Side Diff: chrome/browser/sync/test/integration/two_client_uss_sync_test.cc

Issue 2350803005: [Sync] Fixing two bugs in the worker revealed by trying to add an encryption integration test. (Closed)
Patch Set: Removing debugging log statements. Created 4 years, 3 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
OLDNEW
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"
11 #include "chrome/browser/sync/test/integration/status_change_checker.h" 11 #include "chrome/browser/sync/test/integration/status_change_checker.h"
12 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 12 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
13 #include "chrome/browser/sync/test/integration/sync_test.h" 13 #include "chrome/browser/sync/test/integration/sync_test.h"
14 #include "components/browser_sync/profile_sync_components_factory_impl.h" 14 #include "components/browser_sync/profile_sync_components_factory_impl.h"
15 #include "components/browser_sync/profile_sync_service.h" 15 #include "components/browser_sync/profile_sync_service.h"
16 #include "components/sync/api/fake_model_type_service.h" 16 #include "components/sync/api/fake_model_type_service.h"
17 17
18 using browser_sync::ChromeSyncClient; 18 using browser_sync::ChromeSyncClient;
19 using syncer_v2::FakeModelTypeService; 19 using syncer_v2::FakeModelTypeService;
20 using syncer_v2::ModelTypeService; 20 using syncer_v2::ModelTypeService;
21 using syncer_v2::SharedModelTypeProcessor; 21 using syncer_v2::SharedModelTypeProcessor;
22 22
23 const char kKey1[] = "key1"; 23 const char kKey1[] = "key1";
24 const char kKey2[] = "key2";
25 const char kKey3[] = "key3";
26 const char kKey4[] = "key4";
24 const char kValue1[] = "value1"; 27 const char kValue1[] = "value1";
25 const char kValue2[] = "value2"; 28 const char kValue2[] = "value2";
26 const char kResolutionValue[] = "RESOLVED"; 29 const char kResolutionValue[] = "RESOLVED";
27 30
28 // A ChromeSyncClient that provides a ModelTypeService for PREFERENCES. 31 // A ChromeSyncClient that provides a ModelTypeService for PREFERENCES.
29 class TestSyncClient : public ChromeSyncClient { 32 class TestSyncClient : public ChromeSyncClient {
30 public: 33 public:
31 TestSyncClient(Profile* profile, ModelTypeService* service) 34 TestSyncClient(Profile* profile, ModelTypeService* service)
32 : ChromeSyncClient(profile), service_(service) {} 35 : ChromeSyncClient(profile), service_(service) {}
33 36
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 298
296 // Write conflicting entities. 299 // Write conflicting entities.
297 model1->WriteItem(kKey1, kValue1); 300 model1->WriteItem(kKey1, kValue1);
298 model2->WriteItem(kKey1, kValue2); 301 model2->WriteItem(kKey1, kValue2);
299 302
300 // Wait for them to be resolved to kResolutionValue by the custom conflict 303 // Wait for them to be resolved to kResolutionValue by the custom conflict
301 // resolution logic in TestModelTypeService. 304 // resolution logic in TestModelTypeService.
302 ASSERT_TRUE(DataChecker(model1, kKey1, kResolutionValue).Wait()); 305 ASSERT_TRUE(DataChecker(model1, kKey1, kResolutionValue).Wait());
303 ASSERT_TRUE(DataChecker(model2, kKey1, kResolutionValue).Wait()); 306 ASSERT_TRUE(DataChecker(model2, kKey1, kResolutionValue).Wait());
304 } 307 }
308
309 IN_PROC_BROWSER_TEST_F(TwoClientUssSyncTest, Encryption) {
310 ASSERT_TRUE(SetupSync());
311 TestModelTypeService* model1 = GetModelTypeService(0);
312 TestModelTypeService* model2 = GetModelTypeService(1);
313
314 model1->WriteItem(kKey1, kValue1);
maxbogue 2016/09/21 00:57:14 What are each of these four items testing?
skym 2016/09/22 18:58:44 Reverted file.
315 model2->WriteItem(kKey2, kValue1);
316 ASSERT_TRUE(EnableEncryption(0));
maxbogue 2016/09/21 00:57:14 So this is using... the old version of encryption,
skym 2016/09/22 18:58:44 Whoops, good catch. Breaking into multiple CLs.
317 model1->WriteItem(kKey3, kValue1);
318 model2->WriteItem(kKey4, kValue1);
319
320 ASSERT_TRUE(DataChecker(model2, kKey1, kValue1).Wait());
321 ASSERT_TRUE(DataChecker(model1, kKey1, kValue1).Wait());
maxbogue 2016/09/21 00:57:14 I think you mean kKey2 here.
skym 2016/09/22 18:58:45 You're right! Fixed.
322 ASSERT_TRUE(DataChecker(model2, kKey3, kValue1).Wait());
323 ASSERT_TRUE(DataChecker(model1, kKey4, kValue1).Wait());
324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698