Index: chrome/browser/prefs/pref_hash_store_impl_unittest.cc |
diff --git a/chrome/browser/prefs/pref_hash_store_impl_unittest.cc b/chrome/browser/prefs/pref_hash_store_impl_unittest.cc |
index 5a53ef5b10a4425dc0e7499656a7a938562ca568..139e9e05c3e0a89262a4610f6c11c1376f8c2c8e 100644 |
--- a/chrome/browser/prefs/pref_hash_store_impl_unittest.cc |
+++ b/chrome/browser/prefs/pref_hash_store_impl_unittest.cc |
@@ -31,7 +31,6 @@ class MockHashStoreContents : public HashStoreContents { |
scoped_ptr<base::DictionaryValue> contents; |
std::string super_mac; |
- scoped_ptr<int> version; |
bool commit_performed; |
}; |
@@ -43,21 +42,10 @@ class MockHashStoreContents : public HashStoreContents { |
virtual void Reset() OVERRIDE { |
data_->contents.reset(); |
data_->super_mac = ""; |
- data_->version.reset(); |
} |
virtual bool IsInitialized() const OVERRIDE { return data_->contents; } |
- virtual bool GetVersion(int* version) const OVERRIDE { |
- if (data_->version) |
- *version = *data_->version; |
- return data_->version; |
- } |
- |
- virtual void SetVersion(int version) OVERRIDE { |
- data_->version.reset(new int(version)); |
- } |
- |
virtual const base::DictionaryValue* GetContents() const OVERRIDE { |
return data_->contents.get(); |
} |
@@ -432,80 +420,3 @@ TEST_F(PrefHashStoreImplTest, TrustedUnknownSplitValueFromExistingAtomic) { |
EXPECT_TRUE(invalid_keys.empty()); |
} |
} |
- |
-TEST_F(PrefHashStoreImplTest, GetCurrentVersion) { |
- COMPILE_ASSERT(PrefHashStoreImpl::VERSION_LATEST == 2, |
- new_versions_should_be_tested_here); |
- { |
- PrefHashStoreImpl pref_hash_store( |
- std::string(32, 0), "device_id", CreateHashStoreContents()); |
- |
- // VERSION_UNINITIALIZED when no hashes are stored. |
- EXPECT_EQ(PrefHashStoreImpl::VERSION_UNINITIALIZED, |
- pref_hash_store.GetCurrentVersion()); |
- |
- scoped_ptr<PrefHashStoreTransaction> transaction( |
- pref_hash_store.BeginTransaction()); |
- base::StringValue string_value("foo"); |
- transaction->StoreHash("path1", &string_value); |
- |
- // Test that |pref_hash_store| flushes its content to disk when it |
- // initializes its version. |
- transaction.reset(); |
- pref_hash_store.CommitPendingWrite(); |
- EXPECT_TRUE(hash_store_data_.GetCommitPerformedAndReset()); |
- } |
- { |
- PrefHashStoreImpl pref_hash_store( |
- std::string(32, 0), "device_id", CreateHashStoreContents()); |
- |
- // VERSION_LATEST after storing a hash. |
- EXPECT_EQ(PrefHashStoreImpl::VERSION_LATEST, |
- pref_hash_store.GetCurrentVersion()); |
- |
- // Test that |pref_hash_store| doesn't flush its contents to disk when it |
- // didn't change. |
- pref_hash_store.CommitPendingWrite(); |
- EXPECT_FALSE(hash_store_data_.GetCommitPerformedAndReset()); |
- } |
- |
- // Manually clear the version number. |
- hash_store_data_.version.reset(); |
- |
- { |
- PrefHashStoreImpl pref_hash_store( |
- std::string(32, 0), "device_id", CreateHashStoreContents()); |
- |
- // VERSION_PRE_MIGRATION when no version is stored. |
- EXPECT_EQ(PrefHashStoreImpl::VERSION_PRE_MIGRATION, |
- pref_hash_store.GetCurrentVersion()); |
- |
- scoped_ptr<PrefHashStoreTransaction> transaction( |
- pref_hash_store.BeginTransaction()); |
- |
- // Test that |pref_hash_store| flushes its content to disk when it |
- // re-initializes its version. |
- transaction.reset(); |
- pref_hash_store.CommitPendingWrite(); |
- EXPECT_TRUE(hash_store_data_.GetCommitPerformedAndReset()); |
- } |
- { |
- PrefHashStoreImpl pref_hash_store( |
- std::string(32, 0), "device_id", CreateHashStoreContents()); |
- |
- // Back to VERSION_LATEST after performing a transaction from |
- // VERSION_PRE_MIGRATION (the presence of an existing hash should be |
- // sufficient, no need for the transaction itself to perform any work). |
- EXPECT_EQ(PrefHashStoreImpl::VERSION_LATEST, |
- pref_hash_store.GetCurrentVersion()); |
- |
- // Test that |pref_hash_store| doesn't flush its contents to disk when it |
- // didn't change (i.e., its version was already up-to-date and the only |
- // transaction performed was empty). |
- scoped_ptr<PrefHashStoreTransaction> transaction( |
- pref_hash_store.BeginTransaction()); |
- transaction.reset(); |
- pref_hash_store.CommitPendingWrite(); |
- EXPECT_FALSE(hash_store_data_.GetCommitPerformedAndReset()); |
- } |
-} |