OLD | NEW |
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/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 sync_processor_->GetOnlyChange("good", "foo").change_type()); | 1333 sync_processor_->GetOnlyChange("good", "foo").change_type()); |
1334 EXPECT_EQ(2u, sync_processor_->changes().size()); | 1334 EXPECT_EQ(2u, sync_processor_->changes().size()); |
1335 } | 1335 } |
1336 | 1336 |
1337 TEST_F(ExtensionSettingsSyncTest, | 1337 TEST_F(ExtensionSettingsSyncTest, |
1338 LargeOutgoingChangeRejectedButIncomingAccepted) { | 1338 LargeOutgoingChangeRejectedButIncomingAccepted) { |
1339 syncer::ModelType model_type = syncer::APP_SETTINGS; | 1339 syncer::ModelType model_type = syncer::APP_SETTINGS; |
1340 Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; | 1340 Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; |
1341 | 1341 |
1342 // This value should be larger than the limit in sync_storage_backend.cc. | 1342 // This value should be larger than the limit in sync_storage_backend.cc. |
1343 std::string string_5k; | 1343 std::string string_10k; |
1344 for (size_t i = 0; i < 5000; ++i) { | 1344 for (size_t i = 0; i < 10000; ++i) { |
1345 string_5k.append("a"); | 1345 string_10k.append("a"); |
1346 } | 1346 } |
1347 base::StringValue large_value(string_5k); | 1347 base::StringValue large_value(string_10k); |
1348 | 1348 |
1349 GetSyncableService(model_type)->MergeDataAndStartSyncing( | 1349 GetSyncableService(model_type)->MergeDataAndStartSyncing( |
1350 model_type, | 1350 model_type, |
1351 syncer::SyncDataList(), | 1351 syncer::SyncDataList(), |
1352 sync_processor_wrapper_.PassAs<syncer::SyncChangeProcessor>(), | 1352 sync_processor_wrapper_.PassAs<syncer::SyncChangeProcessor>(), |
1353 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock())); | 1353 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock())); |
1354 | 1354 |
1355 // Large local change rejected and doesn't get sent out. | 1355 // Large local change rejected and doesn't get sent out. |
1356 ValueStore* storage1 = AddExtensionAndGetStorage("s1", type); | 1356 ValueStore* storage1 = AddExtensionAndGetStorage("s1", type); |
1357 EXPECT_TRUE(storage1->Set(DEFAULTS, "large_value", large_value)->HasError()); | 1357 EXPECT_TRUE(storage1->Set(DEFAULTS, "large_value", large_value)->HasError()); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 ASSERT_EQ(1u, sync_processor_->changes().size()); | 1417 ASSERT_EQ(1u, sync_processor_->changes().size()); |
1418 SettingSyncData sync_data = sync_processor_->changes()[0]; | 1418 SettingSyncData sync_data = sync_processor_->changes()[0]; |
1419 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); | 1419 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); |
1420 EXPECT_EQ("ext", sync_data.extension_id()); | 1420 EXPECT_EQ("ext", sync_data.extension_id()); |
1421 EXPECT_EQ("key.with.spot", sync_data.key()); | 1421 EXPECT_EQ("key.with.spot", sync_data.key()); |
1422 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); | 1422 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); |
1423 } | 1423 } |
1424 } | 1424 } |
1425 | 1425 |
1426 } // namespace extensions | 1426 } // namespace extensions |
OLD | NEW |