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

Side by Side Diff: chrome/browser/extensions/api/storage/settings_sync_unittest.cc

Issue 217063005: Separate SyncData methods into three groups, local, remote, and common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Reorganize Local and Remote based on offline feedback. Created 6 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/extensions/app_sync_bundle.cc » ('j') | sync/api/sync_data.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 5 #include "base/bind.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 good->Set(DEFAULTS, "foo", fooValue); 1003 good->Set(DEFAULTS, "foo", fooValue);
1004 bad->Set(DEFAULTS, "foo", fooValue); 1004 bad->Set(DEFAULTS, "foo", fooValue);
1005 1005
1006 // Even though bad will fail to get all sync data, sync data should still 1006 // Even though bad will fail to get all sync data, sync data should still
1007 // include that from good. 1007 // include that from good.
1008 testing_factory->GetExisting("bad")->set_error_code(ValueStore::CORRUPTION); 1008 testing_factory->GetExisting("bad")->set_error_code(ValueStore::CORRUPTION);
1009 { 1009 {
1010 syncer::SyncDataList all_sync_data = 1010 syncer::SyncDataList all_sync_data =
1011 GetSyncableService(model_type)->GetAllSyncData(model_type); 1011 GetSyncableService(model_type)->GetAllSyncData(model_type);
1012 EXPECT_EQ(1u, all_sync_data.size()); 1012 EXPECT_EQ(1u, all_sync_data.size());
1013 EXPECT_EQ("good/foo", all_sync_data[0].GetTag()); 1013 EXPECT_EQ("good/foo", all_sync_data[0].AsLocal().GetTag());
1014 } 1014 }
1015 testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK); 1015 testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK);
1016 1016
1017 // Sync shouldn't be disabled for good (nor bad -- but this is unimportant). 1017 // Sync shouldn't be disabled for good (nor bad -- but this is unimportant).
1018 GetSyncableService(model_type)->MergeDataAndStartSyncing( 1018 GetSyncableService(model_type)->MergeDataAndStartSyncing(
1019 model_type, 1019 model_type,
1020 syncer::SyncDataList(), 1020 syncer::SyncDataList(),
1021 sync_processor_wrapper_.PassAs<syncer::SyncChangeProcessor>(), 1021 sync_processor_wrapper_.PassAs<syncer::SyncChangeProcessor>(),
1022 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock())); 1022 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock()));
1023 1023
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 ASSERT_EQ(1u, sync_processor_->changes().size()); 1417 ASSERT_EQ(1u, sync_processor_->changes().size());
1418 SettingSyncData sync_data = sync_processor_->changes()[0]; 1418 SettingSyncData sync_data = sync_processor_->changes()[0];
1419 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); 1419 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type());
1420 EXPECT_EQ("ext", sync_data.extension_id()); 1420 EXPECT_EQ("ext", sync_data.extension_id());
1421 EXPECT_EQ("key.with.spot", sync_data.key()); 1421 EXPECT_EQ("key.with.spot", sync_data.key());
1422 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); 1422 EXPECT_TRUE(sync_data.value().Equals(string_value.get()));
1423 } 1423 }
1424 } 1424 }
1425 1425
1426 } // namespace extensions 1426 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/app_sync_bundle.cc » ('j') | sync/api/sync_data.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698