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

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

Issue 754963004: Add a datatype for supervised user whitelists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: review Created 6 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
« no previous file with comments | « sync/protocol/proto_value_conversions.cc ('k') | sync/protocol/sync.proto » ('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 // 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"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "sync/internal_api/public/base/model_type.h" 13 #include "sync/internal_api/public/base/model_type.h"
14 #include "sync/protocol/app_notification_specifics.pb.h" 14 #include "sync/protocol/app_notification_specifics.pb.h"
15 #include "sync/protocol/app_setting_specifics.pb.h" 15 #include "sync/protocol/app_setting_specifics.pb.h"
16 #include "sync/protocol/app_specifics.pb.h" 16 #include "sync/protocol/app_specifics.pb.h"
17 #include "sync/protocol/autofill_specifics.pb.h" 17 #include "sync/protocol/autofill_specifics.pb.h"
18 #include "sync/protocol/bookmark_specifics.pb.h" 18 #include "sync/protocol/bookmark_specifics.pb.h"
19 #include "sync/protocol/device_info_specifics.pb.h" 19 #include "sync/protocol/device_info_specifics.pb.h"
20 #include "sync/protocol/encryption.pb.h" 20 #include "sync/protocol/encryption.pb.h"
21 #include "sync/protocol/experiments_specifics.pb.h" 21 #include "sync/protocol/experiments_specifics.pb.h"
22 #include "sync/protocol/extension_setting_specifics.pb.h" 22 #include "sync/protocol/extension_setting_specifics.pb.h"
23 #include "sync/protocol/extension_specifics.pb.h" 23 #include "sync/protocol/extension_specifics.pb.h"
24 #include "sync/protocol/favicon_image_specifics.pb.h" 24 #include "sync/protocol/favicon_image_specifics.pb.h"
25 #include "sync/protocol/favicon_tracking_specifics.pb.h" 25 #include "sync/protocol/favicon_tracking_specifics.pb.h"
26 #include "sync/protocol/managed_user_setting_specifics.pb.h" 26 #include "sync/protocol/managed_user_setting_specifics.pb.h"
27 #include "sync/protocol/managed_user_shared_setting_specifics.pb.h" 27 #include "sync/protocol/managed_user_shared_setting_specifics.pb.h"
28 #include "sync/protocol/managed_user_specifics.pb.h" 28 #include "sync/protocol/managed_user_specifics.pb.h"
29 #include "sync/protocol/managed_user_whitelist_specifics.pb.h"
29 #include "sync/protocol/nigori_specifics.pb.h" 30 #include "sync/protocol/nigori_specifics.pb.h"
30 #include "sync/protocol/password_specifics.pb.h" 31 #include "sync/protocol/password_specifics.pb.h"
31 #include "sync/protocol/preference_specifics.pb.h" 32 #include "sync/protocol/preference_specifics.pb.h"
32 #include "sync/protocol/priority_preference_specifics.pb.h" 33 #include "sync/protocol/priority_preference_specifics.pb.h"
33 #include "sync/protocol/search_engine_specifics.pb.h" 34 #include "sync/protocol/search_engine_specifics.pb.h"
34 #include "sync/protocol/session_specifics.pb.h" 35 #include "sync/protocol/session_specifics.pb.h"
35 #include "sync/protocol/sync.pb.h" 36 #include "sync/protocol/sync.pb.h"
36 #include "sync/protocol/theme_specifics.pb.h" 37 #include "sync/protocol/theme_specifics.pb.h"
37 #include "sync/protocol/typed_url_specifics.pb.h" 38 #include "sync/protocol/typed_url_specifics.pb.h"
38 #include "sync/protocol/wifi_credential_specifics.pb.h" 39 #include "sync/protocol/wifi_credential_specifics.pb.h"
(...skipping 10 matching lines...) Expand all
49 const T& specifics(T::default_instance()); 50 const T& specifics(T::default_instance());
50 scoped_ptr<base::DictionaryValue> value(specifics_to_value(specifics)); 51 scoped_ptr<base::DictionaryValue> value(specifics_to_value(specifics));
51 // We can't do much but make sure that this doesn't crash. 52 // We can't do much but make sure that this doesn't crash.
52 } 53 }
53 }; 54 };
54 55
55 TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) { 56 TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) {
56 // If this number changes, that means we added or removed a data 57 // If this number changes, that means we added or removed a data
57 // type. Don't forget to add a unit test for {New 58 // type. Don't forget to add a unit test for {New
58 // type}SpecificsToValue below. 59 // type}SpecificsToValue below.
59 EXPECT_EQ(33, MODEL_TYPE_COUNT); 60 EXPECT_EQ(34, MODEL_TYPE_COUNT);
60 61
61 // We'd also like to check if we changed any field in our messages. 62 // We'd also like to check if we changed any field in our messages.
62 // However, that's hard to do: sizeof could work, but it's 63 // However, that's hard to do: sizeof could work, but it's
63 // platform-dependent. default_instance().ByteSize() won't change 64 // platform-dependent. default_instance().ByteSize() won't change
64 // for most changes, since most of our fields are optional. So we 65 // for most changes, since most of our fields are optional. So we
65 // just settle for comments in the proto files. 66 // just settle for comments in the proto files.
66 } 67 }
67 68
68 TEST_F(ProtoValueConversionsTest, EncryptedDataToValue) { 69 TEST_F(ProtoValueConversionsTest, EncryptedDataToValue) {
69 TestSpecificsToValue(EncryptedDataToValue); 70 TestSpecificsToValue(EncryptedDataToValue);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 215 }
215 216
216 TEST_F(ProtoValueConversionsTest, ManagedUserSpecificsToValue) { 217 TEST_F(ProtoValueConversionsTest, ManagedUserSpecificsToValue) {
217 TestSpecificsToValue(ManagedUserSpecificsToValue); 218 TestSpecificsToValue(ManagedUserSpecificsToValue);
218 } 219 }
219 220
220 TEST_F(ProtoValueConversionsTest, ManagedUserSharedSettingSpecificsToValue) { 221 TEST_F(ProtoValueConversionsTest, ManagedUserSharedSettingSpecificsToValue) {
221 TestSpecificsToValue(ManagedUserSharedSettingSpecificsToValue); 222 TestSpecificsToValue(ManagedUserSharedSettingSpecificsToValue);
222 } 223 }
223 224
225 TEST_F(ProtoValueConversionsTest, ManagedUserWhitelistSpecificsToValue) {
226 TestSpecificsToValue(ManagedUserWhitelistSpecificsToValue);
227 }
228
224 TEST_F(ProtoValueConversionsTest, NigoriSpecificsToValue) { 229 TEST_F(ProtoValueConversionsTest, NigoriSpecificsToValue) {
225 TestSpecificsToValue(NigoriSpecificsToValue); 230 TestSpecificsToValue(NigoriSpecificsToValue);
226 } 231 }
227 232
228 TEST_F(ProtoValueConversionsTest, PasswordSpecificsToValue) { 233 TEST_F(ProtoValueConversionsTest, PasswordSpecificsToValue) {
229 TestSpecificsToValue(PasswordSpecificsToValue); 234 TestSpecificsToValue(PasswordSpecificsToValue);
230 } 235 }
231 236
232 TEST_F(ProtoValueConversionsTest, PreferenceSpecificsToValue) { 237 TEST_F(ProtoValueConversionsTest, PreferenceSpecificsToValue) {
233 TestSpecificsToValue(PreferenceSpecificsToValue); 238 TestSpecificsToValue(PreferenceSpecificsToValue);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 SET_FIELD(device_info); 293 SET_FIELD(device_info);
289 SET_FIELD(dictionary); 294 SET_FIELD(dictionary);
290 SET_FIELD(experiments); 295 SET_FIELD(experiments);
291 SET_FIELD(extension); 296 SET_FIELD(extension);
292 SET_FIELD(extension_setting); 297 SET_FIELD(extension_setting);
293 SET_FIELD(favicon_image); 298 SET_FIELD(favicon_image);
294 SET_FIELD(favicon_tracking); 299 SET_FIELD(favicon_tracking);
295 SET_FIELD(history_delete_directive); 300 SET_FIELD(history_delete_directive);
296 SET_FIELD(managed_user_setting); 301 SET_FIELD(managed_user_setting);
297 SET_FIELD(managed_user_shared_setting); 302 SET_FIELD(managed_user_shared_setting);
303 SET_FIELD(managed_user_whitelist);
298 SET_FIELD(managed_user); 304 SET_FIELD(managed_user);
299 SET_FIELD(nigori); 305 SET_FIELD(nigori);
300 SET_FIELD(password); 306 SET_FIELD(password);
301 SET_FIELD(preference); 307 SET_FIELD(preference);
302 SET_FIELD(priority_preference); 308 SET_FIELD(priority_preference);
303 SET_FIELD(search_engine); 309 SET_FIELD(search_engine);
304 SET_FIELD(session); 310 SET_FIELD(session);
305 SET_FIELD(synced_notification); 311 SET_FIELD(synced_notification);
306 SET_FIELD(synced_notification_app_info); 312 SET_FIELD(synced_notification_app_info);
307 SET_FIELD(theme); 313 SET_FIELD(theme);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), 383 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()),
378 "get_updates.entries")); 384 "get_updates.entries"));
379 } 385 }
380 386
381 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { 387 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) {
382 TestSpecificsToValue(AttachmentIdProtoToValue); 388 TestSpecificsToValue(AttachmentIdProtoToValue);
383 } 389 }
384 390
385 } // namespace 391 } // namespace
386 } // namespace syncer 392 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/protocol/proto_value_conversions.cc ('k') | sync/protocol/sync.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698