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

Side by Side Diff: chrome/browser/extensions/api/storage/settings_sync_unittest.cc

Issue 1141963002: Remove a bunch of DeepCopy() calls in the chrome.storage API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 7 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/memory/linked_ptr.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
11 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
12 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" 13 #include "chrome/browser/extensions/api/storage/settings_sync_util.h"
13 #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h" 14 #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
14 #include "chrome/browser/extensions/api/storage/syncable_settings_storage.h" 15 #include "chrome/browser/extensions/api/storage/syncable_settings_storage.h"
15 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
16 #include "content/public/test/test_browser_thread.h" 17 #include "content/public/test/test_browser_thread.h"
17 #include "extensions/browser/api/storage/leveldb_settings_storage_factory.h" 18 #include "extensions/browser/api/storage/leveldb_settings_storage_factory.h"
18 #include "extensions/browser/api/storage/settings_storage_factory.h" 19 #include "extensions/browser/api/storage/settings_storage_factory.h"
(...skipping 16 matching lines...) Expand all
35 36
36 namespace extensions { 37 namespace extensions {
37 38
38 namespace util = settings_test_util; 39 namespace util = settings_test_util;
39 40
40 namespace { 41 namespace {
41 42
42 // To save typing ValueStore::DEFAULTS everywhere. 43 // To save typing ValueStore::DEFAULTS everywhere.
43 const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS; 44 const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS;
44 45
46 // More saving typing. Maps extension IDs to a list of sync changes for that
47 // extension.
48 using SettingSyncDataMultimap =
49 std::map<std::string, linked_ptr<SettingSyncDataList>>;
50
45 // Gets the pretty-printed JSON for a value. 51 // Gets the pretty-printed JSON for a value.
46 static std::string GetJson(const base::Value& value) { 52 static std::string GetJson(const base::Value& value) {
47 std::string json; 53 std::string json;
48 base::JSONWriter::WriteWithOptions(&value, 54 base::JSONWriter::WriteWithOptions(&value,
49 base::JSONWriter::OPTIONS_PRETTY_PRINT, 55 base::JSONWriter::OPTIONS_PRETTY_PRINT,
50 &json); 56 &json);
51 return json; 57 return json;
52 } 58 }
53 59
54 // Returns whether two Values are equal. 60 // Returns whether two Values are equal.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 const syncer::SyncChangeList& change_list) override { 106 const syncer::SyncChangeList& change_list) override {
101 if (fail_all_requests_) { 107 if (fail_all_requests_) {
102 return syncer::SyncError( 108 return syncer::SyncError(
103 FROM_HERE, 109 FROM_HERE,
104 syncer::SyncError::DATATYPE_ERROR, 110 syncer::SyncError::DATATYPE_ERROR,
105 "MockSyncChangeProcessor: configured to fail", 111 "MockSyncChangeProcessor: configured to fail",
106 change_list[0].sync_data().GetDataType()); 112 change_list[0].sync_data().GetDataType());
107 } 113 }
108 for (syncer::SyncChangeList::const_iterator it = change_list.begin(); 114 for (syncer::SyncChangeList::const_iterator it = change_list.begin();
109 it != change_list.end(); ++it) { 115 it != change_list.end(); ++it) {
110 changes_.push_back(SettingSyncData(*it)); 116 changes_.push_back(new SettingSyncData(*it));
111 } 117 }
112 return syncer::SyncError(); 118 return syncer::SyncError();
113 } 119 }
114 120
115 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override { 121 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override {
116 return syncer::SyncDataList(); 122 return syncer::SyncDataList();
117 } 123 }
118 124
119 // Mock methods. 125 // Mock methods.
120 126
121 const SettingSyncDataList& changes() { return changes_; } 127 const SettingSyncDataList& changes() { return changes_; }
122 128
123 void ClearChanges() { 129 void ClearChanges() {
124 changes_.clear(); 130 changes_.clear();
125 } 131 }
126 132
127 void set_fail_all_requests(bool fail_all_requests) { 133 void set_fail_all_requests(bool fail_all_requests) {
128 fail_all_requests_ = fail_all_requests; 134 fail_all_requests_ = fail_all_requests;
129 } 135 }
130 136
131 // Returns the only change for a given extension setting. If there is not 137 // Returns the only change for a given extension setting. If there is not
132 // exactly 1 change for that key, a test assertion will fail. 138 // exactly 1 change for that key, a test assertion will fail.
133 SettingSyncData GetOnlyChange( 139 SettingSyncData* GetOnlyChange(const std::string& extension_id,
134 const std::string& extension_id, const std::string& key) { 140 const std::string& key) {
135 SettingSyncDataList matching_changes; 141 std::vector<SettingSyncData*> matching_changes;
136 for (SettingSyncDataList::iterator it = changes_.begin(); 142 for (SettingSyncDataList::iterator it = changes_.begin();
137 it != changes_.end(); ++it) { 143 it != changes_.end(); ++it) {
138 if (it->extension_id() == extension_id && it->key() == key) { 144 if ((*it)->extension_id() == extension_id && (*it)->key() == key) {
139 matching_changes.push_back(*it); 145 matching_changes.push_back(*it);
140 } 146 }
141 } 147 }
142 if (matching_changes.empty()) { 148 if (matching_changes.empty()) {
143 ADD_FAILURE() << "No matching changes for " << extension_id << "/" << 149 ADD_FAILURE() << "No matching changes for " << extension_id << "/" <<
144 key << " (out of " << changes_.size() << ")"; 150 key << " (out of " << changes_.size() << ")";
145 return SettingSyncData(syncer::SyncChange::ACTION_INVALID, 151 return nullptr;
146 std::string(),
147 std::string(),
148 scoped_ptr<base::Value>(
149 new base::DictionaryValue()));
150 } 152 }
151 if (matching_changes.size() != 1u) { 153 if (matching_changes.size() != 1u) {
152 ADD_FAILURE() << matching_changes.size() << " matching changes for " << 154 ADD_FAILURE() << matching_changes.size() << " matching changes for " <<
153 extension_id << "/" << key << " (out of " << changes_.size() << ")"; 155 extension_id << "/" << key << " (out of " << changes_.size() << ")";
154 } 156 }
155 return matching_changes[0]; 157 return matching_changes[0];
156 } 158 }
157 159
158 private: 160 private:
159 SettingSyncDataList changes_; 161 SettingSyncDataList changes_;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // Gets the syncer::SyncableService for the given sync type. 239 // Gets the syncer::SyncableService for the given sync type.
238 syncer::SyncableService* GetSyncableService(syncer::ModelType model_type) { 240 syncer::SyncableService* GetSyncableService(syncer::ModelType model_type) {
239 base::MessageLoop::current()->RunUntilIdle(); 241 base::MessageLoop::current()->RunUntilIdle();
240 SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>( 242 SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>(
241 frontend_->GetValueStoreCache(settings_namespace::SYNC)); 243 frontend_->GetValueStoreCache(settings_namespace::SYNC));
242 return sync_cache->GetSyncableService(model_type); 244 return sync_cache->GetSyncableService(model_type);
243 } 245 }
244 246
245 // Gets all the sync data from the SyncableService for a sync type as a map 247 // Gets all the sync data from the SyncableService for a sync type as a map
246 // from extension id to its sync data. 248 // from extension id to its sync data.
247 std::map<std::string, SettingSyncDataList> GetAllSyncData( 249 SettingSyncDataMultimap GetAllSyncData(syncer::ModelType model_type) {
248 syncer::ModelType model_type) {
249 syncer::SyncDataList as_list = 250 syncer::SyncDataList as_list =
250 GetSyncableService(model_type)->GetAllSyncData(model_type); 251 GetSyncableService(model_type)->GetAllSyncData(model_type);
251 std::map<std::string, SettingSyncDataList> as_map; 252 SettingSyncDataMultimap as_map;
252 for (syncer::SyncDataList::iterator it = as_list.begin(); 253 for (syncer::SyncDataList::iterator it = as_list.begin();
253 it != as_list.end(); ++it) { 254 it != as_list.end(); ++it) {
254 SettingSyncData sync_data(*it); 255 SettingSyncData* sync_data = new SettingSyncData(*it);
255 as_map[sync_data.extension_id()].push_back(sync_data); 256 linked_ptr<SettingSyncDataList>& list_for_extension =
257 as_map[sync_data->extension_id()];
258 if (!list_for_extension.get())
259 list_for_extension.reset(new SettingSyncDataList());
260 list_for_extension->push_back(sync_data);
256 } 261 }
257 return as_map; 262 return as_map;
258 } 263 }
259 264
260 // Need these so that the DCHECKs for running on FILE or UI threads pass. 265 // Need these so that the DCHECKs for running on FILE or UI threads pass.
261 base::MessageLoop message_loop_; 266 base::MessageLoop message_loop_;
262 content::TestBrowserThread ui_thread_; 267 content::TestBrowserThread ui_thread_;
263 content::TestBrowserThread file_thread_; 268 content::TestBrowserThread file_thread_;
264 269
265 base::ScopedTempDir temp_dir_; 270 base::ScopedTempDir temp_dir_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 base::StringValue value1("fooValue"); 311 base::StringValue value1("fooValue");
307 base::ListValue value2; 312 base::ListValue value2;
308 value2.Append(new base::StringValue("barValue")); 313 value2.Append(new base::StringValue("barValue"));
309 314
310 ValueStore* storage1 = AddExtensionAndGetStorage("s1", type); 315 ValueStore* storage1 = AddExtensionAndGetStorage("s1", type);
311 ValueStore* storage2 = AddExtensionAndGetStorage("s2", type); 316 ValueStore* storage2 = AddExtensionAndGetStorage("s2", type);
312 317
313 storage1->Set(DEFAULTS, "foo", value1); 318 storage1->Set(DEFAULTS, "foo", value1);
314 storage2->Set(DEFAULTS, "bar", value2); 319 storage2->Set(DEFAULTS, "bar", value2);
315 320
316 std::map<std::string, SettingSyncDataList> all_sync_data = 321 SettingSyncDataMultimap all_sync_data = GetAllSyncData(model_type);
317 GetAllSyncData(model_type);
318 EXPECT_EQ(2u, all_sync_data.size()); 322 EXPECT_EQ(2u, all_sync_data.size());
319 EXPECT_EQ(1u, all_sync_data["s1"].size()); 323 EXPECT_EQ(1u, all_sync_data["s1"]->size());
320 EXPECT_PRED_FORMAT2(ValuesEq, &value1, &all_sync_data["s1"][0].value()); 324 EXPECT_PRED_FORMAT2(ValuesEq, &value1, &(*all_sync_data["s1"])[0]->value());
321 EXPECT_EQ(1u, all_sync_data["s2"].size()); 325 EXPECT_EQ(1u, all_sync_data["s2"]->size());
322 EXPECT_PRED_FORMAT2(ValuesEq, &value2, &all_sync_data["s2"][0].value()); 326 EXPECT_PRED_FORMAT2(ValuesEq, &value2, &(*all_sync_data["s2"])[0]->value());
323 327
324 syncer::SyncDataList sync_data; 328 syncer::SyncDataList sync_data;
325 sync_data.push_back(settings_sync_util::CreateData( 329 sync_data.push_back(settings_sync_util::CreateData(
326 "s1", "foo", value1, model_type)); 330 "s1", "foo", value1, model_type));
327 sync_data.push_back(settings_sync_util::CreateData( 331 sync_data.push_back(settings_sync_util::CreateData(
328 "s2", "bar", value2, model_type)); 332 "s2", "bar", value2, model_type));
329 333
330 GetSyncableService(model_type) 334 GetSyncableService(model_type)
331 ->MergeDataAndStartSyncing( 335 ->MergeDataAndStartSyncing(
332 model_type, 336 model_type,
333 sync_data, 337 sync_data,
334 sync_processor_wrapper_.Pass(), 338 sync_processor_wrapper_.Pass(),
335 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 339 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
336 340
337 // Already in sync, so no changes. 341 // Already in sync, so no changes.
338 EXPECT_EQ(0u, sync_processor_->changes().size()); 342 EXPECT_EQ(0u, sync_processor_->changes().size());
339 343
340 // Regression test: not-changing the synced value shouldn't result in a sync 344 // Regression test: not-changing the synced value shouldn't result in a sync
341 // change, and changing the synced value should result in an update. 345 // change, and changing the synced value should result in an update.
342 storage1->Set(DEFAULTS, "foo", value1); 346 storage1->Set(DEFAULTS, "foo", value1);
343 EXPECT_EQ(0u, sync_processor_->changes().size()); 347 EXPECT_EQ(0u, sync_processor_->changes().size());
344 348
345 storage1->Set(DEFAULTS, "foo", value2); 349 storage1->Set(DEFAULTS, "foo", value2);
346 EXPECT_EQ(1u, sync_processor_->changes().size()); 350 EXPECT_EQ(1u, sync_processor_->changes().size());
347 SettingSyncData change = sync_processor_->GetOnlyChange("s1", "foo"); 351 SettingSyncData* change = sync_processor_->GetOnlyChange("s1", "foo");
348 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change.change_type()); 352 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change->change_type());
349 EXPECT_TRUE(value2.Equals(&change.value())); 353 EXPECT_TRUE(value2.Equals(&change->value()));
350 354
351 GetSyncableService(model_type)->StopSyncing(model_type); 355 GetSyncableService(model_type)->StopSyncing(model_type);
352 } 356 }
353 357
354 TEST_F(ExtensionSettingsSyncTest, LocalDataWithNoSyncDataIsPushedToSync) { 358 TEST_F(ExtensionSettingsSyncTest, LocalDataWithNoSyncDataIsPushedToSync) {
355 syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; 359 syncer::ModelType model_type = syncer::EXTENSION_SETTINGS;
356 Manifest::Type type = Manifest::TYPE_EXTENSION; 360 Manifest::Type type = Manifest::TYPE_EXTENSION;
357 361
358 base::StringValue value1("fooValue"); 362 base::StringValue value1("fooValue");
359 base::ListValue value2; 363 base::ListValue value2;
360 value2.Append(new base::StringValue("barValue")); 364 value2.Append(new base::StringValue("barValue"));
361 365
362 ValueStore* storage1 = AddExtensionAndGetStorage("s1", type); 366 ValueStore* storage1 = AddExtensionAndGetStorage("s1", type);
363 ValueStore* storage2 = AddExtensionAndGetStorage("s2", type); 367 ValueStore* storage2 = AddExtensionAndGetStorage("s2", type);
364 368
365 storage1->Set(DEFAULTS, "foo", value1); 369 storage1->Set(DEFAULTS, "foo", value1);
366 storage2->Set(DEFAULTS, "bar", value2); 370 storage2->Set(DEFAULTS, "bar", value2);
367 371
368 GetSyncableService(model_type) 372 GetSyncableService(model_type)
369 ->MergeDataAndStartSyncing( 373 ->MergeDataAndStartSyncing(
370 model_type, 374 model_type,
371 syncer::SyncDataList(), 375 syncer::SyncDataList(),
372 sync_processor_wrapper_.Pass(), 376 sync_processor_wrapper_.Pass(),
373 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 377 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
374 378
375 // All settings should have been pushed to sync. 379 // All settings should have been pushed to sync.
376 EXPECT_EQ(2u, sync_processor_->changes().size()); 380 EXPECT_EQ(2u, sync_processor_->changes().size());
377 SettingSyncData change = sync_processor_->GetOnlyChange("s1", "foo"); 381 SettingSyncData* change = sync_processor_->GetOnlyChange("s1", "foo");
378 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change.change_type()); 382 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change->change_type());
379 EXPECT_TRUE(value1.Equals(&change.value())); 383 EXPECT_TRUE(value1.Equals(&change->value()));
380 change = sync_processor_->GetOnlyChange("s2", "bar"); 384 change = sync_processor_->GetOnlyChange("s2", "bar");
381 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change.change_type()); 385 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change->change_type());
382 EXPECT_TRUE(value2.Equals(&change.value())); 386 EXPECT_TRUE(value2.Equals(&change->value()));
383 387
384 GetSyncableService(model_type)->StopSyncing(model_type); 388 GetSyncableService(model_type)->StopSyncing(model_type);
385 } 389 }
386 390
387 TEST_F(ExtensionSettingsSyncTest, AnySyncDataOverwritesLocalData) { 391 TEST_F(ExtensionSettingsSyncTest, AnySyncDataOverwritesLocalData) {
388 syncer::ModelType model_type = syncer::APP_SETTINGS; 392 syncer::ModelType model_type = syncer::APP_SETTINGS;
389 Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; 393 Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP;
390 394
391 base::StringValue value1("fooValue"); 395 base::StringValue value1("fooValue");
392 base::ListValue value2; 396 base::ListValue value2;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 sync_data, 535 sync_data,
532 sync_processor_wrapper_.Pass(), 536 sync_processor_wrapper_.Pass(),
533 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 537 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
534 538
535 // Add something locally. 539 // Add something locally.
536 storage1->Set(DEFAULTS, "bar", value2); 540 storage1->Set(DEFAULTS, "bar", value2);
537 storage2->Set(DEFAULTS, "bar", value2); 541 storage2->Set(DEFAULTS, "bar", value2);
538 storage3->Set(DEFAULTS, "foo", value1); 542 storage3->Set(DEFAULTS, "foo", value1);
539 storage4->Set(DEFAULTS, "foo", value1); 543 storage4->Set(DEFAULTS, "foo", value1);
540 544
541 SettingSyncData change = sync_processor_->GetOnlyChange("s1", "bar"); 545 SettingSyncData* change = sync_processor_->GetOnlyChange("s1", "bar");
542 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change.change_type()); 546 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change->change_type());
543 EXPECT_TRUE(value2.Equals(&change.value())); 547 EXPECT_TRUE(value2.Equals(&change->value()));
544 sync_processor_->GetOnlyChange("s2", "bar"); 548 sync_processor_->GetOnlyChange("s2", "bar");
545 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change.change_type()); 549 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change->change_type());
546 EXPECT_TRUE(value2.Equals(&change.value())); 550 EXPECT_TRUE(value2.Equals(&change->value()));
547 change = sync_processor_->GetOnlyChange("s3", "foo"); 551 change = sync_processor_->GetOnlyChange("s3", "foo");
548 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change.change_type()); 552 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change->change_type());
549 EXPECT_TRUE(value1.Equals(&change.value())); 553 EXPECT_TRUE(value1.Equals(&change->value()));
550 change = sync_processor_->GetOnlyChange("s4", "foo"); 554 change = sync_processor_->GetOnlyChange("s4", "foo");
551 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change.change_type()); 555 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, change->change_type());
552 EXPECT_TRUE(value1.Equals(&change.value())); 556 EXPECT_TRUE(value1.Equals(&change->value()));
553 557
554 // Change something locally, storage1/3 the new setting and storage2/4 the 558 // Change something locally, storage1/3 the new setting and storage2/4 the
555 // initial setting, for all combinations of local vs sync intialisation and 559 // initial setting, for all combinations of local vs sync intialisation and
556 // new vs initial. 560 // new vs initial.
557 sync_processor_->ClearChanges(); 561 sync_processor_->ClearChanges();
558 storage1->Set(DEFAULTS, "bar", value1); 562 storage1->Set(DEFAULTS, "bar", value1);
559 storage2->Set(DEFAULTS, "foo", value2); 563 storage2->Set(DEFAULTS, "foo", value2);
560 storage3->Set(DEFAULTS, "bar", value1); 564 storage3->Set(DEFAULTS, "bar", value1);
561 storage4->Set(DEFAULTS, "foo", value2); 565 storage4->Set(DEFAULTS, "foo", value2);
562 566
563 change = sync_processor_->GetOnlyChange("s1", "bar"); 567 change = sync_processor_->GetOnlyChange("s1", "bar");
564 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change.change_type()); 568 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change->change_type());
565 EXPECT_TRUE(value1.Equals(&change.value())); 569 EXPECT_TRUE(value1.Equals(&change->value()));
566 change = sync_processor_->GetOnlyChange("s2", "foo"); 570 change = sync_processor_->GetOnlyChange("s2", "foo");
567 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change.change_type()); 571 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change->change_type());
568 EXPECT_TRUE(value2.Equals(&change.value())); 572 EXPECT_TRUE(value2.Equals(&change->value()));
569 change = sync_processor_->GetOnlyChange("s3", "bar"); 573 change = sync_processor_->GetOnlyChange("s3", "bar");
570 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change.change_type()); 574 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change->change_type());
571 EXPECT_TRUE(value1.Equals(&change.value())); 575 EXPECT_TRUE(value1.Equals(&change->value()));
572 change = sync_processor_->GetOnlyChange("s4", "foo"); 576 change = sync_processor_->GetOnlyChange("s4", "foo");
573 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change.change_type()); 577 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change->change_type());
574 EXPECT_TRUE(value2.Equals(&change.value())); 578 EXPECT_TRUE(value2.Equals(&change->value()));
575 579
576 // Remove something locally, storage1/3 the new setting and storage2/4 the 580 // Remove something locally, storage1/3 the new setting and storage2/4 the
577 // initial setting, for all combinations of local vs sync intialisation and 581 // initial setting, for all combinations of local vs sync intialisation and
578 // new vs initial. 582 // new vs initial.
579 sync_processor_->ClearChanges(); 583 sync_processor_->ClearChanges();
580 storage1->Remove("foo"); 584 storage1->Remove("foo");
581 storage2->Remove("bar"); 585 storage2->Remove("bar");
582 storage3->Remove("foo"); 586 storage3->Remove("foo");
583 storage4->Remove("bar"); 587 storage4->Remove("bar");
584 588
585 EXPECT_EQ( 589 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
586 syncer::SyncChange::ACTION_DELETE, 590 sync_processor_->GetOnlyChange("s1", "foo")->change_type());
587 sync_processor_->GetOnlyChange("s1", "foo").change_type()); 591 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
588 EXPECT_EQ( 592 sync_processor_->GetOnlyChange("s2", "bar")->change_type());
589 syncer::SyncChange::ACTION_DELETE, 593 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
590 sync_processor_->GetOnlyChange("s2", "bar").change_type()); 594 sync_processor_->GetOnlyChange("s3", "foo")->change_type());
591 EXPECT_EQ( 595 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
592 syncer::SyncChange::ACTION_DELETE, 596 sync_processor_->GetOnlyChange("s4", "bar")->change_type());
593 sync_processor_->GetOnlyChange("s3", "foo").change_type());
594 EXPECT_EQ(
595 syncer::SyncChange::ACTION_DELETE,
596 sync_processor_->GetOnlyChange("s4", "bar").change_type());
597 597
598 // Remove some nonexistent settings. 598 // Remove some nonexistent settings.
599 sync_processor_->ClearChanges(); 599 sync_processor_->ClearChanges();
600 storage1->Remove("foo"); 600 storage1->Remove("foo");
601 storage2->Remove("bar"); 601 storage2->Remove("bar");
602 storage3->Remove("foo"); 602 storage3->Remove("foo");
603 storage4->Remove("bar"); 603 storage4->Remove("bar");
604 604
605 EXPECT_EQ(0u, sync_processor_->changes().size()); 605 EXPECT_EQ(0u, sync_processor_->changes().size());
606 606
607 // Clear the rest of the settings. Add the removed ones back first so that 607 // Clear the rest of the settings. Add the removed ones back first so that
608 // more than one setting is cleared. 608 // more than one setting is cleared.
609 storage1->Set(DEFAULTS, "foo", value1); 609 storage1->Set(DEFAULTS, "foo", value1);
610 storage2->Set(DEFAULTS, "bar", value2); 610 storage2->Set(DEFAULTS, "bar", value2);
611 storage3->Set(DEFAULTS, "foo", value1); 611 storage3->Set(DEFAULTS, "foo", value1);
612 storage4->Set(DEFAULTS, "bar", value2); 612 storage4->Set(DEFAULTS, "bar", value2);
613 613
614 sync_processor_->ClearChanges(); 614 sync_processor_->ClearChanges();
615 storage1->Clear(); 615 storage1->Clear();
616 storage2->Clear(); 616 storage2->Clear();
617 storage3->Clear(); 617 storage3->Clear();
618 storage4->Clear(); 618 storage4->Clear();
619 619
620 EXPECT_EQ( 620 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
621 syncer::SyncChange::ACTION_DELETE, 621 sync_processor_->GetOnlyChange("s1", "foo")->change_type());
622 sync_processor_->GetOnlyChange("s1", "foo").change_type()); 622 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
623 EXPECT_EQ( 623 sync_processor_->GetOnlyChange("s1", "bar")->change_type());
624 syncer::SyncChange::ACTION_DELETE, 624 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
625 sync_processor_->GetOnlyChange("s1", "bar").change_type()); 625 sync_processor_->GetOnlyChange("s2", "foo")->change_type());
626 EXPECT_EQ( 626 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
627 syncer::SyncChange::ACTION_DELETE, 627 sync_processor_->GetOnlyChange("s2", "bar")->change_type());
628 sync_processor_->GetOnlyChange("s2", "foo").change_type()); 628 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
629 EXPECT_EQ( 629 sync_processor_->GetOnlyChange("s3", "foo")->change_type());
630 syncer::SyncChange::ACTION_DELETE, 630 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
631 sync_processor_->GetOnlyChange("s2", "bar").change_type()); 631 sync_processor_->GetOnlyChange("s3", "bar")->change_type());
632 EXPECT_EQ( 632 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
633 syncer::SyncChange::ACTION_DELETE, 633 sync_processor_->GetOnlyChange("s4", "foo")->change_type());
634 sync_processor_->GetOnlyChange("s3", "foo").change_type()); 634 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE,
635 EXPECT_EQ( 635 sync_processor_->GetOnlyChange("s4", "bar")->change_type());
636 syncer::SyncChange::ACTION_DELETE,
637 sync_processor_->GetOnlyChange("s3", "bar").change_type());
638 EXPECT_EQ(
639 syncer::SyncChange::ACTION_DELETE,
640 sync_processor_->GetOnlyChange("s4", "foo").change_type());
641 EXPECT_EQ(
642 syncer::SyncChange::ACTION_DELETE,
643 sync_processor_->GetOnlyChange("s4", "bar").change_type());
644 636
645 GetSyncableService(model_type)->StopSyncing(model_type); 637 GetSyncableService(model_type)->StopSyncing(model_type);
646 } 638 }
647 639
648 TEST_F(ExtensionSettingsSyncTest, ExtensionAndAppSettingsSyncSeparately) { 640 TEST_F(ExtensionSettingsSyncTest, ExtensionAndAppSettingsSyncSeparately) {
649 base::StringValue value1("fooValue"); 641 base::StringValue value1("fooValue");
650 base::ListValue value2; 642 base::ListValue value2;
651 value2.Append(new base::StringValue("barValue")); 643 value2.Append(new base::StringValue("barValue"));
652 644
653 // storage1 is an extension, storage2 is an app. 645 // storage1 is an extension, storage2 is an app.
654 ValueStore* storage1 = AddExtensionAndGetStorage( 646 ValueStore* storage1 = AddExtensionAndGetStorage(
655 "s1", Manifest::TYPE_EXTENSION); 647 "s1", Manifest::TYPE_EXTENSION);
656 ValueStore* storage2 = AddExtensionAndGetStorage( 648 ValueStore* storage2 = AddExtensionAndGetStorage(
657 "s2", Manifest::TYPE_LEGACY_PACKAGED_APP); 649 "s2", Manifest::TYPE_LEGACY_PACKAGED_APP);
658 650
659 storage1->Set(DEFAULTS, "foo", value1); 651 storage1->Set(DEFAULTS, "foo", value1);
660 storage2->Set(DEFAULTS, "bar", value2); 652 storage2->Set(DEFAULTS, "bar", value2);
661 653
662 std::map<std::string, SettingSyncDataList> extension_sync_data = 654 SettingSyncDataMultimap extension_sync_data =
663 GetAllSyncData(syncer::EXTENSION_SETTINGS); 655 GetAllSyncData(syncer::EXTENSION_SETTINGS);
664 EXPECT_EQ(1u, extension_sync_data.size()); 656 EXPECT_EQ(1u, extension_sync_data.size());
665 EXPECT_EQ(1u, extension_sync_data["s1"].size()); 657 EXPECT_EQ(1u, extension_sync_data["s1"]->size());
666 EXPECT_PRED_FORMAT2(ValuesEq, &value1, &extension_sync_data["s1"][0].value()); 658 EXPECT_PRED_FORMAT2(ValuesEq, &value1,
659 &(*extension_sync_data["s1"])[0]->value());
667 660
668 std::map<std::string, SettingSyncDataList> app_sync_data = 661 SettingSyncDataMultimap app_sync_data = GetAllSyncData(syncer::APP_SETTINGS);
669 GetAllSyncData(syncer::APP_SETTINGS);
670 EXPECT_EQ(1u, app_sync_data.size()); 662 EXPECT_EQ(1u, app_sync_data.size());
671 EXPECT_EQ(1u, app_sync_data["s2"].size()); 663 EXPECT_EQ(1u, app_sync_data["s2"]->size());
672 EXPECT_PRED_FORMAT2(ValuesEq, &value2, &app_sync_data["s2"][0].value()); 664 EXPECT_PRED_FORMAT2(ValuesEq, &value2, &(*app_sync_data["s2"])[0]->value());
673 665
674 // Stop each separately, there should be no changes either time. 666 // Stop each separately, there should be no changes either time.
675 syncer::SyncDataList sync_data; 667 syncer::SyncDataList sync_data;
676 sync_data.push_back(settings_sync_util::CreateData( 668 sync_data.push_back(settings_sync_util::CreateData(
677 "s1", "foo", value1, syncer::EXTENSION_SETTINGS)); 669 "s1", "foo", value1, syncer::EXTENSION_SETTINGS));
678 670
679 GetSyncableService(syncer::EXTENSION_SETTINGS) 671 GetSyncableService(syncer::EXTENSION_SETTINGS)
680 ->MergeDataAndStartSyncing( 672 ->MergeDataAndStartSyncing(
681 syncer::EXTENSION_SETTINGS, 673 syncer::EXTENSION_SETTINGS,
682 sync_data, 674 sync_data,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 { 736 {
745 base::DictionaryValue dict; 737 base::DictionaryValue dict;
746 EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); 738 EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get());
747 } 739 }
748 740
749 // Changes made to good should be sent to sync, changes from bad shouldn't. 741 // Changes made to good should be sent to sync, changes from bad shouldn't.
750 sync_processor_->ClearChanges(); 742 sync_processor_->ClearChanges();
751 good->Set(DEFAULTS, "bar", barValue); 743 good->Set(DEFAULTS, "bar", barValue);
752 bad->Set(DEFAULTS, "bar", barValue); 744 bad->Set(DEFAULTS, "bar", barValue);
753 745
754 EXPECT_EQ( 746 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
755 syncer::SyncChange::ACTION_ADD, 747 sync_processor_->GetOnlyChange("good", "bar")->change_type());
756 sync_processor_->GetOnlyChange("good", "bar").change_type());
757 EXPECT_EQ(1u, sync_processor_->changes().size()); 748 EXPECT_EQ(1u, sync_processor_->changes().size());
758 749
759 { 750 {
760 base::DictionaryValue dict; 751 base::DictionaryValue dict;
761 dict.Set("foo", fooValue.DeepCopy()); 752 dict.Set("foo", fooValue.DeepCopy());
762 dict.Set("bar", barValue.DeepCopy()); 753 dict.Set("bar", barValue.DeepCopy());
763 EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); 754 EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get());
764 } 755 }
765 { 756 {
766 base::DictionaryValue dict; 757 base::DictionaryValue dict;
(...skipping 25 matching lines...) Expand all
792 dict.Set("bar", barValue.DeepCopy()); 783 dict.Set("bar", barValue.DeepCopy());
793 EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); 784 EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get());
794 } 785 }
795 786
796 // Changes made to bad still shouldn't go to sync, even though it didn't fail 787 // Changes made to bad still shouldn't go to sync, even though it didn't fail
797 // last time. 788 // last time.
798 sync_processor_->ClearChanges(); 789 sync_processor_->ClearChanges();
799 good->Set(DEFAULTS, "bar", fooValue); 790 good->Set(DEFAULTS, "bar", fooValue);
800 bad->Set(DEFAULTS, "bar", fooValue); 791 bad->Set(DEFAULTS, "bar", fooValue);
801 792
802 EXPECT_EQ( 793 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
803 syncer::SyncChange::ACTION_UPDATE, 794 sync_processor_->GetOnlyChange("good", "bar")->change_type());
804 sync_processor_->GetOnlyChange("good", "bar").change_type());
805 EXPECT_EQ(1u, sync_processor_->changes().size()); 795 EXPECT_EQ(1u, sync_processor_->changes().size());
806 796
807 { 797 {
808 base::DictionaryValue dict; 798 base::DictionaryValue dict;
809 dict.Set("foo", barValue.DeepCopy()); 799 dict.Set("foo", barValue.DeepCopy());
810 dict.Set("bar", fooValue.DeepCopy()); 800 dict.Set("bar", fooValue.DeepCopy());
811 EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); 801 EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get());
812 } 802 }
813 { 803 {
814 base::DictionaryValue dict; 804 base::DictionaryValue dict;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get())); 838 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get()));
849 GetSyncableService(model_type) 839 GetSyncableService(model_type)
850 ->MergeDataAndStartSyncing( 840 ->MergeDataAndStartSyncing(
851 model_type, 841 model_type,
852 syncer::SyncDataList(), 842 syncer::SyncDataList(),
853 sync_processor_wrapper_.Pass(), 843 sync_processor_wrapper_.Pass(),
854 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 844 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
855 845
856 // Local settings will have been pushed to sync, since it's empty (in this 846 // Local settings will have been pushed to sync, since it's empty (in this
857 // test; presumably it wouldn't be live, since we've been getting changes). 847 // test; presumably it wouldn't be live, since we've been getting changes).
858 EXPECT_EQ( 848 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
859 syncer::SyncChange::ACTION_ADD, 849 sync_processor_->GetOnlyChange("good", "foo")->change_type());
860 sync_processor_->GetOnlyChange("good", "foo").change_type()); 850 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
861 EXPECT_EQ( 851 sync_processor_->GetOnlyChange("good", "bar")->change_type());
862 syncer::SyncChange::ACTION_ADD, 852 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
863 sync_processor_->GetOnlyChange("good", "bar").change_type()); 853 sync_processor_->GetOnlyChange("bad", "bar")->change_type());
864 EXPECT_EQ(
865 syncer::SyncChange::ACTION_ADD,
866 sync_processor_->GetOnlyChange("bad", "bar").change_type());
867 EXPECT_EQ(3u, sync_processor_->changes().size()); 854 EXPECT_EQ(3u, sync_processor_->changes().size());
868 855
869 // Live local changes now get pushed, too. 856 // Live local changes now get pushed, too.
870 sync_processor_->ClearChanges(); 857 sync_processor_->ClearChanges();
871 good->Set(DEFAULTS, "bar", barValue); 858 good->Set(DEFAULTS, "bar", barValue);
872 bad->Set(DEFAULTS, "bar", barValue); 859 bad->Set(DEFAULTS, "bar", barValue);
873 860
874 EXPECT_EQ( 861 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
875 syncer::SyncChange::ACTION_UPDATE, 862 sync_processor_->GetOnlyChange("good", "bar")->change_type());
876 sync_processor_->GetOnlyChange("good", "bar").change_type()); 863 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
877 EXPECT_EQ( 864 sync_processor_->GetOnlyChange("bad", "bar")->change_type());
878 syncer::SyncChange::ACTION_UPDATE,
879 sync_processor_->GetOnlyChange("bad", "bar").change_type());
880 EXPECT_EQ(2u, sync_processor_->changes().size()); 865 EXPECT_EQ(2u, sync_processor_->changes().size());
881 866
882 // And ProcessSyncChanges work, too. 867 // And ProcessSyncChanges work, too.
883 { 868 {
884 syncer::SyncChangeList change_list; 869 syncer::SyncChangeList change_list;
885 change_list.push_back(settings_sync_util::CreateUpdate( 870 change_list.push_back(settings_sync_util::CreateUpdate(
886 "good", "bar", fooValue, model_type)); 871 "good", "bar", fooValue, model_type));
887 change_list.push_back(settings_sync_util::CreateUpdate( 872 change_list.push_back(settings_sync_util::CreateUpdate(
888 "bad", "bar", fooValue, model_type)); 873 "bad", "bar", fooValue, model_type));
889 GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list); 874 GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 base::DictionaryValue dict; 952 base::DictionaryValue dict;
968 dict.Set("foo", fooValue.DeepCopy()); 953 dict.Set("foo", fooValue.DeepCopy());
969 EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); 954 EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get());
970 } 955 }
971 956
972 // No more changes sent to sync for bad. 957 // No more changes sent to sync for bad.
973 sync_processor_->ClearChanges(); 958 sync_processor_->ClearChanges();
974 good->Set(DEFAULTS, "foo", barValue); 959 good->Set(DEFAULTS, "foo", barValue);
975 bad->Set(DEFAULTS, "foo", barValue); 960 bad->Set(DEFAULTS, "foo", barValue);
976 961
977 EXPECT_EQ( 962 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
978 syncer::SyncChange::ACTION_UPDATE, 963 sync_processor_->GetOnlyChange("good", "foo")->change_type());
979 sync_processor_->GetOnlyChange("good", "foo").change_type());
980 EXPECT_EQ(1u, sync_processor_->changes().size()); 964 EXPECT_EQ(1u, sync_processor_->changes().size());
981 965
982 // No more changes received from sync should go to bad. 966 // No more changes received from sync should go to bad.
983 { 967 {
984 syncer::SyncChangeList change_list; 968 syncer::SyncChangeList change_list;
985 change_list.push_back(settings_sync_util::CreateAdd( 969 change_list.push_back(settings_sync_util::CreateAdd(
986 "good", "foo", fooValue, model_type)); 970 "good", "foo", fooValue, model_type));
987 change_list.push_back(settings_sync_util::CreateAdd( 971 change_list.push_back(settings_sync_util::CreateAdd(
988 "bad", "foo", fooValue, model_type)); 972 "bad", "foo", fooValue, model_type));
989 GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list); 973 GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK); 1014 testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK);
1031 1015
1032 // Sync shouldn't be disabled for good (nor bad -- but this is unimportant). 1016 // Sync shouldn't be disabled for good (nor bad -- but this is unimportant).
1033 GetSyncableService(model_type) 1017 GetSyncableService(model_type)
1034 ->MergeDataAndStartSyncing( 1018 ->MergeDataAndStartSyncing(
1035 model_type, 1019 model_type,
1036 syncer::SyncDataList(), 1020 syncer::SyncDataList(),
1037 sync_processor_wrapper_.Pass(), 1021 sync_processor_wrapper_.Pass(),
1038 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 1022 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
1039 1023
1040 EXPECT_EQ( 1024 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1041 syncer::SyncChange::ACTION_ADD, 1025 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1042 sync_processor_->GetOnlyChange("good", "foo").change_type()); 1026 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1043 EXPECT_EQ( 1027 sync_processor_->GetOnlyChange("bad", "foo")->change_type());
1044 syncer::SyncChange::ACTION_ADD,
1045 sync_processor_->GetOnlyChange("bad", "foo").change_type());
1046 EXPECT_EQ(2u, sync_processor_->changes().size()); 1028 EXPECT_EQ(2u, sync_processor_->changes().size());
1047 1029
1048 sync_processor_->ClearChanges(); 1030 sync_processor_->ClearChanges();
1049 good->Set(DEFAULTS, "bar", barValue); 1031 good->Set(DEFAULTS, "bar", barValue);
1050 bad->Set(DEFAULTS, "bar", barValue); 1032 bad->Set(DEFAULTS, "bar", barValue);
1051 1033
1052 EXPECT_EQ( 1034 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1053 syncer::SyncChange::ACTION_ADD, 1035 sync_processor_->GetOnlyChange("good", "bar")->change_type());
1054 sync_processor_->GetOnlyChange("good", "bar").change_type()); 1036 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1055 EXPECT_EQ( 1037 sync_processor_->GetOnlyChange("bad", "bar")->change_type());
1056 syncer::SyncChange::ACTION_ADD,
1057 sync_processor_->GetOnlyChange("bad", "bar").change_type());
1058 EXPECT_EQ(2u, sync_processor_->changes().size()); 1038 EXPECT_EQ(2u, sync_processor_->changes().size());
1059 } 1039 }
1060 1040
1061 TEST_F(ExtensionSettingsSyncTest, FailureToReadChangesToPushDisablesSync) { 1041 TEST_F(ExtensionSettingsSyncTest, FailureToReadChangesToPushDisablesSync) {
1062 syncer::ModelType model_type = syncer::APP_SETTINGS; 1042 syncer::ModelType model_type = syncer::APP_SETTINGS;
1063 Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; 1043 Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP;
1064 1044
1065 base::StringValue fooValue("fooValue"); 1045 base::StringValue fooValue("fooValue");
1066 base::StringValue barValue("barValue"); 1046 base::StringValue barValue("barValue");
1067 1047
(...skipping 10 matching lines...) Expand all
1078 // get them so won't. 1058 // get them so won't.
1079 testing_factory->GetExisting("bad")->set_error_code(ValueStore::CORRUPTION); 1059 testing_factory->GetExisting("bad")->set_error_code(ValueStore::CORRUPTION);
1080 GetSyncableService(model_type) 1060 GetSyncableService(model_type)
1081 ->MergeDataAndStartSyncing( 1061 ->MergeDataAndStartSyncing(
1082 model_type, 1062 model_type,
1083 syncer::SyncDataList(), 1063 syncer::SyncDataList(),
1084 sync_processor_wrapper_.Pass(), 1064 sync_processor_wrapper_.Pass(),
1085 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 1065 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
1086 testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK); 1066 testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK);
1087 1067
1088 EXPECT_EQ( 1068 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1089 syncer::SyncChange::ACTION_ADD, 1069 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1090 sync_processor_->GetOnlyChange("good", "foo").change_type());
1091 EXPECT_EQ(1u, sync_processor_->changes().size()); 1070 EXPECT_EQ(1u, sync_processor_->changes().size());
1092 1071
1093 // bad should now be disabled for sync. 1072 // bad should now be disabled for sync.
1094 sync_processor_->ClearChanges(); 1073 sync_processor_->ClearChanges();
1095 good->Set(DEFAULTS, "bar", barValue); 1074 good->Set(DEFAULTS, "bar", barValue);
1096 bad->Set(DEFAULTS, "bar", barValue); 1075 bad->Set(DEFAULTS, "bar", barValue);
1097 1076
1098 EXPECT_EQ( 1077 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1099 syncer::SyncChange::ACTION_ADD, 1078 sync_processor_->GetOnlyChange("good", "bar")->change_type());
1100 sync_processor_->GetOnlyChange("good", "bar").change_type());
1101 EXPECT_EQ(1u, sync_processor_->changes().size()); 1079 EXPECT_EQ(1u, sync_processor_->changes().size());
1102 1080
1103 { 1081 {
1104 syncer::SyncChangeList change_list; 1082 syncer::SyncChangeList change_list;
1105 change_list.push_back(settings_sync_util::CreateUpdate( 1083 change_list.push_back(settings_sync_util::CreateUpdate(
1106 "good", "foo", barValue, model_type)); 1084 "good", "foo", barValue, model_type));
1107 // (Sending ADD here even though it's updating, since that's what the state 1085 // (Sending ADD here even though it's updating, since that's what the state
1108 // of sync is. In any case, it won't work.) 1086 // of sync is. In any case, it won't work.)
1109 change_list.push_back(settings_sync_util::CreateAdd( 1087 change_list.push_back(settings_sync_util::CreateAdd(
1110 "bad", "foo", barValue, model_type)); 1088 "bad", "foo", barValue, model_type));
(...skipping 19 matching lines...) Expand all
1130 GetSyncableService(model_type)->StopSyncing(model_type); 1108 GetSyncableService(model_type)->StopSyncing(model_type);
1131 sync_processor_wrapper_.reset( 1109 sync_processor_wrapper_.reset(
1132 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get())); 1110 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get()));
1133 GetSyncableService(model_type) 1111 GetSyncableService(model_type)
1134 ->MergeDataAndStartSyncing( 1112 ->MergeDataAndStartSyncing(
1135 model_type, 1113 model_type,
1136 syncer::SyncDataList(), 1114 syncer::SyncDataList(),
1137 sync_processor_wrapper_.Pass(), 1115 sync_processor_wrapper_.Pass(),
1138 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 1116 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
1139 1117
1140 EXPECT_EQ( 1118 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1141 syncer::SyncChange::ACTION_ADD, 1119 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1142 sync_processor_->GetOnlyChange("good", "foo").change_type()); 1120 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1143 EXPECT_EQ( 1121 sync_processor_->GetOnlyChange("good", "bar")->change_type());
1144 syncer::SyncChange::ACTION_ADD, 1122 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1145 sync_processor_->GetOnlyChange("good", "bar").change_type()); 1123 sync_processor_->GetOnlyChange("bad", "foo")->change_type());
1146 EXPECT_EQ( 1124 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1147 syncer::SyncChange::ACTION_ADD, 1125 sync_processor_->GetOnlyChange("bad", "bar")->change_type());
1148 sync_processor_->GetOnlyChange("bad", "foo").change_type());
1149 EXPECT_EQ(
1150 syncer::SyncChange::ACTION_ADD,
1151 sync_processor_->GetOnlyChange("bad", "bar").change_type());
1152 EXPECT_EQ(4u, sync_processor_->changes().size()); 1126 EXPECT_EQ(4u, sync_processor_->changes().size());
1153 1127
1154 sync_processor_->ClearChanges(); 1128 sync_processor_->ClearChanges();
1155 good->Set(DEFAULTS, "bar", fooValue); 1129 good->Set(DEFAULTS, "bar", fooValue);
1156 bad->Set(DEFAULTS, "bar", fooValue); 1130 bad->Set(DEFAULTS, "bar", fooValue);
1157 1131
1158 EXPECT_EQ( 1132 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
1159 syncer::SyncChange::ACTION_UPDATE, 1133 sync_processor_->GetOnlyChange("good", "bar")->change_type());
1160 sync_processor_->GetOnlyChange("good", "bar").change_type()); 1134 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
1161 EXPECT_EQ( 1135 sync_processor_->GetOnlyChange("good", "bar")->change_type());
1162 syncer::SyncChange::ACTION_UPDATE,
1163 sync_processor_->GetOnlyChange("good", "bar").change_type());
1164 EXPECT_EQ(2u, sync_processor_->changes().size()); 1136 EXPECT_EQ(2u, sync_processor_->changes().size());
1165 } 1137 }
1166 1138
1167 TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalStateDisablesSync) { 1139 TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalStateDisablesSync) {
1168 syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; 1140 syncer::ModelType model_type = syncer::EXTENSION_SETTINGS;
1169 Manifest::Type type = Manifest::TYPE_EXTENSION; 1141 Manifest::Type type = Manifest::TYPE_EXTENSION;
1170 1142
1171 base::StringValue fooValue("fooValue"); 1143 base::StringValue fooValue("fooValue");
1172 base::StringValue barValue("barValue"); 1144 base::StringValue barValue("barValue");
1173 1145
(...skipping 13 matching lines...) Expand all
1187 syncer::SyncDataList(), 1159 syncer::SyncDataList(),
1188 sync_processor_wrapper_.Pass(), 1160 sync_processor_wrapper_.Pass(),
1189 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 1161 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
1190 sync_processor_->set_fail_all_requests(false); 1162 sync_processor_->set_fail_all_requests(false);
1191 1163
1192 // Changes from good will be send to sync, changes from bad won't. 1164 // Changes from good will be send to sync, changes from bad won't.
1193 sync_processor_->ClearChanges(); 1165 sync_processor_->ClearChanges();
1194 good->Set(DEFAULTS, "foo", barValue); 1166 good->Set(DEFAULTS, "foo", barValue);
1195 bad->Set(DEFAULTS, "foo", barValue); 1167 bad->Set(DEFAULTS, "foo", barValue);
1196 1168
1197 EXPECT_EQ( 1169 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1198 syncer::SyncChange::ACTION_ADD, 1170 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1199 sync_processor_->GetOnlyChange("good", "foo").change_type());
1200 EXPECT_EQ(1u, sync_processor_->changes().size()); 1171 EXPECT_EQ(1u, sync_processor_->changes().size());
1201 1172
1202 // Changes from sync will be sent to good, not to bad. 1173 // Changes from sync will be sent to good, not to bad.
1203 { 1174 {
1204 syncer::SyncChangeList change_list; 1175 syncer::SyncChangeList change_list;
1205 change_list.push_back(settings_sync_util::CreateAdd( 1176 change_list.push_back(settings_sync_util::CreateAdd(
1206 "good", "bar", barValue, model_type)); 1177 "good", "bar", barValue, model_type));
1207 change_list.push_back(settings_sync_util::CreateAdd( 1178 change_list.push_back(settings_sync_util::CreateAdd(
1208 "bad", "bar", barValue, model_type)); 1179 "bad", "bar", barValue, model_type));
1209 GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list); 1180 GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list);
(...skipping 16 matching lines...) Expand all
1226 GetSyncableService(model_type)->StopSyncing(model_type); 1197 GetSyncableService(model_type)->StopSyncing(model_type);
1227 sync_processor_wrapper_.reset( 1198 sync_processor_wrapper_.reset(
1228 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get())); 1199 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get()));
1229 GetSyncableService(model_type) 1200 GetSyncableService(model_type)
1230 ->MergeDataAndStartSyncing( 1201 ->MergeDataAndStartSyncing(
1231 model_type, 1202 model_type,
1232 syncer::SyncDataList(), 1203 syncer::SyncDataList(),
1233 sync_processor_wrapper_.Pass(), 1204 sync_processor_wrapper_.Pass(),
1234 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 1205 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
1235 1206
1236 EXPECT_EQ( 1207 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1237 syncer::SyncChange::ACTION_ADD, 1208 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1238 sync_processor_->GetOnlyChange("good", "foo").change_type()); 1209 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1239 EXPECT_EQ( 1210 sync_processor_->GetOnlyChange("good", "bar")->change_type());
1240 syncer::SyncChange::ACTION_ADD, 1211 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1241 sync_processor_->GetOnlyChange("good", "bar").change_type()); 1212 sync_processor_->GetOnlyChange("bad", "foo")->change_type());
1242 EXPECT_EQ(
1243 syncer::SyncChange::ACTION_ADD,
1244 sync_processor_->GetOnlyChange("bad", "foo").change_type());
1245 EXPECT_EQ(3u, sync_processor_->changes().size()); 1213 EXPECT_EQ(3u, sync_processor_->changes().size());
1246 1214
1247 sync_processor_->ClearChanges(); 1215 sync_processor_->ClearChanges();
1248 good->Set(DEFAULTS, "foo", fooValue); 1216 good->Set(DEFAULTS, "foo", fooValue);
1249 bad->Set(DEFAULTS, "foo", fooValue); 1217 bad->Set(DEFAULTS, "foo", fooValue);
1250 1218
1251 EXPECT_EQ( 1219 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
1252 syncer::SyncChange::ACTION_UPDATE, 1220 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1253 sync_processor_->GetOnlyChange("good", "foo").change_type()); 1221 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
1254 EXPECT_EQ( 1222 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1255 syncer::SyncChange::ACTION_UPDATE,
1256 sync_processor_->GetOnlyChange("good", "foo").change_type());
1257 EXPECT_EQ(2u, sync_processor_->changes().size()); 1223 EXPECT_EQ(2u, sync_processor_->changes().size());
1258 } 1224 }
1259 1225
1260 TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalChangeDisablesSync) { 1226 TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalChangeDisablesSync) {
1261 syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; 1227 syncer::ModelType model_type = syncer::EXTENSION_SETTINGS;
1262 Manifest::Type type = Manifest::TYPE_EXTENSION; 1228 Manifest::Type type = Manifest::TYPE_EXTENSION;
1263 1229
1264 base::StringValue fooValue("fooValue"); 1230 base::StringValue fooValue("fooValue");
1265 base::StringValue barValue("barValue"); 1231 base::StringValue barValue("barValue");
1266 1232
1267 TestingValueStoreFactory* testing_factory = new TestingValueStoreFactory(); 1233 TestingValueStoreFactory* testing_factory = new TestingValueStoreFactory();
1268 storage_factory_->Reset(testing_factory); 1234 storage_factory_->Reset(testing_factory);
1269 1235
1270 ValueStore* good = AddExtensionAndGetStorage("good", type); 1236 ValueStore* good = AddExtensionAndGetStorage("good", type);
1271 ValueStore* bad = AddExtensionAndGetStorage("bad", type); 1237 ValueStore* bad = AddExtensionAndGetStorage("bad", type);
1272 1238
1273 GetSyncableService(model_type) 1239 GetSyncableService(model_type)
1274 ->MergeDataAndStartSyncing( 1240 ->MergeDataAndStartSyncing(
1275 model_type, 1241 model_type,
1276 syncer::SyncDataList(), 1242 syncer::SyncDataList(),
1277 sync_processor_wrapper_.Pass(), 1243 sync_processor_wrapper_.Pass(),
1278 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 1244 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
1279 1245
1280 // bad will fail to send changes. 1246 // bad will fail to send changes.
1281 good->Set(DEFAULTS, "foo", fooValue); 1247 good->Set(DEFAULTS, "foo", fooValue);
1282 sync_processor_->set_fail_all_requests(true); 1248 sync_processor_->set_fail_all_requests(true);
1283 bad->Set(DEFAULTS, "foo", fooValue); 1249 bad->Set(DEFAULTS, "foo", fooValue);
1284 sync_processor_->set_fail_all_requests(false); 1250 sync_processor_->set_fail_all_requests(false);
1285 1251
1286 EXPECT_EQ( 1252 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1287 syncer::SyncChange::ACTION_ADD, 1253 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1288 sync_processor_->GetOnlyChange("good", "foo").change_type());
1289 EXPECT_EQ(1u, sync_processor_->changes().size()); 1254 EXPECT_EQ(1u, sync_processor_->changes().size());
1290 1255
1291 // No further changes should be sent from bad. 1256 // No further changes should be sent from bad.
1292 sync_processor_->ClearChanges(); 1257 sync_processor_->ClearChanges();
1293 good->Set(DEFAULTS, "foo", barValue); 1258 good->Set(DEFAULTS, "foo", barValue);
1294 bad->Set(DEFAULTS, "foo", barValue); 1259 bad->Set(DEFAULTS, "foo", barValue);
1295 1260
1296 EXPECT_EQ( 1261 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
1297 syncer::SyncChange::ACTION_UPDATE, 1262 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1298 sync_processor_->GetOnlyChange("good", "foo").change_type());
1299 EXPECT_EQ(1u, sync_processor_->changes().size()); 1263 EXPECT_EQ(1u, sync_processor_->changes().size());
1300 1264
1301 // Changes from sync will be sent to good, not to bad. 1265 // Changes from sync will be sent to good, not to bad.
1302 { 1266 {
1303 syncer::SyncChangeList change_list; 1267 syncer::SyncChangeList change_list;
1304 change_list.push_back(settings_sync_util::CreateAdd( 1268 change_list.push_back(settings_sync_util::CreateAdd(
1305 "good", "bar", barValue, model_type)); 1269 "good", "bar", barValue, model_type));
1306 change_list.push_back(settings_sync_util::CreateAdd( 1270 change_list.push_back(settings_sync_util::CreateAdd(
1307 "bad", "bar", barValue, model_type)); 1271 "bad", "bar", barValue, model_type));
1308 GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list); 1272 GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list);
(...skipping 16 matching lines...) Expand all
1325 GetSyncableService(model_type)->StopSyncing(model_type); 1289 GetSyncableService(model_type)->StopSyncing(model_type);
1326 sync_processor_wrapper_.reset( 1290 sync_processor_wrapper_.reset(
1327 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get())); 1291 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get()));
1328 GetSyncableService(model_type) 1292 GetSyncableService(model_type)
1329 ->MergeDataAndStartSyncing( 1293 ->MergeDataAndStartSyncing(
1330 model_type, 1294 model_type,
1331 syncer::SyncDataList(), 1295 syncer::SyncDataList(),
1332 sync_processor_wrapper_.Pass(), 1296 sync_processor_wrapper_.Pass(),
1333 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); 1297 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
1334 1298
1335 EXPECT_EQ( 1299 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1336 syncer::SyncChange::ACTION_ADD, 1300 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1337 sync_processor_->GetOnlyChange("good", "foo").change_type()); 1301 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1338 EXPECT_EQ( 1302 sync_processor_->GetOnlyChange("good", "bar")->change_type());
1339 syncer::SyncChange::ACTION_ADD, 1303 EXPECT_EQ(syncer::SyncChange::ACTION_ADD,
1340 sync_processor_->GetOnlyChange("good", "bar").change_type()); 1304 sync_processor_->GetOnlyChange("bad", "foo")->change_type());
1341 EXPECT_EQ(
1342 syncer::SyncChange::ACTION_ADD,
1343 sync_processor_->GetOnlyChange("bad", "foo").change_type());
1344 EXPECT_EQ(3u, sync_processor_->changes().size()); 1305 EXPECT_EQ(3u, sync_processor_->changes().size());
1345 1306
1346 sync_processor_->ClearChanges(); 1307 sync_processor_->ClearChanges();
1347 good->Set(DEFAULTS, "foo", fooValue); 1308 good->Set(DEFAULTS, "foo", fooValue);
1348 bad->Set(DEFAULTS, "foo", fooValue); 1309 bad->Set(DEFAULTS, "foo", fooValue);
1349 1310
1350 EXPECT_EQ( 1311 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
1351 syncer::SyncChange::ACTION_UPDATE, 1312 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1352 sync_processor_->GetOnlyChange("good", "foo").change_type()); 1313 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE,
1353 EXPECT_EQ( 1314 sync_processor_->GetOnlyChange("good", "foo")->change_type());
1354 syncer::SyncChange::ACTION_UPDATE,
1355 sync_processor_->GetOnlyChange("good", "foo").change_type());
1356 EXPECT_EQ(2u, sync_processor_->changes().size()); 1315 EXPECT_EQ(2u, sync_processor_->changes().size());
1357 } 1316 }
1358 1317
1359 TEST_F(ExtensionSettingsSyncTest, 1318 TEST_F(ExtensionSettingsSyncTest,
1360 LargeOutgoingChangeRejectedButIncomingAccepted) { 1319 LargeOutgoingChangeRejectedButIncomingAccepted) {
1361 syncer::ModelType model_type = syncer::APP_SETTINGS; 1320 syncer::ModelType model_type = syncer::APP_SETTINGS;
1362 Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; 1321 Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP;
1363 1322
1364 // This value should be larger than the limit in sync_storage_backend.cc. 1323 // This value should be larger than the limit in sync_storage_backend.cc.
1365 std::string string_10k; 1324 std::string string_10k;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 new base::StringValue("value")); 1390 new base::StringValue("value"));
1432 EXPECT_TRUE(base::Value::Equals(&expected_data, &data->settings())); 1391 EXPECT_TRUE(base::Value::Equals(&expected_data, &data->settings()));
1433 } 1392 }
1434 1393
1435 // Test dots in keys going to sync. 1394 // Test dots in keys going to sync.
1436 { 1395 {
1437 scoped_ptr<base::Value> string_value(new base::StringValue("spot")); 1396 scoped_ptr<base::Value> string_value(new base::StringValue("spot"));
1438 storage->Set(DEFAULTS, "key.with.spot", *string_value); 1397 storage->Set(DEFAULTS, "key.with.spot", *string_value);
1439 1398
1440 ASSERT_EQ(1u, sync_processor_->changes().size()); 1399 ASSERT_EQ(1u, sync_processor_->changes().size());
1441 SettingSyncData sync_data = sync_processor_->changes()[0]; 1400 SettingSyncData* sync_data = sync_processor_->changes()[0];
1442 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); 1401 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data->change_type());
1443 EXPECT_EQ("ext", sync_data.extension_id()); 1402 EXPECT_EQ("ext", sync_data->extension_id());
1444 EXPECT_EQ("key.with.spot", sync_data.key()); 1403 EXPECT_EQ("key.with.spot", sync_data->key());
1445 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); 1404 EXPECT_TRUE(sync_data->value().Equals(string_value.get()));
1446 } 1405 }
1447 } 1406 }
1448 1407
1449 // In other (frontend) tests, we assume that the result of GetStorage 1408 // In other (frontend) tests, we assume that the result of GetStorage
1450 // is a pointer to the a Storage owned by a Frontend object, but for 1409 // is a pointer to the a Storage owned by a Frontend object, but for
1451 // the unlimitedStorage case, this might not be true. So, write the 1410 // the unlimitedStorage case, this might not be true. So, write the
1452 // tests in a "callback" style. We should really rewrite all tests to 1411 // tests in a "callback" style. We should really rewrite all tests to
1453 // be asynchronous in this way. 1412 // be asynchronous in this way.
1454 1413
1455 namespace { 1414 namespace {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 settings_namespace::SYNC, 1460 settings_namespace::SYNC,
1502 base::Bind(&UnlimitedSyncStorageTestCallback)); 1461 base::Bind(&UnlimitedSyncStorageTestCallback));
1503 frontend_->RunWithStorage(extension, 1462 frontend_->RunWithStorage(extension,
1504 settings_namespace::LOCAL, 1463 settings_namespace::LOCAL,
1505 base::Bind(&UnlimitedLocalStorageTestCallback)); 1464 base::Bind(&UnlimitedLocalStorageTestCallback));
1506 1465
1507 base::MessageLoop::current()->RunUntilIdle(); 1466 base::MessageLoop::current()->RunUntilIdle();
1508 } 1467 }
1509 1468
1510 } // namespace extensions 1469 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698