| OLD | NEW | 
|    1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2006-2009 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 "chrome/browser/sync/engine/apply_updates_command.h" |    5 #include "chrome/browser/sync/engine/apply_updates_command.h" | 
|    6 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |    6 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 
|    7 #include "chrome/browser/sync/sessions/sync_session.h" |    7 #include "chrome/browser/sync/sessions/sync_session.h" | 
|    8 #include "chrome/browser/sync/syncable/directory_manager.h" |    8 #include "chrome/browser/sync/syncable/directory_manager.h" | 
|    9 #include "chrome/browser/sync/syncable/syncable.h" |    9 #include "chrome/browser/sync/syncable/syncable.h" | 
|   10 #include "chrome/browser/sync/syncable/syncable_id.h" |   10 #include "chrome/browser/sync/syncable/syncable_id.h" | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|   36     workers()->push_back(new ModelSafeWorker());  // GROUP_PASSIVE worker. |   36     workers()->push_back(new ModelSafeWorker());  // GROUP_PASSIVE worker. | 
|   37     (*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_PASSIVE; |   37     (*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_PASSIVE; | 
|   38     (*mutable_routing_info())[syncable::PASSWORDS] = GROUP_PASSIVE; |   38     (*mutable_routing_info())[syncable::PASSWORDS] = GROUP_PASSIVE; | 
|   39     (*mutable_routing_info())[syncable::NIGORI] = GROUP_PASSIVE; |   39     (*mutable_routing_info())[syncable::NIGORI] = GROUP_PASSIVE; | 
|   40     SyncerCommandTest::SetUp(); |   40     SyncerCommandTest::SetUp(); | 
|   41   } |   41   } | 
|   42  |   42  | 
|   43   // Create a new unapplied update. |   43   // Create a new unapplied update. | 
|   44   void CreateUnappliedNewItemWithParent(const string& item_id, |   44   void CreateUnappliedNewItemWithParent(const string& item_id, | 
|   45                                         const string& parent_id) { |   45                                         const string& parent_id) { | 
|   46     ScopedDirLookup dir(syncdb().manager(), syncdb().name()); |   46     ScopedDirLookup dir(syncdb()->manager(), syncdb()->name()); | 
|   47     ASSERT_TRUE(dir.good()); |   47     ASSERT_TRUE(dir.good()); | 
|   48     WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); |   48     WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); | 
|   49     MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, |   49     MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, | 
|   50         Id::CreateFromServerId(item_id)); |   50         Id::CreateFromServerId(item_id)); | 
|   51     ASSERT_TRUE(entry.good()); |   51     ASSERT_TRUE(entry.good()); | 
|   52     entry.Put(syncable::SERVER_VERSION, next_revision_++); |   52     entry.Put(syncable::SERVER_VERSION, next_revision_++); | 
|   53     entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); |   53     entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); | 
|   54  |   54  | 
|   55     entry.Put(syncable::SERVER_NON_UNIQUE_NAME, item_id); |   55     entry.Put(syncable::SERVER_NON_UNIQUE_NAME, item_id); | 
|   56     entry.Put(syncable::SERVER_PARENT_ID, Id::CreateFromServerId(parent_id)); |   56     entry.Put(syncable::SERVER_PARENT_ID, Id::CreateFromServerId(parent_id)); | 
|   57     entry.Put(syncable::SERVER_IS_DIR, true); |   57     entry.Put(syncable::SERVER_IS_DIR, true); | 
|   58     sync_pb::EntitySpecifics default_bookmark_specifics; |   58     sync_pb::EntitySpecifics default_bookmark_specifics; | 
|   59     default_bookmark_specifics.MutableExtension(sync_pb::bookmark); |   59     default_bookmark_specifics.MutableExtension(sync_pb::bookmark); | 
|   60     entry.Put(syncable::SERVER_SPECIFICS, default_bookmark_specifics); |   60     entry.Put(syncable::SERVER_SPECIFICS, default_bookmark_specifics); | 
|   61   } |   61   } | 
|   62  |   62  | 
|   63   void CreateUnappliedNewItem(const string& item_id, |   63   void CreateUnappliedNewItem(const string& item_id, | 
|   64                               const sync_pb::EntitySpecifics& specifics) { |   64                               const sync_pb::EntitySpecifics& specifics) { | 
|   65     ScopedDirLookup dir(syncdb().manager(), syncdb().name()); |   65     ScopedDirLookup dir(syncdb()->manager(), syncdb()->name()); | 
|   66     ASSERT_TRUE(dir.good()); |   66     ASSERT_TRUE(dir.good()); | 
|   67     WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); |   67     WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); | 
|   68     MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, |   68     MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, | 
|   69         Id::CreateFromServerId(item_id)); |   69         Id::CreateFromServerId(item_id)); | 
|   70     ASSERT_TRUE(entry.good()); |   70     ASSERT_TRUE(entry.good()); | 
|   71     entry.Put(syncable::SERVER_VERSION, next_revision_++); |   71     entry.Put(syncable::SERVER_VERSION, next_revision_++); | 
|   72     entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); |   72     entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); | 
|   73  |   73  | 
|   74     entry.Put(syncable::SERVER_NON_UNIQUE_NAME, item_id); |   74     entry.Put(syncable::SERVER_NON_UNIQUE_NAME, item_id); | 
|   75     entry.Put(syncable::SERVER_PARENT_ID, syncable::kNullId); |   75     entry.Put(syncable::SERVER_PARENT_ID, syncable::kNullId); | 
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  278   EXPECT_EQ(0, status->conflict_progress().ConflictingItemsSize()) |  278   EXPECT_EQ(0, status->conflict_progress().ConflictingItemsSize()) | 
|  279       << "The nigori update shouldn't be in conflict"; |  279       << "The nigori update shouldn't be in conflict"; | 
|  280   EXPECT_EQ(1, status->update_progress().SuccessfullyAppliedUpdateCount()) |  280   EXPECT_EQ(1, status->update_progress().SuccessfullyAppliedUpdateCount()) | 
|  281       << "The nigori update should be applied"; |  281       << "The nigori update should be applied"; | 
|  282  |  282  | 
|  283   EXPECT_FALSE(cryptographer->is_ready()); |  283   EXPECT_FALSE(cryptographer->is_ready()); | 
|  284   EXPECT_TRUE(cryptographer->has_pending_keys()); |  284   EXPECT_TRUE(cryptographer->has_pending_keys()); | 
|  285 } |  285 } | 
|  286  |  286  | 
|  287 }  // namespace browser_sync |  287 }  // namespace browser_sync | 
| OLD | NEW |