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

Side by Side Diff: components/sync/test/engine/test_id_factory.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
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 // A tool making it easier to create IDs for unit testing. 5 // A tool making it easier to create IDs for unit testing.
6 6
7 #ifndef SYNC_TEST_ENGINE_TEST_ID_FACTORY_H_ 7 #ifndef COMPONENTS_SYNC_TEST_ENGINE_TEST_ID_FACTORY_H_
8 #define SYNC_TEST_ENGINE_TEST_ID_FACTORY_H_ 8 #define COMPONENTS_SYNC_TEST_ENGINE_TEST_ID_FACTORY_H_
9 9
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "sync/syncable/syncable_id.h" 15 #include "components/sync/syncable/syncable_id.h"
16 16
17 namespace syncer { 17 namespace syncer {
18 18
19 class TestIdFactory { 19 class TestIdFactory {
20 public: 20 public:
21 TestIdFactory() : next_value_(1337000) {} 21 TestIdFactory() : next_value_(1337000) {}
22 ~TestIdFactory() {} 22 ~TestIdFactory() {}
23 23
24 // Get the root ID. 24 // Get the root ID.
25 static syncable::Id root() { return syncable::Id::GetRoot(); } 25 static syncable::Id root() { return syncable::Id::GetRoot(); }
(...skipping 22 matching lines...) Expand all
48 } 48 }
49 49
50 // Autogenerate a fresh local ID. 50 // Autogenerate a fresh local ID.
51 syncable::Id NewLocalId() { 51 syncable::Id NewLocalId() {
52 return syncable::Id::CreateFromClientString( 52 return syncable::Id::CreateFromClientString(
53 std::string("_auto ") + base::IntToString(-next_value())); 53 std::string("_auto ") + base::IntToString(-next_value()));
54 } 54 }
55 55
56 // Autogenerate a fresh server ID. 56 // Autogenerate a fresh server ID.
57 syncable::Id NewServerId() { 57 syncable::Id NewServerId() {
58 return syncable::Id::CreateFromServerId( 58 return syncable::Id::CreateFromServerId(std::string("_auto ") +
59 std::string("_auto ") + base::IntToString(next_value())); 59 base::IntToString(next_value()));
60 } 60 }
61 61
62 private: 62 private:
63 int next_value() { 63 int next_value() { return next_value_++; }
64 return next_value_++;
65 }
66 int next_value_; 64 int next_value_;
67 }; 65 };
68 66
69 } // namespace syncer 67 } // namespace syncer
70 68
71 #endif // SYNC_TEST_ENGINE_TEST_ID_FACTORY_H_ 69 #endif // COMPONENTS_SYNC_TEST_ENGINE_TEST_ID_FACTORY_H_
72
OLDNEW
« no previous file with comments | « components/sync/test/engine/test_directory_setter_upper.cc ('k') | components/sync/test/engine/test_syncable_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698