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 "base/location.h" | 5 #include "base/location.h" |
6 #include "chrome/browser/sync/engine/verify_updates_command.h" | 6 #include "chrome/browser/sync/engine/verify_updates_command.h" |
7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
8 #include "chrome/browser/sync/sessions/session_state.h" | 8 #include "chrome/browser/sync/sessions/session_state.h" |
9 #include "chrome/browser/sync/sessions/sync_session.h" | 9 #include "chrome/browser/sync/sessions/sync_session.h" |
10 #include "chrome/browser/sync/syncable/syncable.h" | 10 #include "chrome/browser/sync/syncable/syncable.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 WriteTransaction trans(FROM_HERE, UNITTEST, directory()); | 44 WriteTransaction trans(FROM_HERE, UNITTEST, directory()); |
45 MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, | 45 MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, |
46 Id::CreateFromServerId(item_id)); | 46 Id::CreateFromServerId(item_id)); |
47 ASSERT_TRUE(entry.good()); | 47 ASSERT_TRUE(entry.good()); |
48 | 48 |
49 entry.Put(syncable::BASE_VERSION, 1); | 49 entry.Put(syncable::BASE_VERSION, 1); |
50 entry.Put(syncable::SERVER_VERSION, 1); | 50 entry.Put(syncable::SERVER_VERSION, 1); |
51 entry.Put(syncable::NON_UNIQUE_NAME, item_id); | 51 entry.Put(syncable::NON_UNIQUE_NAME, item_id); |
52 entry.Put(syncable::PARENT_ID, Id::CreateFromServerId(parent_id)); | 52 entry.Put(syncable::PARENT_ID, Id::CreateFromServerId(parent_id)); |
53 sync_pb::EntitySpecifics default_specifics; | 53 sync_pb::EntitySpecifics default_specifics; |
54 AddDefaultExtensionValue(type, &default_specifics); | 54 AddDefaultFieldValue(type, &default_specifics); |
55 entry.Put(syncable::SERVER_SPECIFICS, default_specifics); | 55 entry.Put(syncable::SERVER_SPECIFICS, default_specifics); |
56 } | 56 } |
57 | 57 |
58 void AddUpdate(GetUpdatesResponse* updates, | 58 void AddUpdate(GetUpdatesResponse* updates, |
59 const std::string& id, const std::string& parent, | 59 const std::string& id, const std::string& parent, |
60 const syncable::ModelType& type) { | 60 const syncable::ModelType& type) { |
61 sync_pb::SyncEntity* e = updates->add_entries(); | 61 sync_pb::SyncEntity* e = updates->add_entries(); |
62 e->set_id_string("b1"); | 62 e->set_id_string("b1"); |
63 e->set_parent_id_string(parent); | 63 e->set_parent_id_string(parent); |
64 e->set_non_unique_name("b1"); | 64 e->set_non_unique_name("b1"); |
65 e->set_name("b1"); | 65 e->set_name("b1"); |
66 AddDefaultExtensionValue(type, e->mutable_specifics()); | 66 AddDefaultFieldValue(type, e->mutable_specifics()); |
67 } | 67 } |
68 | 68 |
69 VerifyUpdatesCommand command_; | 69 VerifyUpdatesCommand command_; |
70 | 70 |
71 }; | 71 }; |
72 | 72 |
73 TEST_F(VerifyUpdatesCommandTest, AllVerified) { | 73 TEST_F(VerifyUpdatesCommandTest, AllVerified) { |
74 string root = syncable::GetNullId().GetServerId(); | 74 string root = syncable::GetNullId().GetServerId(); |
75 | 75 |
76 CreateLocalItem("b1", root, syncable::BOOKMARKS); | 76 CreateLocalItem("b1", root, syncable::BOOKMARKS); |
(...skipping 25 matching lines...) Expand all Loading... |
102 ASSERT_TRUE(status->update_progress()); | 102 ASSERT_TRUE(status->update_progress()); |
103 EXPECT_EQ(1, status->update_progress()->VerifiedUpdatesSize()); | 103 EXPECT_EQ(1, status->update_progress()->VerifiedUpdatesSize()); |
104 } | 104 } |
105 { | 105 { |
106 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); | 106 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); |
107 EXPECT_FALSE(status->update_progress()); | 107 EXPECT_FALSE(status->update_progress()); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 } | 111 } |
OLD | NEW |