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

Side by Side Diff: sync/notifier/invalidation_util.h

Issue 10874096: [Sync] Rework Invalidator-related unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 3 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 | « sync/notifier/invalidation_notifier_unittest.cc ('k') | sync/notifier/invalidation_util.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) 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 // Various utilities for dealing with invalidation data types. 5 // Various utilities for dealing with invalidation data types.
6 6
7 #ifndef SYNC_NOTIFIER_INVALIDATION_UTIL_H_ 7 #ifndef SYNC_NOTIFIER_INVALIDATION_UTIL_H_
8 #define SYNC_NOTIFIER_INVALIDATION_UTIL_H_ 8 #define SYNC_NOTIFIER_INVALIDATION_UTIL_H_
9 9
10 #include <iosfwd> 10 #include <iosfwd>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 13
14 #include "base/memory/scoped_ptr.h"
14 #include "sync/internal_api/public/base/model_type.h" 15 #include "sync/internal_api/public/base/model_type.h"
15 16
17 namespace base {
18 class DictionaryValue;
19 } // namespace
20
16 namespace invalidation { 21 namespace invalidation {
17 22
18 class Invalidation; 23 class Invalidation;
19 class ObjectId; 24 class ObjectId;
20 25
21 // Gmock print helper 26 // Gmock print helper
22 void PrintTo(const invalidation::ObjectId& id, std::ostream* os); 27 void PrintTo(const invalidation::ObjectId& id, std::ostream* os);
23 28
24 } // namespace invalidation 29 } // namespace invalidation
25 30
26 namespace syncer { 31 namespace syncer {
27 32
28 struct ObjectIdLessThan { 33 struct ObjectIdLessThan {
29 bool operator()(const invalidation::ObjectId& lhs, 34 bool operator()(const invalidation::ObjectId& lhs,
30 const invalidation::ObjectId& rhs) const; 35 const invalidation::ObjectId& rhs) const;
31 }; 36 };
32 37
33 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; 38 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet;
34 39
35 bool RealModelTypeToObjectId(ModelType model_type, 40 bool RealModelTypeToObjectId(ModelType model_type,
36 invalidation::ObjectId* object_id); 41 invalidation::ObjectId* object_id);
37 42
38 bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, 43 bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id,
39 ModelType* model_type); 44 ModelType* model_type);
40 45
46 // Caller owns the returned DictionaryValue.
47 scoped_ptr<base::DictionaryValue> ObjectIdToValue(
48 const invalidation::ObjectId& object_id);
49
50 bool ObjectIdFromValue(const base::DictionaryValue& value,
51 invalidation::ObjectId* out);
52
53 std::string ObjectIdToString(const invalidation::ObjectId& object_id);
54
41 ObjectIdSet ModelTypeSetToObjectIdSet(const ModelTypeSet& models); 55 ObjectIdSet ModelTypeSetToObjectIdSet(const ModelTypeSet& models);
42 ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids); 56 ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids);
43 57
44 std::string ObjectIdToString(const invalidation::ObjectId& object_id);
45
46 std::string InvalidationToString( 58 std::string InvalidationToString(
47 const invalidation::Invalidation& invalidation); 59 const invalidation::Invalidation& invalidation);
48 60
49 } // namespace syncer 61 } // namespace syncer
50 62
51 #endif // SYNC_NOTIFIER_INVALIDATION_UTIL_H_ 63 #endif // SYNC_NOTIFIER_INVALIDATION_UTIL_H_
OLDNEW
« no previous file with comments | « sync/notifier/invalidation_notifier_unittest.cc ('k') | sync/notifier/invalidation_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698