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

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

Issue 10795018: [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiix indent Created 8 years, 5 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/mutable_entry.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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace syncer { 14 namespace syncer {
15 namespace { 15 namespace {
16 16
17 class ModelTypeTest : public testing::Test {}; 17 class ModelTypeTest : public testing::Test {};
18 18
19 TEST_F(ModelTypeTest, ModelTypeToValue) { 19 TEST_F(ModelTypeTest, ModelTypeToValue) {
20 for (int i = syncer::FIRST_REAL_MODEL_TYPE; 20 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
21 i < syncer::MODEL_TYPE_COUNT; ++i) {
22 ModelType model_type = ModelTypeFromInt(i); 21 ModelType model_type = ModelTypeFromInt(i);
23 base::ExpectStringValue(ModelTypeToString(model_type), 22 base::ExpectStringValue(ModelTypeToString(model_type),
24 ModelTypeToValue(model_type)); 23 ModelTypeToValue(model_type));
25 } 24 }
26 base::ExpectStringValue("Top-level folder", 25 base::ExpectStringValue("Top-level folder",
27 ModelTypeToValue(TOP_LEVEL_FOLDER)); 26 ModelTypeToValue(TOP_LEVEL_FOLDER));
28 base::ExpectStringValue("Unspecified", 27 base::ExpectStringValue("Unspecified",
29 ModelTypeToValue(UNSPECIFIED)); 28 ModelTypeToValue(UNSPECIFIED));
30 } 29 }
31 30
32 TEST_F(ModelTypeTest, ModelTypeFromValue) { 31 TEST_F(ModelTypeTest, ModelTypeFromValue) {
33 for (int i = syncer::FIRST_REAL_MODEL_TYPE; 32 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
34 i < syncer::MODEL_TYPE_COUNT; ++i) {
35 ModelType model_type = ModelTypeFromInt(i); 33 ModelType model_type = ModelTypeFromInt(i);
36 scoped_ptr<StringValue> value(ModelTypeToValue(model_type)); 34 scoped_ptr<StringValue> value(ModelTypeToValue(model_type));
37 EXPECT_EQ(model_type, ModelTypeFromValue(*value)); 35 EXPECT_EQ(model_type, ModelTypeFromValue(*value));
38 } 36 }
39 } 37 }
40 38
41 TEST_F(ModelTypeTest, ModelTypeSetToValue) { 39 TEST_F(ModelTypeTest, ModelTypeSetToValue) {
42 const ModelTypeSet model_types(syncer::BOOKMARKS, syncer::APPS); 40 const ModelTypeSet model_types(BOOKMARKS, APPS);
43 41
44 scoped_ptr<ListValue> value(ModelTypeSetToValue(model_types)); 42 scoped_ptr<ListValue> value(ModelTypeSetToValue(model_types));
45 EXPECT_EQ(2u, value->GetSize()); 43 EXPECT_EQ(2u, value->GetSize());
46 std::string types[2]; 44 std::string types[2];
47 EXPECT_TRUE(value->GetString(0, &types[0])); 45 EXPECT_TRUE(value->GetString(0, &types[0]));
48 EXPECT_TRUE(value->GetString(1, &types[1])); 46 EXPECT_TRUE(value->GetString(1, &types[1]));
49 EXPECT_EQ("Bookmarks", types[0]); 47 EXPECT_EQ("Bookmarks", types[0]);
50 EXPECT_EQ("Apps", types[1]); 48 EXPECT_EQ("Apps", types[1]);
51 } 49 }
52 50
(...skipping 14 matching lines...) Expand all
67 EXPECT_FALSE(IsRealDataType(UNSPECIFIED)); 65 EXPECT_FALSE(IsRealDataType(UNSPECIFIED));
68 EXPECT_FALSE(IsRealDataType(MODEL_TYPE_COUNT)); 66 EXPECT_FALSE(IsRealDataType(MODEL_TYPE_COUNT));
69 EXPECT_FALSE(IsRealDataType(TOP_LEVEL_FOLDER)); 67 EXPECT_FALSE(IsRealDataType(TOP_LEVEL_FOLDER));
70 EXPECT_TRUE(IsRealDataType(FIRST_REAL_MODEL_TYPE)); 68 EXPECT_TRUE(IsRealDataType(FIRST_REAL_MODEL_TYPE));
71 EXPECT_TRUE(IsRealDataType(BOOKMARKS)); 69 EXPECT_TRUE(IsRealDataType(BOOKMARKS));
72 EXPECT_TRUE(IsRealDataType(APPS)); 70 EXPECT_TRUE(IsRealDataType(APPS));
73 } 71 }
74 72
75 } // namespace 73 } // namespace
76 } // namespace syncer 74 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/entry_kernel.cc ('k') | sync/syncable/mutable_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698