diff options
Diffstat (limited to 'chrome/browser/extensions/api/storage')
13 files changed, 143 insertions, 141 deletions
diff --git a/chrome/browser/extensions/api/storage/setting_sync_data.cc b/chrome/browser/extensions/api/storage/setting_sync_data.cc index 42f72f2..212f5c7 100644 --- a/chrome/browser/extensions/api/storage/setting_sync_data.cc +++ b/chrome/browser/extensions/api/storage/setting_sync_data.cc @@ -46,7 +46,7 @@ void SettingSyncData::InitFromExtensionSettingSpecifics( syncer::SyncChange::SyncChangeType change_type, const sync_pb::ExtensionSettingSpecifics& specifics) { DCHECK(!internal_.get()); - scoped_ptr<Value> value( + scoped_ptr<base::Value> value( base::JSONReader::Read(specifics.value())); if (!value.get()) { LOG(WARNING) << "Specifics for " << specifics.extension_id() << "/" << @@ -64,7 +64,7 @@ SettingSyncData::SettingSyncData( syncer::SyncChange::SyncChangeType change_type, const std::string& extension_id, const std::string& key, - scoped_ptr<Value> value) + scoped_ptr<base::Value> value) : internal_(new Internal(change_type, extension_id, key, value.Pass())) {} SettingSyncData::~SettingSyncData() {} @@ -81,7 +81,7 @@ const std::string& SettingSyncData::key() const { return internal_->key_; } -const Value& SettingSyncData::value() const { +const base::Value& SettingSyncData::value() const { return *internal_->value_; } @@ -89,7 +89,7 @@ SettingSyncData::Internal::Internal( syncer::SyncChange::SyncChangeType change_type, const std::string& extension_id, const std::string& key, - scoped_ptr<Value> value) + scoped_ptr<base::Value> value) : change_type_(change_type), extension_id_(extension_id), key_(key), diff --git a/chrome/browser/extensions/api/storage/setting_sync_data.h b/chrome/browser/extensions/api/storage/setting_sync_data.h index 4cecb23..8fc0f91 100644 --- a/chrome/browser/extensions/api/storage/setting_sync_data.h +++ b/chrome/browser/extensions/api/storage/setting_sync_data.h @@ -35,7 +35,7 @@ class SettingSyncData { syncer::SyncChange::SyncChangeType change_type, const std::string& extension_id, const std::string& key, - scoped_ptr<Value> value); + scoped_ptr<base::Value> value); ~SettingSyncData(); @@ -49,7 +49,7 @@ class SettingSyncData { const std::string& key() const; // Returns the value of the setting. - const Value& value() const; + const base::Value& value() const; private: // Ref-counted container for the data. @@ -60,12 +60,12 @@ class SettingSyncData { syncer::SyncChange::SyncChangeType change_type, const std::string& extension_id, const std::string& key, - scoped_ptr<Value> value); + scoped_ptr<base::Value> value); syncer::SyncChange::SyncChangeType change_type_; std::string extension_id_; std::string key_; - scoped_ptr<Value> value_; + scoped_ptr<base::Value> value_; private: friend class base::RefCountedThreadSafe<Internal>; diff --git a/chrome/browser/extensions/api/storage/settings_apitest.cc b/chrome/browser/extensions/api/storage/settings_apitest.cc index 74be733..146cccd 100644 --- a/chrome/browser/extensions/api/storage/settings_apitest.cc +++ b/chrome/browser/extensions/api/storage/settings_apitest.cc @@ -376,7 +376,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, // Set "foo" to "bar" via sync. syncer::SyncChangeList sync_changes; - StringValue bar("bar"); + base::StringValue bar("bar"); sync_changes.push_back(settings_sync_util::CreateAdd( extension_id, "foo", bar, kModelType)); SendChanges(sync_changes); @@ -421,7 +421,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, // Set "foo" to "bar" via sync. syncer::SyncChangeList sync_changes; - StringValue bar("bar"); + base::StringValue bar("bar"); sync_changes.push_back(settings_sync_util::CreateAdd( extension_id, "foo", bar, kModelType)); SendChanges(sync_changes); diff --git a/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc index 03027bf..af00571 100644 --- a/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc @@ -30,21 +30,21 @@ namespace { const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS; // Creates a kilobyte of data. -scoped_ptr<Value> CreateKilobyte() { +scoped_ptr<base::Value> CreateKilobyte() { std::string kilobyte_string; for (int i = 0; i < 1024; ++i) { kilobyte_string += "a"; } - return scoped_ptr<Value>(new base::StringValue(kilobyte_string)); + return scoped_ptr<base::Value>(new base::StringValue(kilobyte_string)); } // Creates a megabyte of data. -scoped_ptr<Value> CreateMegabyte() { +scoped_ptr<base::Value> CreateMegabyte() { base::ListValue* megabyte = new base::ListValue(); for (int i = 0; i < 1000; ++i) { megabyte->Append(CreateKilobyte().release()); } - return scoped_ptr<Value>(megabyte); + return scoped_ptr<base::Value>(megabyte); } } // namespace @@ -103,7 +103,7 @@ TEST_F(ExtensionSettingsFrontendTest, SettingsPreservedAcrossReconstruction) { // The correctness of Get/Set/Remove/Clear is tested elsewhere so no need to // be too rigorous. { - StringValue bar("bar"); + base::StringValue bar("bar"); ValueStore::WriteResult result = storage->Set(DEFAULTS, "foo", bar); ASSERT_FALSE(result->HasError()); } @@ -134,7 +134,7 @@ TEST_F(ExtensionSettingsFrontendTest, SettingsClearedOnUninstall) { ValueStore* storage = util::GetStorage(id, frontend_.get()); { - StringValue bar("bar"); + base::StringValue bar("bar"); ValueStore::WriteResult result = storage->Set(DEFAULTS, "foo", bar); ASSERT_FALSE(result->HasError()); } @@ -162,7 +162,7 @@ TEST_F(ExtensionSettingsFrontendTest, LeveldbDatabaseDeletedFromDiskOnClear) { ValueStore* storage = util::GetStorage(id, frontend_.get()); { - StringValue bar("bar"); + base::StringValue bar("bar"); ValueStore::WriteResult result = storage->Set(DEFAULTS, "foo", bar); ASSERT_FALSE(result->HasError()); EXPECT_TRUE(base::PathExists(temp_dir_.path())); @@ -199,7 +199,7 @@ TEST_F(ExtensionSettingsFrontendTest, util::GetStorage(id, settings::LOCAL, frontend_.get()); // Sync storage should run out after ~100K. - scoped_ptr<Value> kilobyte = CreateKilobyte(); + scoped_ptr<base::Value> kilobyte = CreateKilobyte(); for (int i = 0; i < 100; ++i) { sync_storage->Set( ValueStore::DEFAULTS, base::StringPrintf("%d", i), *kilobyte); @@ -218,7 +218,7 @@ TEST_F(ExtensionSettingsFrontendTest, ValueStore::DEFAULTS, "WontError", *kilobyte)->HasError()); // Local storage should run out after ~5MB. - scoped_ptr<Value> megabyte = CreateMegabyte(); + scoped_ptr<base::Value> megabyte = CreateMegabyte(); for (int i = 0; i < 5; ++i) { local_storage->Set( ValueStore::DEFAULTS, base::StringPrintf("%d", i), *megabyte); @@ -236,7 +236,7 @@ TEST_F(ExtensionSettingsFrontendTest, static void UnlimitedSyncStorageTestCallback(ValueStore* sync_storage) { // Sync storage should still run out after ~100K; the unlimitedStorage // permission can't apply to sync. - scoped_ptr<Value> kilobyte = CreateKilobyte(); + scoped_ptr<base::Value> kilobyte = CreateKilobyte(); for (int i = 0; i < 100; ++i) { sync_storage->Set( ValueStore::DEFAULTS, base::StringPrintf("%d", i), *kilobyte); @@ -248,7 +248,7 @@ static void UnlimitedSyncStorageTestCallback(ValueStore* sync_storage) { static void UnlimitedLocalStorageTestCallback(ValueStore* local_storage) { // Local storage should never run out. - scoped_ptr<Value> megabyte = CreateMegabyte(); + scoped_ptr<base::Value> megabyte = CreateMegabyte(); for (int i = 0; i < 7; ++i) { local_storage->Set( ValueStore::DEFAULTS, base::StringPrintf("%d", i), *megabyte); diff --git a/chrome/browser/extensions/api/storage/settings_quota_unittest.cc b/chrome/browser/extensions/api/storage/settings_quota_unittest.cc index 7a87a60..48943bb 100644 --- a/chrome/browser/extensions/api/storage/settings_quota_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_quota_unittest.cc @@ -27,7 +27,7 @@ class ExtensionSettingsQuotaTest : public testing::Test { ExtensionSettingsQuotaTest() : byte_value_1_(new base::FundamentalValue(1)), byte_value_16_(new base::StringValue("sixteen bytes.")), - byte_value_256_(new ListValue()), + byte_value_256_(new base::ListValue()), delegate_(new TestingValueStore()) { for (int i = 1; i < 89; ++i) { byte_value_256_->Append(new base::FundamentalValue(i)); @@ -61,15 +61,15 @@ class ExtensionSettingsQuotaTest : public testing::Test { // Returns whether the settings in |storage_| and |delegate_| are the same as // |settings|. - bool SettingsEqual(const DictionaryValue& settings) { + bool SettingsEqual(const base::DictionaryValue& settings) { return settings.Equals(&storage_->Get()->settings()) && settings.Equals(&delegate_->Get()->settings()); } // Values with different serialized sizes. - scoped_ptr<Value> byte_value_1_; - scoped_ptr<Value> byte_value_16_; - scoped_ptr<ListValue> byte_value_256_; + scoped_ptr<base::Value> byte_value_1_; + scoped_ptr<base::Value> byte_value_16_; + scoped_ptr<base::ListValue> byte_value_256_; // Quota enforcing storage area being tested. scoped_ptr<SettingsStorageQuotaEnforcer> storage_; @@ -79,7 +79,7 @@ class ExtensionSettingsQuotaTest : public testing::Test { }; TEST_F(ExtensionSettingsQuotaTest, ZeroQuotaBytes) { - DictionaryValue empty; + base::DictionaryValue empty; CreateStorage(0, UINT_MAX, UINT_MAX); EXPECT_TRUE(storage_->Set(DEFAULTS, "a", *byte_value_1_)->HasError()); @@ -89,7 +89,7 @@ TEST_F(ExtensionSettingsQuotaTest, ZeroQuotaBytes) { } TEST_F(ExtensionSettingsQuotaTest, KeySizeTakenIntoAccount) { - DictionaryValue empty; + base::DictionaryValue empty; CreateStorage(8u, UINT_MAX, UINT_MAX); EXPECT_TRUE( storage_->Set(DEFAULTS, "Really long key", *byte_value_1_)->HasError()); @@ -97,7 +97,7 @@ TEST_F(ExtensionSettingsQuotaTest, KeySizeTakenIntoAccount) { } TEST_F(ExtensionSettingsQuotaTest, SmallByteQuota) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(8u, UINT_MAX, UINT_MAX); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", *byte_value_1_)->HasError()); @@ -110,10 +110,10 @@ TEST_F(ExtensionSettingsQuotaTest, SmallByteQuota) { } TEST_F(ExtensionSettingsQuotaTest, MediumByteQuota) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(40, UINT_MAX, UINT_MAX); - DictionaryValue to_set; + base::DictionaryValue to_set; to_set.Set("a", byte_value_1_->DeepCopy()); to_set.Set("b", byte_value_16_->DeepCopy()); EXPECT_FALSE(storage_->Set(DEFAULTS, to_set)->HasError()); @@ -132,7 +132,7 @@ TEST_F(ExtensionSettingsQuotaTest, MediumByteQuota) { } TEST_F(ExtensionSettingsQuotaTest, ZeroMaxKeys) { - DictionaryValue empty; + base::DictionaryValue empty; CreateStorage(UINT_MAX, UINT_MAX, 0); EXPECT_TRUE(storage_->Set(DEFAULTS, "a", *byte_value_1_)->HasError()); @@ -142,7 +142,7 @@ TEST_F(ExtensionSettingsQuotaTest, ZeroMaxKeys) { } TEST_F(ExtensionSettingsQuotaTest, SmallMaxKeys) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(UINT_MAX, UINT_MAX, 1); EXPECT_FALSE(storage_->Set(DEFAULTS, "a", *byte_value_1_)->HasError()); @@ -160,10 +160,10 @@ TEST_F(ExtensionSettingsQuotaTest, SmallMaxKeys) { } TEST_F(ExtensionSettingsQuotaTest, MediumMaxKeys) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(UINT_MAX, UINT_MAX, 2); - DictionaryValue to_set; + base::DictionaryValue to_set; to_set.Set("a", byte_value_1_->DeepCopy()); to_set.Set("b", byte_value_16_->DeepCopy()); EXPECT_FALSE(storage_->Set(DEFAULTS, to_set)->HasError()); @@ -183,7 +183,7 @@ TEST_F(ExtensionSettingsQuotaTest, MediumMaxKeys) { } TEST_F(ExtensionSettingsQuotaTest, RemovingExistingSettings) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(266, UINT_MAX, 2); storage_->Set(DEFAULTS, "b", *byte_value_16_); @@ -216,11 +216,11 @@ TEST_F(ExtensionSettingsQuotaTest, RemovingExistingSettings) { } TEST_F(ExtensionSettingsQuotaTest, RemovingNonexistentSettings) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(36, UINT_MAX, 3); // Max out bytes. - DictionaryValue to_set; + base::DictionaryValue to_set; to_set.Set("b1", byte_value_16_->DeepCopy()); to_set.Set("b2", byte_value_16_->DeepCopy()); storage_->Set(DEFAULTS, to_set); @@ -266,12 +266,12 @@ TEST_F(ExtensionSettingsQuotaTest, RemovingNonexistentSettings) { } TEST_F(ExtensionSettingsQuotaTest, Clear) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(40, UINT_MAX, 5); // Test running out of byte quota. { - DictionaryValue to_set; + base::DictionaryValue to_set; to_set.Set("a", byte_value_16_->DeepCopy()); to_set.Set("b", byte_value_16_->DeepCopy()); EXPECT_FALSE(storage_->Set(DEFAULTS, to_set)->HasError()); @@ -287,7 +287,7 @@ TEST_F(ExtensionSettingsQuotaTest, Clear) { // Test reaching max keys. storage_->Clear(); { - DictionaryValue to_set; + base::DictionaryValue to_set; to_set.Set("a", byte_value_1_->DeepCopy()); to_set.Set("b", byte_value_1_->DeepCopy()); to_set.Set("c", byte_value_1_->DeepCopy()); @@ -305,7 +305,7 @@ TEST_F(ExtensionSettingsQuotaTest, Clear) { } TEST_F(ExtensionSettingsQuotaTest, ChangingUsedBytesWithSet) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(20, UINT_MAX, UINT_MAX); // Change a setting to make it go over quota. @@ -327,14 +327,14 @@ TEST_F(ExtensionSettingsQuotaTest, ChangingUsedBytesWithSet) { } TEST_F(ExtensionSettingsQuotaTest, SetsOnlyEntirelyCompletedWithByteQuota) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(40, UINT_MAX, UINT_MAX); storage_->Set(DEFAULTS, "a", *byte_value_16_); settings.Set("a", byte_value_16_->DeepCopy()); // The entire change is over quota. - DictionaryValue to_set; + base::DictionaryValue to_set; to_set.Set("b", byte_value_16_->DeepCopy()); to_set.Set("c", byte_value_16_->DeepCopy()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set)->HasError()); @@ -350,13 +350,13 @@ TEST_F(ExtensionSettingsQuotaTest, SetsOnlyEntirelyCompletedWithByteQuota) { } TEST_F(ExtensionSettingsQuotaTest, SetsOnlyEntireCompletedWithMaxKeys) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(UINT_MAX, UINT_MAX, 2); storage_->Set(DEFAULTS, "a", *byte_value_1_); settings.Set("a", byte_value_1_->DeepCopy()); - DictionaryValue to_set; + base::DictionaryValue to_set; to_set.Set("b", byte_value_16_->DeepCopy()); to_set.Set("c", byte_value_16_->DeepCopy()); EXPECT_TRUE(storage_->Set(DEFAULTS, to_set)->HasError()); @@ -364,7 +364,7 @@ TEST_F(ExtensionSettingsQuotaTest, SetsOnlyEntireCompletedWithMaxKeys) { } TEST_F(ExtensionSettingsQuotaTest, WithInitialDataAndByteQuota) { - DictionaryValue settings; + base::DictionaryValue settings; delegate_->Set(DEFAULTS, "a", *byte_value_256_); settings.Set("a", byte_value_256_->DeepCopy()); @@ -406,7 +406,7 @@ TEST_F(ExtensionSettingsQuotaTest, WithInitialDataAndByteQuota) { } TEST_F(ExtensionSettingsQuotaTest, WithInitialDataAndMaxKeys) { - DictionaryValue settings; + base::DictionaryValue settings; delegate_->Set(DEFAULTS, "a", *byte_value_1_); settings.Set("a", byte_value_1_->DeepCopy()); CreateStorage(UINT_MAX, UINT_MAX, 2); @@ -420,7 +420,7 @@ TEST_F(ExtensionSettingsQuotaTest, WithInitialDataAndMaxKeys) { } TEST_F(ExtensionSettingsQuotaTest, InitiallyOverByteQuota) { - DictionaryValue settings; + base::DictionaryValue settings; settings.Set("a", byte_value_16_->DeepCopy()); settings.Set("b", byte_value_16_->DeepCopy()); settings.Set("c", byte_value_16_->DeepCopy()); @@ -443,7 +443,7 @@ TEST_F(ExtensionSettingsQuotaTest, InitiallyOverByteQuota) { } TEST_F(ExtensionSettingsQuotaTest, InitiallyOverMaxKeys) { - DictionaryValue settings; + base::DictionaryValue settings; settings.Set("a", byte_value_16_->DeepCopy()); settings.Set("b", byte_value_16_->DeepCopy()); settings.Set("c", byte_value_16_->DeepCopy()); @@ -475,7 +475,7 @@ TEST_F(ExtensionSettingsQuotaTest, InitiallyOverMaxKeys) { } TEST_F(ExtensionSettingsQuotaTest, ZeroQuotaBytesPerSetting) { - DictionaryValue empty; + base::DictionaryValue empty; CreateStorage(UINT_MAX, 0, UINT_MAX); EXPECT_TRUE(storage_->Set(DEFAULTS, "a", *byte_value_1_)->HasError()); @@ -485,7 +485,7 @@ TEST_F(ExtensionSettingsQuotaTest, ZeroQuotaBytesPerSetting) { } TEST_F(ExtensionSettingsQuotaTest, QuotaBytesPerSetting) { - DictionaryValue settings; + base::DictionaryValue settings; CreateStorage(UINT_MAX, 20, UINT_MAX); @@ -503,7 +503,7 @@ TEST_F(ExtensionSettingsQuotaTest, QuotaBytesPerSetting) { } TEST_F(ExtensionSettingsQuotaTest, QuotaBytesPerSettingWithInitialSettings) { - DictionaryValue settings; + base::DictionaryValue settings; delegate_->Set(DEFAULTS, "a", *byte_value_1_); delegate_->Set(DEFAULTS, "b", *byte_value_16_); @@ -533,7 +533,7 @@ TEST_F(ExtensionSettingsQuotaTest, // This is a lazy test to make sure IGNORE_QUOTA lets through changes: the // test above copied, but using IGNORE_QUOTA and asserting nothing is ever // rejected... - DictionaryValue settings; + base::DictionaryValue settings; delegate_->Set(DEFAULTS, "a", *byte_value_1_); delegate_->Set(DEFAULTS, "b", *byte_value_16_); diff --git a/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.cc b/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.cc index 6961cb9..25162d5 100644 --- a/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.cc +++ b/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.cc @@ -29,7 +29,7 @@ enum Resource { // Allocates a setting in a record of total and per-setting usage. void Allocate( const std::string& key, - const Value& value, + const base::Value& value, size_t* used_total, std::map<std::string, size_t>* used_per_setting) { // Calculate the setting size based on its JSON serialization size. @@ -139,7 +139,7 @@ ValueStore::ReadResult SettingsStorageQuotaEnforcer::Get() { } ValueStore::WriteResult SettingsStorageQuotaEnforcer::Set( - WriteOptions options, const std::string& key, const Value& value) { + WriteOptions options, const std::string& key, const base::Value& value) { size_t new_used_total = used_total_; std::map<std::string, size_t> new_used_per_setting = used_per_setting_; Allocate(key, value, &new_used_total, &new_used_per_setting); diff --git a/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h b/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h index 7db793e..f8283d3 100644 --- a/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h +++ b/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h @@ -40,7 +40,7 @@ class SettingsStorageQuotaEnforcer : public ValueStore { virtual WriteResult Set( WriteOptions options, const std::string& key, - const Value& value) OVERRIDE; + const base::Value& value) OVERRIDE; virtual WriteResult Set( WriteOptions options, const base::DictionaryValue& values) OVERRIDE; virtual WriteResult Remove(const std::string& key) OVERRIDE; diff --git a/chrome/browser/extensions/api/storage/settings_sync_processor.cc b/chrome/browser/extensions/api/storage/settings_sync_processor.cc index b016e9e..ef815c1 100644 --- a/chrome/browser/extensions/api/storage/settings_sync_processor.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_processor.cc @@ -54,7 +54,7 @@ syncer::SyncError SettingsSyncProcessor::SendChanges( for (ValueStoreChangeList::const_iterator i = changes.begin(); i != changes.end(); ++i) { const std::string& key = i->key(); - const Value* value = i->new_value(); + const base::Value* value = i->new_value(); if (value) { if (synced_keys_.count(key)) { // New value, key is synced; send ACTION_UPDATE. diff --git a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc index 3f42000..7311b3e 100644 --- a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc @@ -39,7 +39,7 @@ namespace { const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS; // Gets the pretty-printed JSON for a value. -static std::string GetJson(const Value& value) { +static std::string GetJson(const base::Value& value) { std::string json; base::JSONWriter::WriteWithOptions(&value, base::JSONWriter::OPTIONS_PRETTY_PRINT, @@ -50,8 +50,8 @@ static std::string GetJson(const Value& value) { // Returns whether two Values are equal. testing::AssertionResult ValuesEq( const char* _1, const char* _2, - const Value* expected, - const Value* actual) { + const base::Value* expected, + const base::Value* actual) { if (expected == actual) { return testing::AssertionSuccess(); } @@ -74,7 +74,7 @@ testing::AssertionResult ValuesEq( // Logs when different. testing::AssertionResult SettingsEq( const char* _1, const char* _2, - const DictionaryValue& expected, + const base::DictionaryValue& expected, ValueStore::ReadResult actual) { if (actual->HasError()) { return testing::AssertionFailure() << @@ -142,7 +142,8 @@ class MockSyncChangeProcessor : public syncer::SyncChangeProcessor { return SettingSyncData(syncer::SyncChange::ACTION_INVALID, std::string(), std::string(), - scoped_ptr<Value>(new DictionaryValue())); + scoped_ptr<base::Value>( + new base::DictionaryValue())); } if (matching_changes.size() != 1u) { ADD_FAILURE() << matching_changes.size() << " matching changes for " << @@ -315,8 +316,8 @@ TEST_F(ExtensionSettingsSyncTest, InSyncDataDoesNotInvokeSync) { syncer::ModelType model_type = syncer::APP_SETTINGS; Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; - StringValue value1("fooValue"); - ListValue value2; + base::StringValue value1("fooValue"); + base::ListValue value2; value2.Append(new base::StringValue("barValue")); ValueStore* storage1 = AddExtensionAndGetStorage("s1", type); @@ -365,8 +366,8 @@ TEST_F(ExtensionSettingsSyncTest, LocalDataWithNoSyncDataIsPushedToSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; Manifest::Type type = Manifest::TYPE_EXTENSION; - StringValue value1("fooValue"); - ListValue value2; + base::StringValue value1("fooValue"); + base::ListValue value2; value2.Append(new base::StringValue("barValue")); ValueStore* storage1 = AddExtensionAndGetStorage("s1", type); @@ -397,13 +398,13 @@ TEST_F(ExtensionSettingsSyncTest, AnySyncDataOverwritesLocalData) { syncer::ModelType model_type = syncer::APP_SETTINGS; Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; - StringValue value1("fooValue"); - ListValue value2; + base::StringValue value1("fooValue"); + base::ListValue value2; value2.Append(new base::StringValue("barValue")); // Maintain dictionaries mirrored to the expected values of the settings in // each storage area. - DictionaryValue expected1, expected2; + base::DictionaryValue expected1, expected2; // Pre-populate one of the storage areas. ValueStore* storage1 = AddExtensionAndGetStorage("s1", type); @@ -437,13 +438,13 @@ TEST_F(ExtensionSettingsSyncTest, ProcessSyncChanges) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; Manifest::Type type = Manifest::TYPE_EXTENSION; - StringValue value1("fooValue"); - ListValue value2; + base::StringValue value1("fooValue"); + base::ListValue value2; value2.Append(new base::StringValue("barValue")); // Maintain dictionaries mirrored to the expected values of the settings in // each storage area. - DictionaryValue expected1, expected2; + base::DictionaryValue expected1, expected2; // Make storage1 initialised from local data, storage2 initialised from sync. ValueStore* storage1 = AddExtensionAndGetStorage("s1", type); @@ -510,8 +511,8 @@ TEST_F(ExtensionSettingsSyncTest, PushToSync) { syncer::ModelType model_type = syncer::APP_SETTINGS; Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; - StringValue value1("fooValue"); - ListValue value2; + base::StringValue value1("fooValue"); + base::ListValue value2; value2.Append(new base::StringValue("barValue")); // Make storage1/2 initialised from local data, storage3/4 initialised from @@ -649,8 +650,8 @@ TEST_F(ExtensionSettingsSyncTest, PushToSync) { } TEST_F(ExtensionSettingsSyncTest, ExtensionAndAppSettingsSyncSeparately) { - StringValue value1("fooValue"); - ListValue value2; + base::StringValue value1("fooValue"); + base::ListValue value2; value2.Append(new base::StringValue("barValue")); // storage1 is an extension, storage2 is an app. @@ -708,8 +709,8 @@ TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; Manifest::Type type = Manifest::TYPE_EXTENSION; - StringValue fooValue("fooValue"); - StringValue barValue("barValue"); + base::StringValue fooValue("fooValue"); + base::StringValue barValue("barValue"); // There is a bit of a convoluted method to get storage areas that can fail; // hand out TestingValueStore object then toggle them failing/succeeding @@ -738,12 +739,12 @@ TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK); { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -758,13 +759,13 @@ TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { EXPECT_EQ(1u, sync_processor_->changes().size()); { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -783,13 +784,13 @@ TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", barValue.DeepCopy()); dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -806,13 +807,13 @@ TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { EXPECT_EQ(1u, sync_processor_->changes().size()); { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", barValue.DeepCopy()); dict.Set("bar", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("bar", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -831,13 +832,13 @@ TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK); { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); dict.Set("bar", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("bar", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -890,13 +891,13 @@ TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); dict.Set("bar", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("bar", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -908,8 +909,8 @@ TEST_F(ExtensionSettingsSyncTest, FailingProcessChangesDisablesSync) { syncer::ModelType model_type = syncer::APP_SETTINGS; Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; - StringValue fooValue("fooValue"); - StringValue barValue("barValue"); + base::StringValue fooValue("fooValue"); + base::StringValue barValue("barValue"); TestingValueStoreFactory* testing_factory = new TestingValueStoreFactory(); storage_factory_->Reset(testing_factory); @@ -935,12 +936,12 @@ TEST_F(ExtensionSettingsSyncTest, FailingProcessChangesDisablesSync) { EXPECT_EQ(0u, sync_processor_->changes().size()); { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -958,13 +959,13 @@ TEST_F(ExtensionSettingsSyncTest, FailingProcessChangesDisablesSync) { testing_factory->GetExisting("bad")->set_error_code(ValueStore::OK); { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -990,13 +991,13 @@ TEST_F(ExtensionSettingsSyncTest, FailingProcessChangesDisablesSync) { } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -1006,8 +1007,8 @@ TEST_F(ExtensionSettingsSyncTest, FailingGetAllSyncDataDoesntStopSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; Manifest::Type type = Manifest::TYPE_EXTENSION; - StringValue fooValue("fooValue"); - StringValue barValue("barValue"); + base::StringValue fooValue("fooValue"); + base::StringValue barValue("barValue"); TestingValueStoreFactory* testing_factory = new TestingValueStoreFactory(); storage_factory_->Reset(testing_factory); @@ -1061,8 +1062,8 @@ TEST_F(ExtensionSettingsSyncTest, FailureToReadChangesToPushDisablesSync) { syncer::ModelType model_type = syncer::APP_SETTINGS; Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; - StringValue fooValue("fooValue"); - StringValue barValue("barValue"); + base::StringValue fooValue("fooValue"); + base::StringValue barValue("barValue"); TestingValueStoreFactory* testing_factory = new TestingValueStoreFactory(); storage_factory_->Reset(testing_factory); @@ -1110,13 +1111,13 @@ TEST_F(ExtensionSettingsSyncTest, FailureToReadChangesToPushDisablesSync) { } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", barValue.DeepCopy()); dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", fooValue.DeepCopy()); dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); @@ -1165,8 +1166,8 @@ TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalStateDisablesSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; Manifest::Type type = Manifest::TYPE_EXTENSION; - StringValue fooValue("fooValue"); - StringValue barValue("barValue"); + base::StringValue fooValue("fooValue"); + base::StringValue barValue("barValue"); TestingValueStoreFactory* testing_factory = new TestingValueStoreFactory(); storage_factory_->Reset(testing_factory); @@ -1206,13 +1207,13 @@ TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalStateDisablesSync) { } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", barValue.DeepCopy()); dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -1256,8 +1257,8 @@ TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalChangeDisablesSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; Manifest::Type type = Manifest::TYPE_EXTENSION; - StringValue fooValue("fooValue"); - StringValue barValue("barValue"); + base::StringValue fooValue("fooValue"); + base::StringValue barValue("barValue"); TestingValueStoreFactory* testing_factory = new TestingValueStoreFactory(); storage_factory_->Reset(testing_factory); @@ -1303,13 +1304,13 @@ TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalChangeDisablesSync) { } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", barValue.DeepCopy()); dict.Set("bar", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, good->Get()); } { - DictionaryValue dict; + base::DictionaryValue dict; dict.Set("foo", barValue.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, dict, bad->Get()); } @@ -1359,7 +1360,7 @@ TEST_F(ExtensionSettingsSyncTest, for (size_t i = 0; i < 5000; ++i) { string_5k.append("a"); } - StringValue large_value(string_5k); + base::StringValue large_value(string_5k); GetSyncableService(model_type)->MergeDataAndStartSyncing( model_type, @@ -1383,7 +1384,7 @@ TEST_F(ExtensionSettingsSyncTest, GetSyncableService(model_type)->ProcessSyncChanges(FROM_HERE, change_list); } { - DictionaryValue expected; + base::DictionaryValue expected; expected.Set("large_value", large_value.DeepCopy()); EXPECT_PRED_FORMAT2(SettingsEq, expected, storage1->Get()); EXPECT_PRED_FORMAT2(SettingsEq, expected, storage2->Get()); @@ -1400,7 +1401,7 @@ TEST_F(ExtensionSettingsSyncTest, Dots) { { syncer::SyncDataList sync_data_list; - scoped_ptr<Value> string_value(new base::StringValue("value")); + scoped_ptr<base::Value> string_value(new base::StringValue("value")); sync_data_list.push_back(settings_sync_util::CreateData( "ext", "key.with.dot", *string_value, model_type)); @@ -1417,16 +1418,16 @@ TEST_F(ExtensionSettingsSyncTest, Dots) { ValueStore::ReadResult data = storage->Get(); ASSERT_FALSE(data->HasError()); - DictionaryValue expected_data; + base::DictionaryValue expected_data; expected_data.SetWithoutPathExpansion( "key.with.dot", new base::StringValue("value")); - EXPECT_TRUE(Value::Equals(&expected_data, &data->settings())); + EXPECT_TRUE(base::Value::Equals(&expected_data, &data->settings())); } // Test dots in keys going to sync. { - scoped_ptr<Value> string_value(new base::StringValue("spot")); + scoped_ptr<base::Value> string_value(new base::StringValue("spot")); storage->Set(DEFAULTS, "key.with.spot", *string_value); ASSERT_EQ(1u, sync_processor_->changes().size()); diff --git a/chrome/browser/extensions/api/storage/settings_sync_util.cc b/chrome/browser/extensions/api/storage/settings_sync_util.cc index 4509ee9..b974aa3 100644 --- a/chrome/browser/extensions/api/storage/settings_sync_util.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_util.cc @@ -19,7 +19,7 @@ namespace { void PopulateExtensionSettingSpecifics( const std::string& extension_id, const std::string& key, - const Value& value, + const base::Value& value, sync_pb::ExtensionSettingSpecifics* specifics) { specifics->set_extension_id(extension_id); specifics->set_key(key); @@ -33,7 +33,7 @@ void PopulateExtensionSettingSpecifics( void PopulateAppSettingSpecifics( const std::string& extension_id, const std::string& key, - const Value& value, + const base::Value& value, sync_pb::AppSettingSpecifics* specifics) { PopulateExtensionSettingSpecifics( extension_id, key, value, specifics->mutable_extension_setting()); @@ -44,7 +44,7 @@ void PopulateAppSettingSpecifics( syncer::SyncData CreateData( const std::string& extension_id, const std::string& key, - const Value& value, + const base::Value& value, syncer::ModelType type) { sync_pb::EntitySpecifics specifics; switch (type) { @@ -75,7 +75,7 @@ syncer::SyncData CreateData( syncer::SyncChange CreateAdd( const std::string& extension_id, const std::string& key, - const Value& value, + const base::Value& value, syncer::ModelType type) { return syncer::SyncChange( FROM_HERE, @@ -86,7 +86,7 @@ syncer::SyncChange CreateAdd( syncer::SyncChange CreateUpdate( const std::string& extension_id, const std::string& key, - const Value& value, + const base::Value& value, syncer::ModelType type) { return syncer::SyncChange( FROM_HERE, diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc index fbfa0786..5c4b13e 100644 --- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc +++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc @@ -65,7 +65,7 @@ ValueStore::ReadResult SyncableSettingsStorage::Get() { } ValueStore::WriteResult SyncableSettingsStorage::Set( - WriteOptions options, const std::string& key, const Value& value) { + WriteOptions options, const std::string& key, const base::Value& value) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); WriteResult result = delegate_->Set(options, key, value); if (result->HasError()) { @@ -182,8 +182,9 @@ syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync( scoped_ptr<base::DictionaryValue> new_sync_state(sync_state.DeepCopy()); SettingSyncDataList changes; - for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd(); it.Advance()) { - scoped_ptr<Value> sync_value; + for (base::DictionaryValue::Iterator it(settings); + !it.IsAtEnd(); it.Advance()) { + scoped_ptr<base::Value> sync_value; if (new_sync_state->RemoveWithoutPathExpansion(it.key(), &sync_value)) { if (sync_value->Equals(&it.value())) { // Sync and local values are the same, no changes to send. @@ -203,7 +204,7 @@ syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync( syncer::SyncChange::ACTION_DELETE, extension_id_, it.key(), - scoped_ptr<Value>(new base::DictionaryValue()))); + scoped_ptr<base::Value>(new base::DictionaryValue()))); } } @@ -211,7 +212,7 @@ syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync( while (!new_sync_state->empty()) { base::DictionaryValue::Iterator first_entry(*new_sync_state); std::string key = first_entry.key(); - scoped_ptr<Value> value; + scoped_ptr<base::Value> value; CHECK(new_sync_state->RemoveWithoutPathExpansion(key, &value)); changes.push_back( SettingSyncData( @@ -253,9 +254,9 @@ syncer::SyncError SyncableSettingsStorage::ProcessSyncChanges( DCHECK_EQ(extension_id_, it->extension_id()); const std::string& key = it->key(); - const Value& value = it->value(); + const base::Value& value = it->value(); - scoped_ptr<Value> current_value; + scoped_ptr<base::Value> current_value; { ReadResult maybe_settings = Get(it->key()); if (maybe_settings->HasError()) { @@ -333,7 +334,7 @@ syncer::SyncError SyncableSettingsStorage::ProcessSyncChanges( syncer::SyncError SyncableSettingsStorage::OnSyncAdd( const std::string& key, - Value* new_value, + base::Value* new_value, ValueStoreChangeList* changes) { DCHECK(new_value); WriteResult result = delegate_->Set(IGNORE_QUOTA, key, *new_value); @@ -351,8 +352,8 @@ syncer::SyncError SyncableSettingsStorage::OnSyncAdd( syncer::SyncError SyncableSettingsStorage::OnSyncUpdate( const std::string& key, - Value* old_value, - Value* new_value, + base::Value* old_value, + base::Value* new_value, ValueStoreChangeList* changes) { DCHECK(old_value); DCHECK(new_value); @@ -371,7 +372,7 @@ syncer::SyncError SyncableSettingsStorage::OnSyncUpdate( syncer::SyncError SyncableSettingsStorage::OnSyncDelete( const std::string& key, - Value* old_value, + base::Value* old_value, ValueStoreChangeList* changes) { DCHECK(old_value); WriteResult result = delegate_->Remove(key); diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.h b/chrome/browser/extensions/api/storage/syncable_settings_storage.h index d971ef0..bffc829 100644 --- a/chrome/browser/extensions/api/storage/syncable_settings_storage.h +++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.h @@ -41,7 +41,7 @@ class SyncableSettingsStorage : public ValueStore { virtual WriteResult Set( WriteOptions options, const std::string& key, - const Value& value) OVERRIDE; + const base::Value& value) OVERRIDE; virtual WriteResult Set( WriteOptions options, const base::DictionaryValue& values) OVERRIDE; virtual WriteResult Remove(const std::string& key) OVERRIDE; @@ -80,16 +80,16 @@ class SyncableSettingsStorage : public ValueStore { // are taken. syncer::SyncError OnSyncAdd( const std::string& key, - Value* new_value, + base::Value* new_value, ValueStoreChangeList* changes); syncer::SyncError OnSyncUpdate( const std::string& key, - Value* old_value, - Value* new_value, + base::Value* old_value, + base::Value* new_value, ValueStoreChangeList* changes); syncer::SyncError OnSyncDelete( const std::string& key, - Value* old_value, + base::Value* old_value, ValueStoreChangeList* changes); // List of observers to settings changes. diff --git a/chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.h b/chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.h index 66a4002..ca95324 100644 --- a/chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.h +++ b/chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.h @@ -30,7 +30,7 @@ class WeakUnlimitedSettingsStorage : public ValueStore { virtual WriteResult Set( WriteOptions options, const std::string& key, - const Value& value) OVERRIDE; + const base::Value& value) OVERRIDE; virtual WriteResult Set( WriteOptions options, const base::DictionaryValue& values) OVERRIDE; virtual WriteResult Remove(const std::string& key) OVERRIDE; |