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

Side by Side Diff: chrome/browser/sync/engine/apply_updates_command_unittest.cc

Issue 340055: String cleanup in sync code (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync/engine/auth_watcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/engine/sync_cycle_state.h" 6 #include "chrome/browser/sync/engine/sync_cycle_state.h"
7 #include "chrome/browser/sync/engine/sync_process_state.h" 7 #include "chrome/browser/sync/engine/sync_process_state.h"
8 #include "chrome/browser/sync/engine/syncer_session.h" 8 #include "chrome/browser/sync/engine/syncer_session.h"
9 #include "chrome/browser/sync/syncable/directory_manager.h" 9 #include "chrome/browser/sync/syncable/directory_manager.h"
10 #include "chrome/browser/sync/syncable/syncable.h" 10 #include "chrome/browser/sync/syncable/syncable.h"
11 #include "chrome/browser/sync/syncable/syncable_id.h" 11 #include "chrome/browser/sync/syncable/syncable_id.h"
12 #include "chrome/browser/sync/util/character_set_converters.h"
13 #include "chrome/test/sync/engine/test_directory_setter_upper.h" 12 #include "chrome/test/sync/engine/test_directory_setter_upper.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 14
16 using std::string; 15 using std::string;
17 using syncable::ScopedDirLookup; 16 using syncable::ScopedDirLookup;
18 using syncable::WriteTransaction; 17 using syncable::WriteTransaction;
19 using syncable::ReadTransaction; 18 using syncable::ReadTransaction;
20 using syncable::MutableEntry; 19 using syncable::MutableEntry;
21 using syncable::Entry; 20 using syncable::Entry;
22 using syncable::Id; 21 using syncable::Id;
(...skipping 16 matching lines...) Expand all
39 protected: 38 protected:
40 // Create a new unapplied update. 39 // Create a new unapplied update.
41 void CreateUnappliedNewItemWithParent(const string& item_id, 40 void CreateUnappliedNewItemWithParent(const string& item_id,
42 const string& parent_id) { 41 const string& parent_id) {
43 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); 42 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name());
44 ASSERT_TRUE(dir.good()); 43 ASSERT_TRUE(dir.good());
45 WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); 44 WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__);
46 MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, 45 MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM,
47 Id::CreateFromServerId(item_id)); 46 Id::CreateFromServerId(item_id));
48 ASSERT_TRUE(entry.good()); 47 ASSERT_TRUE(entry.good());
49 PathString name;
50 AppendUTF8ToPathString(item_id, &name);
51 entry.Put(syncable::SERVER_VERSION, next_revision_++); 48 entry.Put(syncable::SERVER_VERSION, next_revision_++);
52 entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); 49 entry.Put(syncable::IS_UNAPPLIED_UPDATE, true);
53 entry.Put(syncable::SERVER_NAME, name); 50 entry.Put(syncable::SERVER_NAME, item_id);
54 entry.Put(syncable::SERVER_NON_UNIQUE_NAME, name); 51 entry.Put(syncable::SERVER_NON_UNIQUE_NAME, item_id);
55 entry.Put(syncable::SERVER_PARENT_ID, Id::CreateFromServerId(parent_id)); 52 entry.Put(syncable::SERVER_PARENT_ID, Id::CreateFromServerId(parent_id));
56 entry.Put(syncable::SERVER_IS_DIR, true); 53 entry.Put(syncable::SERVER_IS_DIR, true);
57 } 54 }
58 55
59 TestDirectorySetterUpper syncdb_; 56 TestDirectorySetterUpper syncdb_;
60 ApplyUpdatesCommand apply_updates_command_; 57 ApplyUpdatesCommand apply_updates_command_;
61 58
62 private: 59 private:
63 int64 next_revision_; 60 int64 next_revision_;
64 DISALLOW_COPY_AND_ASSIGN(ApplyUpdatesCommandTest); 61 DISALLOW_COPY_AND_ASSIGN(ApplyUpdatesCommandTest);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 << "All updates should have been attempted"; 153 << "All updates should have been attempted";
157 EXPECT_EQ(2, process_state.ConflictingItemsSize()) 154 EXPECT_EQ(2, process_state.ConflictingItemsSize())
158 << "The updates with unknown ancestors should be in conflict"; 155 << "The updates with unknown ancestors should be in conflict";
159 EXPECT_EQ(0, process_state.BlockedItemsSize()) 156 EXPECT_EQ(0, process_state.BlockedItemsSize())
160 << "Blocked items shouldn't be possible under any circumstances"; 157 << "Blocked items shouldn't be possible under any circumstances";
161 EXPECT_EQ(4, cycle_state.SuccessfullyAppliedUpdateCount()) 158 EXPECT_EQ(4, cycle_state.SuccessfullyAppliedUpdateCount())
162 << "The updates with known ancestors should be successfully applied"; 159 << "The updates with known ancestors should be successfully applied";
163 } 160 }
164 161
165 } // namespace browser_sync 162 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/engine/auth_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698