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

Side by Side Diff: sync/engine/model_type_entity_unittest.cc

Issue 1285443002: move V2 classes in chrome/engine to syncer_v2 namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « sync/engine/model_type_entity.cc ('k') | sync/engine/model_type_sync_proxy.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sync/engine/model_type_entity.h" 5 #include "sync/engine/model_type_entity.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "sync/internal_api/public/base/model_type.h" 9 #include "sync/internal_api/public/base/model_type.h"
10 #include "sync/protocol/sync.pb.h" 10 #include "sync/protocol/sync.pb.h"
11 #include "sync/syncable/syncable_util.h" 11 #include "sync/syncable/syncable_util.h"
12 12
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace syncer { 15 namespace syncer_v2 {
16 16
17 // Some simple sanity tests for the ModelTypeEntity. 17 // Some simple sanity tests for the ModelTypeEntity.
18 // 18 //
19 // A lot of the more complicated sync logic is implemented in the 19 // A lot of the more complicated sync logic is implemented in the
20 // ModelTypeSyncProxyImpl that owns the ModelTypeEntity. We can't unit test it 20 // ModelTypeSyncProxyImpl that owns the ModelTypeEntity. We can't unit test it
21 // here. 21 // here.
22 // 22 //
23 // Instead, we focus on simple tests to make sure that variables are getting 23 // Instead, we focus on simple tests to make sure that variables are getting
24 // properly intialized and flags properly set. Anything more complicated would 24 // properly intialized and flags properly set. Anything more complicated would
25 // be a redundant and incomplete version of the ModelTypeSyncProxyImpl tests. 25 // be a redundant and incomplete version of the ModelTypeSyncProxyImpl tests.
26 class ModelTypeEntityTest : public ::testing::Test { 26 class ModelTypeEntityTest : public ::testing::Test {
27 public: 27 public:
28 ModelTypeEntityTest() 28 ModelTypeEntityTest()
29 : kServerId("ServerID"), 29 : kServerId("ServerID"),
30 kClientTag("sample.pref.name"), 30 kClientTag("sample.pref.name"),
31 kClientTagHash(syncable::GenerateSyncableHash(PREFERENCES, kClientTag)), 31 kClientTagHash(
32 syncer::syncable::GenerateSyncableHash(syncer::PREFERENCES,
33 kClientTag)),
32 kCtime(base::Time::UnixEpoch() + base::TimeDelta::FromDays(10)), 34 kCtime(base::Time::UnixEpoch() + base::TimeDelta::FromDays(10)),
33 kMtime(base::Time::UnixEpoch() + base::TimeDelta::FromDays(20)) { 35 kMtime(base::Time::UnixEpoch() + base::TimeDelta::FromDays(20)) {
34 sync_pb::PreferenceSpecifics* pref_specifics = 36 sync_pb::PreferenceSpecifics* pref_specifics =
35 specifics.mutable_preference(); 37 specifics.mutable_preference();
36 pref_specifics->set_name(kClientTag); 38 pref_specifics->set_name(kClientTag);
37 pref_specifics->set_value("pref.value"); 39 pref_specifics->set_value("pref.value");
38 } 40 }
39 41
40 const std::string kServerId; 42 const std::string kServerId;
41 const std::string kClientTag; 43 const std::string kClientTag;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 EXPECT_TRUE(entity->IsUnsynced()); 172 EXPECT_TRUE(entity->IsUnsynced());
171 173
172 EXPECT_TRUE(entity->UpdateIsReflection(10)); 174 EXPECT_TRUE(entity->UpdateIsReflection(10));
173 EXPECT_FALSE(entity->UpdateIsInConflict(10)); 175 EXPECT_FALSE(entity->UpdateIsInConflict(10));
174 176
175 EXPECT_FALSE(entity->UpdateIsReflection(11)); 177 EXPECT_FALSE(entity->UpdateIsReflection(11));
176 EXPECT_TRUE(entity->UpdateIsInConflict(11)); 178 EXPECT_TRUE(entity->UpdateIsInConflict(11));
177 } 179 }
178 180
179 } // namespace syncer 181 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/model_type_entity.cc ('k') | sync/engine/model_type_sync_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698