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

Side by Side Diff: sync/syncable/model_type_unittest.cc

Issue 17034006: Add base namespace to more values in sync and elsewhere. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « sync/syncable/entry_kernel.cc ('k') | sync/syncable/nigori_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 #include "sync/internal_api/public/base/model_type.h" 5 #include "sync/internal_api/public/base/model_type.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/test/values_test_util.h" 10 #include "base/test/values_test_util.h"
(...skipping 21 matching lines...) Expand all
32 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { 32 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
33 ModelType model_type = ModelTypeFromInt(i); 33 ModelType model_type = ModelTypeFromInt(i);
34 scoped_ptr<StringValue> value(ModelTypeToValue(model_type)); 34 scoped_ptr<StringValue> value(ModelTypeToValue(model_type));
35 EXPECT_EQ(model_type, ModelTypeFromValue(*value)); 35 EXPECT_EQ(model_type, ModelTypeFromValue(*value));
36 } 36 }
37 } 37 }
38 38
39 TEST_F(ModelTypeTest, ModelTypeSetToValue) { 39 TEST_F(ModelTypeTest, ModelTypeSetToValue) {
40 const ModelTypeSet model_types(BOOKMARKS, APPS); 40 const ModelTypeSet model_types(BOOKMARKS, APPS);
41 41
42 scoped_ptr<ListValue> value(ModelTypeSetToValue(model_types)); 42 scoped_ptr<base::ListValue> value(ModelTypeSetToValue(model_types));
43 EXPECT_EQ(2u, value->GetSize()); 43 EXPECT_EQ(2u, value->GetSize());
44 std::string types[2]; 44 std::string types[2];
45 EXPECT_TRUE(value->GetString(0, &types[0])); 45 EXPECT_TRUE(value->GetString(0, &types[0]));
46 EXPECT_TRUE(value->GetString(1, &types[1])); 46 EXPECT_TRUE(value->GetString(1, &types[1]));
47 EXPECT_EQ("Bookmarks", types[0]); 47 EXPECT_EQ("Bookmarks", types[0]);
48 EXPECT_EQ("Apps", types[1]); 48 EXPECT_EQ("Apps", types[1]);
49 } 49 }
50 50
51 TEST_F(ModelTypeTest, ModelTypeSetFromValue) { 51 TEST_F(ModelTypeTest, ModelTypeSetFromValue) {
52 // Try empty set first. 52 // Try empty set first.
53 ModelTypeSet model_types; 53 ModelTypeSet model_types;
54 scoped_ptr<ListValue> value(ModelTypeSetToValue(model_types)); 54 scoped_ptr<base::ListValue> value(ModelTypeSetToValue(model_types));
55 EXPECT_TRUE(model_types.Equals(ModelTypeSetFromValue(*value))); 55 EXPECT_TRUE(model_types.Equals(ModelTypeSetFromValue(*value)));
56 56
57 // Now try with a few random types. 57 // Now try with a few random types.
58 model_types.Put(BOOKMARKS); 58 model_types.Put(BOOKMARKS);
59 model_types.Put(APPS); 59 model_types.Put(APPS);
60 value.reset(ModelTypeSetToValue(model_types)); 60 value.reset(ModelTypeSetToValue(model_types));
61 EXPECT_TRUE(model_types.Equals(ModelTypeSetFromValue(*value))); 61 EXPECT_TRUE(model_types.Equals(ModelTypeSetFromValue(*value)));
62 } 62 }
63 63
64 TEST_F(ModelTypeTest, IsRealDataType) { 64 TEST_F(ModelTypeTest, IsRealDataType) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // This is not necessary for the mapping to be valid, but most instances of 99 // This is not necessary for the mapping to be valid, but most instances of
100 // UMA_HISTOGRAM that use this mapping specify MODEL_TYPE_COUNT as the 100 // UMA_HISTOGRAM that use this mapping specify MODEL_TYPE_COUNT as the
101 // maximum possible value. If you break this assumption, you should update 101 // maximum possible value. If you break this assumption, you should update
102 // those histograms. 102 // those histograms.
103 EXPECT_LT(histogram_value, MODEL_TYPE_COUNT); 103 EXPECT_LT(histogram_value, MODEL_TYPE_COUNT);
104 } 104 }
105 } 105 }
106 106
107 } // namespace 107 } // namespace
108 } // namespace syncer 108 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/entry_kernel.cc ('k') | sync/syncable/nigori_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698