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

Side by Side Diff: chrome/browser/sync/invalidations/invalidator_storage_unittest.cc

Issue 11229015: Add the InvalidationState struct to bundle local state about invalidations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 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 5
6 #include "chrome/browser/sync/invalidations/invalidator_storage.h" 6 #include "chrome/browser/sync/invalidations/invalidator_storage.h"
7 7
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/test/base/testing_pref_service.h" 12 #include "chrome/test/base/testing_pref_service.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 using syncer::InvalidationVersionMap; 16 using syncer::InvalidationStateMap;
17
18 namespace syncer {
19
20 bool operator==(const InvalidationState& lhs, const InvalidationState& rhs) {
21 return lhs.version == rhs.version;
22 }
23
24 } // namespace syncer
17 25
18 namespace browser_sync { 26 namespace browser_sync {
19 27
20 namespace { 28 namespace {
21 29
22 const char kSourceKey[] = "source"; 30 const char kSourceKey[] = "source";
23 const char kNameKey[] = "name"; 31 const char kNameKey[] = "name";
24 const char kMaxVersionKey[] = "max-version"; 32 const char kMaxVersionKey[] = "max-version";
25 33
26 const int kChromeSyncSourceId = 1004; 34 const int kChromeSyncSourceId = 1004;
(...skipping 18 matching lines...) Expand all
45 53
46 private: 54 private:
47 MessageLoop loop_; 55 MessageLoop loop_;
48 }; 56 };
49 57
50 // Set max versions for various keys and verify that they are written and read 58 // Set max versions for various keys and verify that they are written and read
51 // back correctly. 59 // back correctly.
52 TEST_F(InvalidatorStorageTest, MaxInvalidationVersions) { 60 TEST_F(InvalidatorStorageTest, MaxInvalidationVersions) {
53 InvalidatorStorage storage(&pref_service_); 61 InvalidatorStorage storage(&pref_service_);
54 62
55 InvalidationVersionMap expected_max_versions; 63 InvalidationStateMap expected_max_versions;
56 EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions()); 64 EXPECT_EQ(expected_max_versions, storage.GetAllInvalidationStates());
57 65
58 expected_max_versions[kBookmarksId_] = 2; 66 expected_max_versions[kBookmarksId_].version = 2;
59 storage.SetMaxVersion(kBookmarksId_, 2); 67 storage.SetMaxVersion(kBookmarksId_, 2);
60 EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions()); 68 EXPECT_EQ(expected_max_versions, storage.GetAllInvalidationStates());
61 69
62 expected_max_versions[kPreferencesId_] = 5; 70 expected_max_versions[kPreferencesId_].version = 5;
63 storage.SetMaxVersion(kPreferencesId_, 5); 71 storage.SetMaxVersion(kPreferencesId_, 5);
64 EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions()); 72 EXPECT_EQ(expected_max_versions, storage.GetAllInvalidationStates());
65 73
66 expected_max_versions[kAppNotificationsId_] = 3; 74 expected_max_versions[kAppNotificationsId_].version = 3;
67 storage.SetMaxVersion(kAppNotificationsId_, 3); 75 storage.SetMaxVersion(kAppNotificationsId_, 3);
68 EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions()); 76 EXPECT_EQ(expected_max_versions, storage.GetAllInvalidationStates());
69 77
70 expected_max_versions[kAppNotificationsId_] = 4; 78 expected_max_versions[kAppNotificationsId_].version = 4;
71 storage.SetMaxVersion(kAppNotificationsId_, 4); 79 storage.SetMaxVersion(kAppNotificationsId_, 4);
72 EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions()); 80 EXPECT_EQ(expected_max_versions, storage.GetAllInvalidationStates());
73 } 81 }
74 82
75 // Forgetting an entry should cause that entry to be deleted. 83 // Forgetting an entry should cause that entry to be deleted.
76 TEST_F(InvalidatorStorageTest, Forget) { 84 TEST_F(InvalidatorStorageTest, Forget) {
77 InvalidatorStorage storage(&pref_service_); 85 InvalidatorStorage storage(&pref_service_);
78 EXPECT_TRUE(storage.GetAllMaxVersions().empty()); 86 EXPECT_TRUE(storage.GetAllInvalidationStates().empty());
79 87
80 InvalidationVersionMap expected_max_versions; 88 InvalidationStateMap expected_max_versions;
81 expected_max_versions[kBookmarksId_] = 2; 89 expected_max_versions[kBookmarksId_].version = 2;
82 expected_max_versions[kPreferencesId_] = 5; 90 expected_max_versions[kPreferencesId_].version = 5;
83 storage.SetMaxVersion(kBookmarksId_, 2); 91 storage.SetMaxVersion(kBookmarksId_, 2);
84 storage.SetMaxVersion(kPreferencesId_, 5); 92 storage.SetMaxVersion(kPreferencesId_, 5);
85 EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions()); 93 EXPECT_EQ(expected_max_versions, storage.GetAllInvalidationStates());
86 94
87 expected_max_versions.erase(kPreferencesId_); 95 expected_max_versions.erase(kPreferencesId_);
88 syncer::ObjectIdSet to_forget; 96 syncer::ObjectIdSet to_forget;
89 to_forget.insert(kPreferencesId_); 97 to_forget.insert(kPreferencesId_);
90 storage.Forget(to_forget); 98 storage.Forget(to_forget);
91 EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions()); 99 EXPECT_EQ(expected_max_versions, storage.GetAllInvalidationStates());
92 } 100 }
93 101
94 // Clearing the storage should erase all version map entries and the bootstrap 102 // Clearing the storage should erase all version map entries and the bootstrap
95 // data. 103 // data.
96 TEST_F(InvalidatorStorageTest, Clear) { 104 TEST_F(InvalidatorStorageTest, Clear) {
97 InvalidatorStorage storage(&pref_service_); 105 InvalidatorStorage storage(&pref_service_);
98 EXPECT_TRUE(storage.GetAllMaxVersions().empty()); 106 EXPECT_TRUE(storage.GetAllInvalidationStates().empty());
99 EXPECT_TRUE(storage.GetBootstrapData().empty()); 107 EXPECT_TRUE(storage.GetBootstrapData().empty());
100 108
101 storage.SetBootstrapData("test"); 109 storage.SetBootstrapData("test");
102 EXPECT_EQ("test", storage.GetBootstrapData()); 110 EXPECT_EQ("test", storage.GetBootstrapData());
103 { 111 {
104 InvalidationVersionMap expected_max_versions; 112 InvalidationStateMap expected_max_versions;
105 expected_max_versions[kAppNotificationsId_] = 3; 113 expected_max_versions[kAppNotificationsId_].version = 3;
106 storage.SetMaxVersion(kAppNotificationsId_, 3); 114 storage.SetMaxVersion(kAppNotificationsId_, 3);
107 EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions()); 115 EXPECT_EQ(expected_max_versions, storage.GetAllInvalidationStates());
108 } 116 }
109 117
110 storage.Clear(); 118 storage.Clear();
111 119
112 EXPECT_TRUE(storage.GetAllMaxVersions().empty()); 120 EXPECT_TRUE(storage.GetAllInvalidationStates().empty());
113 EXPECT_TRUE(storage.GetBootstrapData().empty()); 121 EXPECT_TRUE(storage.GetBootstrapData().empty());
114 } 122 }
115 123
116 TEST_F(InvalidatorStorageTest, SerializeEmptyMap) { 124 TEST_F(InvalidatorStorageTest, SerializeEmptyMap) {
117 InvalidationVersionMap empty_map; 125 InvalidationStateMap empty_map;
118 base::ListValue list; 126 base::ListValue list;
119 InvalidatorStorage::SerializeToList(empty_map, &list); 127 InvalidatorStorage::SerializeToList(empty_map, &list);
120 EXPECT_TRUE(list.empty()); 128 EXPECT_TRUE(list.empty());
121 } 129 }
122 130
123 // Make sure we don't choke on a variety of malformed input. 131 // Make sure we don't choke on a variety of malformed input.
124 TEST_F(InvalidatorStorageTest, DeserializeFromListInvalidFormat) { 132 TEST_F(InvalidatorStorageTest, DeserializeFromListInvalidFormat) {
125 InvalidationVersionMap map; 133 InvalidationStateMap map;
126 base::ListValue list_with_invalid_format; 134 base::ListValue list_with_invalid_format;
127 DictionaryValue* value; 135 DictionaryValue* value;
128 136
129 // The various cases below use distinct values to make it easier to track down 137 // The various cases below use distinct values to make it easier to track down
130 // failures. 138 // failures.
131 value = new DictionaryValue(); 139 value = new DictionaryValue();
132 list_with_invalid_format.Append(value); 140 list_with_invalid_format.Append(value);
133 141
134 value = new DictionaryValue(); 142 value = new DictionaryValue();
135 value->SetString("completely", "invalid"); 143 value->SetString("completely", "invalid");
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 invalidation::ObjectId valid_id(42, "this should work"); 189 invalidation::ObjectId valid_id(42, "this should work");
182 value = new DictionaryValue(); 190 value = new DictionaryValue();
183 value->SetString(kSourceKey, "42"); 191 value->SetString(kSourceKey, "42");
184 value->SetString(kNameKey, valid_id.name()); 192 value->SetString(kNameKey, valid_id.name());
185 value->SetString(kMaxVersionKey, "20"); 193 value->SetString(kMaxVersionKey, "20");
186 list_with_invalid_format.Append(value); 194 list_with_invalid_format.Append(value);
187 195
188 InvalidatorStorage::DeserializeFromList(list_with_invalid_format, &map); 196 InvalidatorStorage::DeserializeFromList(list_with_invalid_format, &map);
189 197
190 EXPECT_EQ(1U, map.size()); 198 EXPECT_EQ(1U, map.size());
191 EXPECT_EQ(20, map[valid_id]); 199 EXPECT_EQ(20, map[valid_id].version);
192 } 200 }
193 201
194 // Tests behavior when there are duplicate entries for a single key. The value 202 // Tests behavior when there are duplicate entries for a single key. The value
195 // of the last entry with that key should be used in the version map. 203 // of the last entry with that key should be used in the version map.
196 TEST_F(InvalidatorStorageTest, DeserializeFromListWithDuplicates) { 204 TEST_F(InvalidatorStorageTest, DeserializeFromListWithDuplicates) {
197 InvalidationVersionMap map; 205 InvalidationStateMap map;
198 base::ListValue list; 206 base::ListValue list;
199 DictionaryValue* value; 207 DictionaryValue* value;
200 208
201 value = new DictionaryValue(); 209 value = new DictionaryValue();
202 value->SetString(kSourceKey, base::IntToString(kBookmarksId_.source())); 210 value->SetString(kSourceKey, base::IntToString(kBookmarksId_.source()));
203 value->SetString(kNameKey, kBookmarksId_.name()); 211 value->SetString(kNameKey, kBookmarksId_.name());
204 value->SetString(kMaxVersionKey, "20"); 212 value->SetString(kMaxVersionKey, "20");
205 list.Append(value); 213 list.Append(value);
206 value = new DictionaryValue(); 214 value = new DictionaryValue();
207 value->SetString(kSourceKey, base::IntToString(kAutofillId_.source())); 215 value->SetString(kSourceKey, base::IntToString(kAutofillId_.source()));
208 value->SetString(kNameKey, kAutofillId_.name()); 216 value->SetString(kNameKey, kAutofillId_.name());
209 value->SetString(kMaxVersionKey, "10"); 217 value->SetString(kMaxVersionKey, "10");
210 list.Append(value); 218 list.Append(value);
211 value = new DictionaryValue(); 219 value = new DictionaryValue();
212 value->SetString(kSourceKey, base::IntToString(kBookmarksId_.source())); 220 value->SetString(kSourceKey, base::IntToString(kBookmarksId_.source()));
213 value->SetString(kNameKey, kBookmarksId_.name()); 221 value->SetString(kNameKey, kBookmarksId_.name());
214 value->SetString(kMaxVersionKey, "15"); 222 value->SetString(kMaxVersionKey, "15");
215 list.Append(value); 223 list.Append(value);
216 224
217 InvalidatorStorage::DeserializeFromList(list, &map); 225 InvalidatorStorage::DeserializeFromList(list, &map);
218 EXPECT_EQ(2U, map.size()); 226 EXPECT_EQ(2U, map.size());
219 EXPECT_EQ(10, map[kAutofillId_]); 227 EXPECT_EQ(10, map[kAutofillId_].version);
220 EXPECT_EQ(15, map[kBookmarksId_]); 228 EXPECT_EQ(15, map[kBookmarksId_].version);
221 } 229 }
222 230
223 TEST_F(InvalidatorStorageTest, DeserializeFromEmptyList) { 231 TEST_F(InvalidatorStorageTest, DeserializeFromEmptyList) {
224 InvalidationVersionMap map; 232 InvalidationStateMap map;
225 base::ListValue list; 233 base::ListValue list;
226 InvalidatorStorage::DeserializeFromList(list, &map); 234 InvalidatorStorage::DeserializeFromList(list, &map);
227 EXPECT_TRUE(map.empty()); 235 EXPECT_TRUE(map.empty());
228 } 236 }
229 237
230 // Tests that deserializing a well-formed value results in the expected version 238 // Tests that deserializing a well-formed value results in the expected version
231 // map. 239 // map.
232 TEST_F(InvalidatorStorageTest, DeserializeFromListBasic) { 240 TEST_F(InvalidatorStorageTest, DeserializeFromListBasic) {
233 InvalidationVersionMap map; 241 InvalidationStateMap map;
234 base::ListValue list; 242 base::ListValue list;
235 DictionaryValue* value; 243 DictionaryValue* value;
236 244
237 value = new DictionaryValue(); 245 value = new DictionaryValue();
238 value->SetString(kSourceKey, base::IntToString(kAutofillId_.source())); 246 value->SetString(kSourceKey, base::IntToString(kAutofillId_.source()));
239 value->SetString(kNameKey, kAutofillId_.name()); 247 value->SetString(kNameKey, kAutofillId_.name());
240 value->SetString(kMaxVersionKey, "10"); 248 value->SetString(kMaxVersionKey, "10");
241 list.Append(value); 249 list.Append(value);
242 value = new DictionaryValue(); 250 value = new DictionaryValue();
243 value->SetString(kSourceKey, base::IntToString(kBookmarksId_.source())); 251 value->SetString(kSourceKey, base::IntToString(kBookmarksId_.source()));
244 value->SetString(kNameKey, kBookmarksId_.name()); 252 value->SetString(kNameKey, kBookmarksId_.name());
245 value->SetString(kMaxVersionKey, "15"); 253 value->SetString(kMaxVersionKey, "15");
246 list.Append(value); 254 list.Append(value);
247 255
248 InvalidatorStorage::DeserializeFromList(list, &map); 256 InvalidatorStorage::DeserializeFromList(list, &map);
249 EXPECT_EQ(2U, map.size()); 257 EXPECT_EQ(2U, map.size());
250 EXPECT_EQ(10, map[kAutofillId_]); 258 EXPECT_EQ(10, map[kAutofillId_].version);
251 EXPECT_EQ(15, map[kBookmarksId_]); 259 EXPECT_EQ(15, map[kBookmarksId_].version);
252 } 260 }
253 261
254 // Tests for legacy deserialization code. 262 // Tests for legacy deserialization code.
255 TEST_F(InvalidatorStorageTest, DeserializeMapOutOfRange) { 263 TEST_F(InvalidatorStorageTest, DeserializeMapOutOfRange) {
256 InvalidationVersionMap map; 264 InvalidationStateMap map;
257 base::DictionaryValue dict_with_out_of_range_type; 265 base::DictionaryValue dict_with_out_of_range_type;
258 266
259 dict_with_out_of_range_type.SetString( 267 dict_with_out_of_range_type.SetString(
260 base::IntToString(syncer::TOP_LEVEL_FOLDER), "100"); 268 base::IntToString(syncer::TOP_LEVEL_FOLDER), "100");
261 dict_with_out_of_range_type.SetString( 269 dict_with_out_of_range_type.SetString(
262 base::IntToString(syncer::BOOKMARKS), "5"); 270 base::IntToString(syncer::BOOKMARKS), "5");
263 271
264 InvalidatorStorage::DeserializeMap(&dict_with_out_of_range_type, &map); 272 InvalidatorStorage::DeserializeMap(&dict_with_out_of_range_type, &map);
265 273
266 EXPECT_EQ(1U, map.size()); 274 EXPECT_EQ(1U, map.size());
267 EXPECT_EQ(5, map[kBookmarksId_]); 275 EXPECT_EQ(5, map[kBookmarksId_].version);
268 } 276 }
269 277
270 TEST_F(InvalidatorStorageTest, DeserializeMapInvalidFormat) { 278 TEST_F(InvalidatorStorageTest, DeserializeMapInvalidFormat) {
271 InvalidationVersionMap map; 279 InvalidationStateMap map;
272 base::DictionaryValue dict_with_invalid_format; 280 base::DictionaryValue dict_with_invalid_format;
273 281
274 dict_with_invalid_format.SetString("whoops", "5"); 282 dict_with_invalid_format.SetString("whoops", "5");
275 dict_with_invalid_format.SetString("ohnoes", "whoops"); 283 dict_with_invalid_format.SetString("ohnoes", "whoops");
276 dict_with_invalid_format.SetString( 284 dict_with_invalid_format.SetString(
277 base::IntToString(syncer::BOOKMARKS), "ohnoes"); 285 base::IntToString(syncer::BOOKMARKS), "ohnoes");
278 dict_with_invalid_format.SetString( 286 dict_with_invalid_format.SetString(
279 base::IntToString(syncer::AUTOFILL), "10"); 287 base::IntToString(syncer::AUTOFILL), "10");
280 288
281 InvalidatorStorage::DeserializeMap(&dict_with_invalid_format, &map); 289 InvalidatorStorage::DeserializeMap(&dict_with_invalid_format, &map);
282 290
283 EXPECT_EQ(1U, map.size()); 291 EXPECT_EQ(1U, map.size());
284 EXPECT_EQ(10, map[kAutofillId_]); 292 EXPECT_EQ(10, map[kAutofillId_].version);
285 } 293 }
286 294
287 TEST_F(InvalidatorStorageTest, DeserializeMapEmptyDictionary) { 295 TEST_F(InvalidatorStorageTest, DeserializeMapEmptyDictionary) {
288 InvalidationVersionMap map; 296 InvalidationStateMap map;
289 base::DictionaryValue dict; 297 base::DictionaryValue dict;
290 InvalidatorStorage::DeserializeMap(&dict, &map); 298 InvalidatorStorage::DeserializeMap(&dict, &map);
291 EXPECT_TRUE(map.empty()); 299 EXPECT_TRUE(map.empty());
292 } 300 }
293 301
294 TEST_F(InvalidatorStorageTest, DeserializeMapBasic) { 302 TEST_F(InvalidatorStorageTest, DeserializeMapBasic) {
295 InvalidationVersionMap map; 303 InvalidationStateMap map;
296 base::DictionaryValue dict; 304 base::DictionaryValue dict;
297 305
298 dict.SetString(base::IntToString(syncer::AUTOFILL), "10"); 306 dict.SetString(base::IntToString(syncer::AUTOFILL), "10");
299 dict.SetString(base::IntToString(syncer::BOOKMARKS), "15"); 307 dict.SetString(base::IntToString(syncer::BOOKMARKS), "15");
300 308
301 InvalidatorStorage::DeserializeMap(&dict, &map); 309 InvalidatorStorage::DeserializeMap(&dict, &map);
302 EXPECT_EQ(2U, map.size()); 310 EXPECT_EQ(2U, map.size());
303 EXPECT_EQ(10, map[kAutofillId_]); 311 EXPECT_EQ(10, map[kAutofillId_].version);
304 EXPECT_EQ(15, map[kBookmarksId_]); 312 EXPECT_EQ(15, map[kBookmarksId_].version);
305 } 313 }
306 314
307 // Test that the migration code for the legacy preference works as expected. 315 // Test that the migration code for the legacy preference works as expected.
308 // Migration should happen on construction of InvalidatorStorage. 316 // Migration should happen on construction of InvalidatorStorage.
309 TEST_F(InvalidatorStorageTest, MigrateLegacyPreferences) { 317 TEST_F(InvalidatorStorageTest, MigrateLegacyPreferences) {
310 base::DictionaryValue* legacy_dict = new DictionaryValue; 318 base::DictionaryValue* legacy_dict = new DictionaryValue;
311 legacy_dict->SetString(base::IntToString(syncer::AUTOFILL), "10"); 319 legacy_dict->SetString(base::IntToString(syncer::AUTOFILL), "10");
312 legacy_dict->SetString(base::IntToString(syncer::BOOKMARKS), "32"); 320 legacy_dict->SetString(base::IntToString(syncer::BOOKMARKS), "32");
313 legacy_dict->SetString(base::IntToString(syncer::PREFERENCES), "54"); 321 legacy_dict->SetString(base::IntToString(syncer::PREFERENCES), "54");
314 pref_service_.SetUserPref(prefs::kSyncMaxInvalidationVersions, legacy_dict); 322 pref_service_.SetUserPref(prefs::kSyncMaxInvalidationVersions, legacy_dict);
315 InvalidatorStorage storage(&pref_service_); 323 InvalidatorStorage storage(&pref_service_);
316 324
317 // Legacy pref should be cleared. 325 // Legacy pref should be cleared.
318 const base::DictionaryValue* dict = 326 const base::DictionaryValue* dict =
319 pref_service_.GetDictionary(prefs::kSyncMaxInvalidationVersions); 327 pref_service_.GetDictionary(prefs::kSyncMaxInvalidationVersions);
320 EXPECT_TRUE(dict->empty()); 328 EXPECT_TRUE(dict->empty());
321 329
322 // Validate the new pref is set correctly. 330 // Validate the new pref is set correctly.
323 InvalidationVersionMap map; 331 InvalidationStateMap map;
324 const base::ListValue* list = 332 const base::ListValue* list =
325 pref_service_.GetList(prefs::kInvalidatorMaxInvalidationVersions); 333 pref_service_.GetList(prefs::kInvalidatorMaxInvalidationVersions);
326 InvalidatorStorage::DeserializeFromList(*list, &map); 334 InvalidatorStorage::DeserializeFromList(*list, &map);
327 335
328 EXPECT_EQ(3U, map.size()); 336 EXPECT_EQ(3U, map.size());
329 EXPECT_EQ(10, map[kAutofillId_]); 337 EXPECT_EQ(10, map[kAutofillId_].version);
330 EXPECT_EQ(32, map[kBookmarksId_]); 338 EXPECT_EQ(32, map[kBookmarksId_].version);
331 EXPECT_EQ(54, map[kPreferencesId_]); 339 EXPECT_EQ(54, map[kPreferencesId_].version);
332 } 340 }
333 341
334 TEST_F(InvalidatorStorageTest, SetGetBootstrapData) { 342 TEST_F(InvalidatorStorageTest, SetGetBootstrapData) {
335 InvalidatorStorage storage(&pref_service_); 343 InvalidatorStorage storage(&pref_service_);
336 const std::string mess("n\0tK\0\0l\344", 8); 344 const std::string mess("n\0tK\0\0l\344", 8);
337 ASSERT_FALSE(IsStringUTF8(mess)); 345 ASSERT_FALSE(IsStringUTF8(mess));
338 346
339 storage.SetBootstrapData(mess); 347 storage.SetBootstrapData(mess);
340 EXPECT_EQ(mess, storage.GetBootstrapData()); 348 EXPECT_EQ(mess, storage.GetBootstrapData());
341 } 349 }
342 350
343 } // namespace browser_sync 351 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/invalidations/invalidator_storage.cc ('k') | sync/notifier/fake_invalidation_state_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698