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

Side by Side Diff: sync/protocol/proto_value_conversions_unittest.cc

Issue 143973006: New Sync datatype for Synced Notifications App Info (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: AppInfo: Rename fields in protobuf to match code better. Created 6 years, 10 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
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 // Keep this file in sync with the .proto files in this directory. 5 // Keep this file in sync with the .proto files in this directory.
6 6
7 #include "sync/protocol/proto_value_conversions.h" 7 #include "sync/protocol/proto_value_conversions.h"
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const T& specifics(T::default_instance()); 48 const T& specifics(T::default_instance());
49 scoped_ptr<base::DictionaryValue> value(specifics_to_value(specifics)); 49 scoped_ptr<base::DictionaryValue> value(specifics_to_value(specifics));
50 // We can't do much but make sure that this doesn't crash. 50 // We can't do much but make sure that this doesn't crash.
51 } 51 }
52 }; 52 };
53 53
54 TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) { 54 TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) {
55 // If this number changes, that means we added or removed a data 55 // If this number changes, that means we added or removed a data
56 // type. Don't forget to add a unit test for {New 56 // type. Don't forget to add a unit test for {New
57 // type}SpecificsToValue below. 57 // type}SpecificsToValue below.
58 EXPECT_EQ(31, MODEL_TYPE_COUNT); 58 EXPECT_EQ(32, MODEL_TYPE_COUNT);
59 59
60 // We'd also like to check if we changed any field in our messages. 60 // We'd also like to check if we changed any field in our messages.
61 // However, that's hard to do: sizeof could work, but it's 61 // However, that's hard to do: sizeof could work, but it's
62 // platform-dependent. default_instance().ByteSize() won't change 62 // platform-dependent. default_instance().ByteSize() won't change
63 // for most changes, since most of our fields are optional. So we 63 // for most changes, since most of our fields are optional. So we
64 // just settle for comments in the proto files. 64 // just settle for comments in the proto files.
65 } 65 }
66 66
67 TEST_F(ProtoValueConversionsTest, EncryptedDataToValue) { 67 TEST_F(ProtoValueConversionsTest, EncryptedDataToValue) {
68 TestSpecificsToValue(EncryptedDataToValue); 68 TestSpecificsToValue(EncryptedDataToValue);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 229 }
230 230
231 TEST_F(ProtoValueConversionsTest, SearchEngineSpecificsToValue) { 231 TEST_F(ProtoValueConversionsTest, SearchEngineSpecificsToValue) {
232 TestSpecificsToValue(SearchEngineSpecificsToValue); 232 TestSpecificsToValue(SearchEngineSpecificsToValue);
233 } 233 }
234 234
235 TEST_F(ProtoValueConversionsTest, SessionSpecificsToValue) { 235 TEST_F(ProtoValueConversionsTest, SessionSpecificsToValue) {
236 TestSpecificsToValue(SessionSpecificsToValue); 236 TestSpecificsToValue(SessionSpecificsToValue);
237 } 237 }
238 238
239 TEST_F(ProtoValueConversionsTest, SyncedNotificationAppInfoSpecificsToValue) {
240 TestSpecificsToValue(SyncedNotificationAppInfoSpecificsToValue);
241 }
242
239 TEST_F(ProtoValueConversionsTest, SyncedNotificationSpecificsToValue) { 243 TEST_F(ProtoValueConversionsTest, SyncedNotificationSpecificsToValue) {
240 TestSpecificsToValue(SyncedNotificationSpecificsToValue); 244 TestSpecificsToValue(SyncedNotificationSpecificsToValue);
241 } 245 }
242 246
243 TEST_F(ProtoValueConversionsTest, ThemeSpecificsToValue) { 247 TEST_F(ProtoValueConversionsTest, ThemeSpecificsToValue) {
244 TestSpecificsToValue(ThemeSpecificsToValue); 248 TestSpecificsToValue(ThemeSpecificsToValue);
245 } 249 }
246 250
247 TEST_F(ProtoValueConversionsTest, TypedUrlSpecificsToValue) { 251 TEST_F(ProtoValueConversionsTest, TypedUrlSpecificsToValue) {
248 TestSpecificsToValue(TypedUrlSpecificsToValue); 252 TestSpecificsToValue(TypedUrlSpecificsToValue);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 SET_FIELD(managed_user_setting); 287 SET_FIELD(managed_user_setting);
284 SET_FIELD(managed_user_shared_setting); 288 SET_FIELD(managed_user_shared_setting);
285 SET_FIELD(managed_user); 289 SET_FIELD(managed_user);
286 SET_FIELD(nigori); 290 SET_FIELD(nigori);
287 SET_FIELD(password); 291 SET_FIELD(password);
288 SET_FIELD(preference); 292 SET_FIELD(preference);
289 SET_FIELD(priority_preference); 293 SET_FIELD(priority_preference);
290 SET_FIELD(search_engine); 294 SET_FIELD(search_engine);
291 SET_FIELD(session); 295 SET_FIELD(session);
292 SET_FIELD(synced_notification); 296 SET_FIELD(synced_notification);
297 SET_FIELD(synced_notification_app_info);
293 SET_FIELD(theme); 298 SET_FIELD(theme);
294 SET_FIELD(typed_url); 299 SET_FIELD(typed_url);
295 300
296 #undef SET_FIELD 301 #undef SET_FIELD
297 302
298 scoped_ptr<base::DictionaryValue> value(EntitySpecificsToValue(specifics)); 303 scoped_ptr<base::DictionaryValue> value(EntitySpecificsToValue(specifics));
299 EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE - 304 EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE -
300 (LAST_PROXY_TYPE - FIRST_PROXY_TYPE + 1), 305 (LAST_PROXY_TYPE - FIRST_PROXY_TYPE + 1),
301 static_cast<int>(value->size())); 306 static_cast<int>(value->size()));
302 } 307 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), 367 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()),
363 "get_updates.entries")); 368 "get_updates.entries"));
364 } 369 }
365 370
366 TEST_F(ProtoValueConversionsTest, SyncAttachmentIdToValue) { 371 TEST_F(ProtoValueConversionsTest, SyncAttachmentIdToValue) {
367 TestSpecificsToValue(SyncAttachmentIdToValue); 372 TestSpecificsToValue(SyncAttachmentIdToValue);
368 } 373 }
369 374
370 } // namespace 375 } // namespace
371 } // namespace syncer 376 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698