| OLD | NEW |
| 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 "sync/internal_api/public/test/test_user_share.h" | 5 #include "sync/internal_api/public/test/test_user_share.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "sync/syncable/directory.h" | 8 #include "sync/syncable/directory.h" |
| 9 #include "sync/syncable/mutable_entry.h" | 9 #include "sync/syncable/mutable_entry.h" |
| 10 #include "sync/syncable/write_transaction.h" | 10 #include "sync/syncable/write_transaction.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 UserShare* TestUserShare::user_share() { | 41 UserShare* TestUserShare::user_share() { |
| 42 return user_share_.get(); | 42 return user_share_.get(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 SyncEncryptionHandler* TestUserShare::encryption_handler() { | 45 SyncEncryptionHandler* TestUserShare::encryption_handler() { |
| 46 return dir_maker_->encryption_handler(); | 46 return dir_maker_->encryption_handler(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 syncable::MockTransactionObserver* TestUserShare::transaction_observer() { |
| 50 return dir_maker_->transaction_observer(); |
| 51 } |
| 52 |
| 49 /* static */ | 53 /* static */ |
| 50 bool TestUserShare::CreateRoot(ModelType model_type, UserShare* user_share) { | 54 bool TestUserShare::CreateRoot(ModelType model_type, UserShare* user_share) { |
| 51 syncer::syncable::Directory* directory = user_share->directory.get(); | 55 syncer::syncable::Directory* directory = user_share->directory.get(); |
| 52 | 56 |
| 53 std::string tag_name = syncer::ModelTypeToRootTag(model_type); | 57 std::string tag_name = syncer::ModelTypeToRootTag(model_type); |
| 54 | 58 |
| 55 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory); | 59 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory); |
| 56 syncable::MutableEntry node(&wtrans, | 60 syncable::MutableEntry node(&wtrans, |
| 57 syncable::CREATE, | 61 syncable::CREATE, |
| 58 wtrans.root_id(), | 62 wtrans.root_id(), |
| 59 tag_name); | 63 tag_name); |
| 60 node.Put(syncable::UNIQUE_SERVER_TAG, tag_name); | 64 node.Put(syncable::UNIQUE_SERVER_TAG, tag_name); |
| 61 node.Put(syncable::IS_DIR, true); | 65 node.Put(syncable::IS_DIR, true); |
| 62 node.Put(syncable::SERVER_IS_DIR, false); | 66 node.Put(syncable::SERVER_IS_DIR, false); |
| 63 node.Put(syncable::IS_UNSYNCED, false); | 67 node.Put(syncable::IS_UNSYNCED, false); |
| 64 node.Put(syncable::IS_UNAPPLIED_UPDATE, false); | 68 node.Put(syncable::IS_UNAPPLIED_UPDATE, false); |
| 65 node.Put(syncable::SERVER_VERSION, 20); | 69 node.Put(syncable::SERVER_VERSION, 20); |
| 66 node.Put(syncable::BASE_VERSION, 20); | 70 node.Put(syncable::BASE_VERSION, 20); |
| 67 node.Put(syncable::IS_DEL, false); | 71 node.Put(syncable::IS_DEL, false); |
| 68 node.Put(syncable::ID, syncer::TestIdFactory::MakeServer(tag_name)); | 72 node.Put(syncable::ID, syncer::TestIdFactory::MakeServer(tag_name)); |
| 69 sync_pb::EntitySpecifics specifics; | 73 sync_pb::EntitySpecifics specifics; |
| 70 syncer::AddDefaultFieldValue(model_type, &specifics); | 74 syncer::AddDefaultFieldValue(model_type, &specifics); |
| 71 node.Put(syncable::SPECIFICS, specifics); | 75 node.Put(syncable::SPECIFICS, specifics); |
| 72 | 76 |
| 73 return true; | 77 return true; |
| 74 } | 78 } |
| 75 | 79 |
| 76 } // namespace syncer | 80 } // namespace syncer |
| OLD | NEW |