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

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

Issue 11490018: [Sync] Handle invalid specifics field numbers gracefully (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 TEST_F(ModelTypeTest, IsRealDataType) { 64 TEST_F(ModelTypeTest, IsRealDataType) {
65 EXPECT_FALSE(IsRealDataType(UNSPECIFIED)); 65 EXPECT_FALSE(IsRealDataType(UNSPECIFIED));
66 EXPECT_FALSE(IsRealDataType(MODEL_TYPE_COUNT)); 66 EXPECT_FALSE(IsRealDataType(MODEL_TYPE_COUNT));
67 EXPECT_FALSE(IsRealDataType(TOP_LEVEL_FOLDER)); 67 EXPECT_FALSE(IsRealDataType(TOP_LEVEL_FOLDER));
68 EXPECT_TRUE(IsRealDataType(FIRST_REAL_MODEL_TYPE)); 68 EXPECT_TRUE(IsRealDataType(FIRST_REAL_MODEL_TYPE));
69 EXPECT_TRUE(IsRealDataType(BOOKMARKS)); 69 EXPECT_TRUE(IsRealDataType(BOOKMARKS));
70 EXPECT_TRUE(IsRealDataType(APPS)); 70 EXPECT_TRUE(IsRealDataType(APPS));
71 } 71 }
72 72
73 // Make sure we can convert ModelTypes to and from specifics field
74 // numbers.
75 TEST_F(ModelTypeTest, ModelTypeToFromSpecificsFieldNumber) {
76 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
77 ModelType model_type = ModelTypeFromInt(i);
78 int field_number = GetSpecificsFieldNumberFromModelType(model_type);
79 EXPECT_EQ(model_type,
80 GetModelTypeFromSpecificsFieldNumber(field_number));
81 }
82 }
83
84 TEST_F(ModelTypeTest, ModelTypeOfInvalidSpecificsFieldNumber) {
85 EXPECT_EQ(UNSPECIFIED, GetModelTypeFromSpecificsFieldNumber(0));
86 }
87
73 } // namespace 88 } // namespace
74 } // namespace syncer 89 } // namespace syncer
OLDNEW
« sync/engine/syncer_proto_util.cc ('K') | « sync/syncable/model_type.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698