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

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

Issue 7190001: [Sync] Split DirectoryChangeListener for thread-safety (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix copyright Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/engine/syncapi.cc ('k') | chrome/browser/sync/engine/syncer.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Unit tests for the SyncApi. Note that a lot of the underlying 5 // Unit tests for the SyncApi. Note that a lot of the underlying
6 // functionality is provided by the Syncable layer, which has its own 6 // functionality is provided by the Syncable layer, which has its own
7 // unit tests. We'll test SyncApi specific things in this harness. 7 // unit tests. We'll test SyncApi specific things in this harness.
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/format_macros.h" 13 #include "base/format_macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/scoped_temp_dir.h" 16 #include "base/scoped_temp_dir.h"
17 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
18 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
19 #include "base/tracked.h"
19 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
20 #include "base/values.h" 21 #include "base/values.h"
21 #include "chrome/browser/password_manager/encryptor.h" 22 #include "chrome/browser/password_manager/encryptor.h"
22 #include "chrome/browser/sync/engine/http_post_provider_factory.h" 23 #include "chrome/browser/sync/engine/http_post_provider_factory.h"
23 #include "chrome/browser/sync/engine/http_post_provider_interface.h" 24 #include "chrome/browser/sync/engine/http_post_provider_interface.h"
24 #include "chrome/browser/sync/engine/model_safe_worker.h" 25 #include "chrome/browser/sync/engine/model_safe_worker.h"
25 #include "chrome/browser/sync/engine/syncapi.h" 26 #include "chrome/browser/sync/engine/syncapi.h"
26 #include "chrome/browser/sync/js_arg_list.h" 27 #include "chrome/browser/sync/js_arg_list.h"
27 #include "chrome/browser/sync/js_backend.h" 28 #include "chrome/browser/sync/js_backend.h"
28 #include "chrome/browser/sync/js_event_handler.h" 29 #include "chrome/browser/sync/js_event_handler.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 // Creates the "synced" root node for a particular datatype. We use the syncable 129 // Creates the "synced" root node for a particular datatype. We use the syncable
129 // methods here so that the syncer treats these nodes as if they were already 130 // methods here so that the syncer treats these nodes as if they were already
130 // received from the server. 131 // received from the server.
131 int64 MakeServerNodeForType(UserShare* share, 132 int64 MakeServerNodeForType(UserShare* share,
132 ModelType model_type) { 133 ModelType model_type) {
133 sync_pb::EntitySpecifics specifics; 134 sync_pb::EntitySpecifics specifics;
134 syncable::AddDefaultExtensionValue(model_type, &specifics); 135 syncable::AddDefaultExtensionValue(model_type, &specifics);
135 syncable::ScopedDirLookup dir(share->dir_manager.get(), share->name); 136 syncable::ScopedDirLookup dir(share->dir_manager.get(), share->name);
136 EXPECT_TRUE(dir.good()); 137 EXPECT_TRUE(dir.good());
137 syncable::WriteTransaction trans(dir, syncable::UNITTEST, __FILE__, __LINE__); 138 syncable::WriteTransaction trans(dir, syncable::UNITTEST, FROM_HERE);
138 // Attempt to lookup by nigori tag. 139 // Attempt to lookup by nigori tag.
139 std::string type_tag = syncable::ModelTypeToRootTag(model_type); 140 std::string type_tag = syncable::ModelTypeToRootTag(model_type);
140 syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag); 141 syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag);
141 syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, 142 syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM,
142 node_id); 143 node_id);
143 EXPECT_TRUE(entry.good()); 144 EXPECT_TRUE(entry.good());
144 entry.Put(syncable::BASE_VERSION, 1); 145 entry.Put(syncable::BASE_VERSION, 1);
145 entry.Put(syncable::SERVER_VERSION, 1); 146 entry.Put(syncable::SERVER_VERSION, 1);
146 entry.Put(syncable::IS_UNAPPLIED_UPDATE, false); 147 entry.Put(syncable::IS_UNAPPLIED_UPDATE, false);
147 entry.Put(syncable::SERVER_PARENT_ID, syncable::kNullId); 148 entry.Put(syncable::SERVER_PARENT_ID, syncable::kNullId);
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 root_node.InitByRootLookup(); 1408 root_node.InitByRootLookup();
1408 1409
1409 ReadNode password_node(&trans); 1410 ReadNode password_node(&trans);
1410 EXPECT_FALSE(password_node.InitByIdLookup(node_id)); 1411 EXPECT_FALSE(password_node.InitByIdLookup(node_id));
1411 } 1412 }
1412 } 1413 }
1413 1414
1414 } // namespace 1415 } // namespace
1415 1416
1416 } // namespace browser_sync 1417 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncapi.cc ('k') | chrome/browser/sync/engine/syncer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698