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

Side by Side Diff: components/sync/engine_impl/worker_entity_tracker_unittest.cc

Issue 2502253003: [Sync] Move GenerateSyncableHash to base. (Closed)
Patch Set: Keep full syncable/ DEP. Created 4 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
« no previous file with comments | « components/sync/engine_impl/uss_migrator_unittest.cc ('k') | components/sync/model/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "components/sync/engine_impl/worker_entity_tracker.h" 6 #include "components/sync/engine_impl/worker_entity_tracker.h"
7 7
8 #include "components/sync/base/hash_util.h"
8 #include "components/sync/base/model_type.h" 9 #include "components/sync/base/model_type.h"
9 #include "components/sync/base/time.h" 10 #include "components/sync/base/time.h"
10 #include "components/sync/syncable/syncable_util.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace syncer { 13 namespace syncer {
14 14
15 // Some simple tests for the WorkerEntityTracker. 15 // Some simple tests for the WorkerEntityTracker.
16 // 16 //
17 // The WorkerEntityTracker is an implementation detail of the ModelTypeWorker. 17 // The WorkerEntityTracker is an implementation detail of the ModelTypeWorker.
18 // As such, it doesn't make much sense to test it exhaustively, since it 18 // As such, it doesn't make much sense to test it exhaustively, since it
19 // already gets a lot of test coverage from the ModelTypeWorker unit tests. 19 // already gets a lot of test coverage from the ModelTypeWorker unit tests.
20 // 20 //
21 // These tests are intended as a basic sanity check. Anything more complicated 21 // These tests are intended as a basic sanity check. Anything more complicated
22 // would be redundant. 22 // would be redundant.
23 class WorkerEntityTrackerTest : public ::testing::Test { 23 class WorkerEntityTrackerTest : public ::testing::Test {
24 public: 24 public:
25 WorkerEntityTrackerTest() 25 WorkerEntityTrackerTest()
26 : kServerId("ServerID"), 26 : kServerId("ServerID"),
27 kClientTag("some.sample.tag"), 27 kClientTag("some.sample.tag"),
28 kClientTagHash(syncable::GenerateSyncableHash(PREFERENCES, kClientTag)), 28 kClientTagHash(GenerateSyncableHash(PREFERENCES, kClientTag)),
29 kSpecificsHash("somehash"), 29 kSpecificsHash("somehash"),
30 kCtime(base::Time::UnixEpoch() + base::TimeDelta::FromDays(10)), 30 kCtime(base::Time::UnixEpoch() + base::TimeDelta::FromDays(10)),
31 kMtime(base::Time::UnixEpoch() + base::TimeDelta::FromDays(20)), 31 kMtime(base::Time::UnixEpoch() + base::TimeDelta::FromDays(20)),
32 entity_(new WorkerEntityTracker(kClientTagHash)) { 32 entity_(new WorkerEntityTracker(kClientTagHash)) {
33 specifics.mutable_preference()->set_name(kClientTag); 33 specifics.mutable_preference()->set_name(kClientTag);
34 specifics.mutable_preference()->set_value("pref.value"); 34 specifics.mutable_preference()->set_value("pref.value");
35 } 35 }
36 36
37 ~WorkerEntityTrackerTest() override {} 37 ~WorkerEntityTrackerTest() override {}
38 38
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 ack.id = kServerId; 172 ack.id = kServerId;
173 entity_->ReceiveCommitResponse(&ack); 173 entity_->ReceiveCommitResponse(&ack);
174 174
175 entity_->RequestCommit(MakeCommitRequestData(1, kLocalBaseVersion)); 175 entity_->RequestCommit(MakeCommitRequestData(1, kLocalBaseVersion));
176 sync_pb::SyncEntity pb_entity; 176 sync_pb::SyncEntity pb_entity;
177 entity_->PopulateCommitProto(&pb_entity); 177 entity_->PopulateCommitProto(&pb_entity);
178 EXPECT_EQ(kCommitResponseVersion, pb_entity.version()); 178 EXPECT_EQ(kCommitResponseVersion, pb_entity.version());
179 } 179 }
180 180
181 } // namespace syncer 181 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/uss_migrator_unittest.cc ('k') | components/sync/model/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698