| Index: chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc
|
| diff --git a/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc b/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc
|
| index 7bf8f7c3808db4e3af1df42f630dd1e90b64e4d8..fe7d9a823cff4ca5b737e0c87850cdbc39eb089b 100644
|
| --- a/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc
|
| +++ b/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc
|
| @@ -32,9 +32,9 @@ class ResourceMetadataStorageTest : public testing::Test {
|
| // Overwrites |storage_|'s version.
|
| void SetDBVersion(int version) {
|
| ResourceMetadataHeader header;
|
| - ASSERT_TRUE(storage_->GetHeader(&header));
|
| + ASSERT_EQ(FILE_ERROR_OK, storage_->GetHeader(&header));
|
| header.set_version(version);
|
| - EXPECT_TRUE(storage_->PutHeader(header));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutHeader(header));
|
| }
|
|
|
| bool CheckValidity() {
|
| @@ -69,8 +69,11 @@ class ResourceMetadataStorageTest : public testing::Test {
|
|
|
| TEST_F(ResourceMetadataStorageTest, LargestChangestamp) {
|
| const int64 kLargestChangestamp = 1234567890;
|
| - EXPECT_TRUE(storage_->SetLargestChangestamp(kLargestChangestamp));
|
| - EXPECT_EQ(kLargestChangestamp, storage_->GetLargestChangestamp());
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->SetLargestChangestamp(kLargestChangestamp));
|
| + int64 value = 0;
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetLargestChangestamp(&value));
|
| + EXPECT_EQ(kLargestChangestamp, value);
|
| }
|
|
|
| TEST_F(ResourceMetadataStorageTest, PutEntry) {
|
| @@ -82,56 +85,60 @@ TEST_F(ResourceMetadataStorageTest, PutEntry) {
|
|
|
| // key1 not found.
|
| ResourceEntry result;
|
| - EXPECT_FALSE(storage_->GetEntry(key1, &result));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetEntry(key1, &result));
|
|
|
| // Put entry1.
|
| ResourceEntry entry1;
|
| entry1.set_local_id(key1);
|
| - EXPECT_TRUE(storage_->PutEntry(entry1));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry1));
|
|
|
| // key1 found.
|
| - EXPECT_TRUE(storage_->GetEntry(key1, &result));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetEntry(key1, &result));
|
|
|
| // key2 not found.
|
| - EXPECT_FALSE(storage_->GetEntry(key2, &result));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetEntry(key2, &result));
|
|
|
| // Put entry2 as a child of entry1.
|
| ResourceEntry entry2;
|
| entry2.set_local_id(key2);
|
| entry2.set_parent_local_id(key1);
|
| entry2.set_base_name(name2);
|
| - EXPECT_TRUE(storage_->PutEntry(entry2));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry2));
|
|
|
| // key2 found.
|
| - EXPECT_TRUE(storage_->GetEntry(key2, &result));
|
| - EXPECT_EQ(key2, storage_->GetChild(key1, name2));
|
| + std::string child_id;
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetEntry(key2, &result));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetChild(key1, name2, &child_id));
|
| + EXPECT_EQ(key2, child_id);
|
|
|
| // Put entry3 as a child of entry2.
|
| ResourceEntry entry3;
|
| entry3.set_local_id(key3);
|
| entry3.set_parent_local_id(key2);
|
| entry3.set_base_name(name3);
|
| - EXPECT_TRUE(storage_->PutEntry(entry3));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry3));
|
|
|
| // key3 found.
|
| - EXPECT_TRUE(storage_->GetEntry(key3, &result));
|
| - EXPECT_EQ(key3, storage_->GetChild(key2, name3));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetEntry(key3, &result));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetChild(key2, name3, &child_id));
|
| + EXPECT_EQ(key3, child_id);
|
|
|
| // Change entry3's parent to entry1.
|
| entry3.set_parent_local_id(key1);
|
| - EXPECT_TRUE(storage_->PutEntry(entry3));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry3));
|
|
|
| // entry3 is a child of entry1 now.
|
| - EXPECT_TRUE(storage_->GetChild(key2, name3).empty());
|
| - EXPECT_EQ(key3, storage_->GetChild(key1, name3));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetChild(key2, name3, &child_id));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetChild(key1, name3, &child_id));
|
| + EXPECT_EQ(key3, child_id);
|
|
|
| // Remove entries.
|
| - EXPECT_TRUE(storage_->RemoveEntry(key3));
|
| - EXPECT_FALSE(storage_->GetEntry(key3, &result));
|
| - EXPECT_TRUE(storage_->RemoveEntry(key2));
|
| - EXPECT_FALSE(storage_->GetEntry(key2, &result));
|
| - EXPECT_TRUE(storage_->RemoveEntry(key1));
|
| - EXPECT_FALSE(storage_->GetEntry(key1, &result));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key3));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetEntry(key3, &result));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key2));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetEntry(key2, &result));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key1));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetEntry(key1, &result));
|
| }
|
|
|
| TEST_F(ResourceMetadataStorageTest, Iterator) {
|
| @@ -146,7 +153,7 @@ TEST_F(ResourceMetadataStorageTest, Iterator) {
|
| for (size_t i = 0; i < keys.size(); ++i) {
|
| ResourceEntry entry;
|
| entry.set_local_id(keys[i]);
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
| }
|
|
|
| // Insert some cache entries.
|
| @@ -155,7 +162,7 @@ TEST_F(ResourceMetadataStorageTest, Iterator) {
|
| cache_entries[keys[1]].set_md5("bbbbbb");
|
| for (std::map<std::string, FileCacheEntry>::iterator it =
|
| cache_entries.begin(); it != cache_entries.end(); ++it)
|
| - EXPECT_TRUE(storage_->PutCacheEntry(it->first, it->second));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry(it->first, it->second));
|
|
|
| // Iterate and check the result.
|
| std::map<std::string, ResourceEntry> found_entries;
|
| @@ -193,22 +200,22 @@ TEST_F(ResourceMetadataStorageTest, PutCacheEntry) {
|
|
|
| // Put cache entries.
|
| entry.set_md5(md5_1);
|
| - EXPECT_TRUE(storage_->PutCacheEntry(key1, entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry(key1, entry));
|
| entry.set_md5(md5_2);
|
| - EXPECT_TRUE(storage_->PutCacheEntry(key2, entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry(key2, entry));
|
|
|
| // Get cache entires.
|
| - EXPECT_TRUE(storage_->GetCacheEntry(key1, &entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetCacheEntry(key1, &entry));
|
| EXPECT_EQ(md5_1, entry.md5());
|
| - EXPECT_TRUE(storage_->GetCacheEntry(key2, &entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetCacheEntry(key2, &entry));
|
| EXPECT_EQ(md5_2, entry.md5());
|
|
|
| // Remove cache entries.
|
| - EXPECT_TRUE(storage_->RemoveCacheEntry(key1));
|
| - EXPECT_FALSE(storage_->GetCacheEntry(key1, &entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveCacheEntry(key1));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetCacheEntry(key1, &entry));
|
|
|
| - EXPECT_TRUE(storage_->RemoveCacheEntry(key2));
|
| - EXPECT_FALSE(storage_->GetCacheEntry(key2, &entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveCacheEntry(key2));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetCacheEntry(key2, &entry));
|
| }
|
|
|
| TEST_F(ResourceMetadataStorageTest, CacheEntryIterator) {
|
| @@ -227,14 +234,14 @@ TEST_F(ResourceMetadataStorageTest, CacheEntryIterator) {
|
|
|
| for (std::map<std::string, FileCacheEntry>::iterator it = entries.begin();
|
| it != entries.end(); ++it)
|
| - EXPECT_TRUE(storage_->PutCacheEntry(it->first, it->second));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry(it->first, it->second));
|
|
|
| // Insert some dummy entries.
|
| ResourceEntry entry;
|
| entry.set_local_id("entry1");
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
| entry.set_local_id("entry2");
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
|
|
| // Iterate and check the result.
|
| scoped_ptr<ResourceMetadataStorage::CacheEntryIterator> it =
|
| @@ -256,21 +263,23 @@ TEST_F(ResourceMetadataStorageTest, GetIdByResourceId) {
|
|
|
| // Resource ID to local ID mapping is not stored yet.
|
| std::string id;
|
| - EXPECT_FALSE(storage_->GetIdByResourceId(resource_id, &id));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND,
|
| + storage_->GetIdByResourceId(resource_id, &id));
|
|
|
| // Put an entry with the resource ID.
|
| ResourceEntry entry;
|
| entry.set_local_id(local_id);
|
| entry.set_resource_id(resource_id);
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
|
|
| // Can get local ID by resource ID.
|
| - EXPECT_TRUE(storage_->GetIdByResourceId(resource_id, &id));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetIdByResourceId(resource_id, &id));
|
| EXPECT_EQ(local_id, id);
|
|
|
| // Resource ID to local ID mapping is removed.
|
| - EXPECT_TRUE(storage_->RemoveEntry(local_id));
|
| - EXPECT_FALSE(storage_->GetIdByResourceId(resource_id, &id));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(local_id));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND,
|
| + storage_->GetIdByResourceId(resource_id, &id));
|
| }
|
|
|
| TEST_F(ResourceMetadataStorageTest, GetChildren) {
|
| @@ -297,7 +306,7 @@ TEST_F(ResourceMetadataStorageTest, GetChildren) {
|
| for (size_t i = 0; i < arraysize(parents_id); ++i) {
|
| ResourceEntry entry;
|
| entry.set_local_id(parents_id[i]);
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
| }
|
|
|
| // Put children.
|
| @@ -307,14 +316,15 @@ TEST_F(ResourceMetadataStorageTest, GetChildren) {
|
| entry.set_local_id(children_name_id[i][j].second);
|
| entry.set_parent_local_id(parents_id[i]);
|
| entry.set_base_name(children_name_id[i][j].first);
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
| }
|
| }
|
|
|
| // Put some dummy cache entries.
|
| for (size_t i = 0; i < arraysize(parents_id); ++i) {
|
| FileCacheEntry cache_entry;
|
| - EXPECT_TRUE(storage_->PutCacheEntry(parents_id[i], cache_entry));
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->PutCacheEntry(parents_id[i], cache_entry));
|
| }
|
|
|
| // Try to get children.
|
| @@ -343,8 +353,8 @@ TEST_F(ResourceMetadataStorageTest, OpenExistingDB) {
|
| entry2.set_base_name(child_name1);
|
|
|
| // Put some data.
|
| - EXPECT_TRUE(storage_->PutEntry(entry1));
|
| - EXPECT_TRUE(storage_->PutEntry(entry2));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry1));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry2));
|
|
|
| // Close DB and reopen.
|
| storage_.reset(new ResourceMetadataStorage(
|
| @@ -353,13 +363,16 @@ TEST_F(ResourceMetadataStorageTest, OpenExistingDB) {
|
|
|
| // Can read data.
|
| ResourceEntry result;
|
| - EXPECT_TRUE(storage_->GetEntry(parent_id1, &result));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetEntry(parent_id1, &result));
|
|
|
| - EXPECT_TRUE(storage_->GetEntry(child_id1, &result));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetEntry(child_id1, &result));
|
| EXPECT_EQ(parent_id1, result.parent_local_id());
|
| EXPECT_EQ(child_name1, result.base_name());
|
|
|
| - EXPECT_EQ(child_id1, storage_->GetChild(parent_id1, child_name1));
|
| + std::string child_id;
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->GetChild(parent_id1, child_name1, &child_id));
|
| + EXPECT_EQ(child_id1, child_id);
|
| }
|
|
|
| TEST_F(ResourceMetadataStorageTest, IncompatibleDB_M29) {
|
| @@ -367,7 +380,8 @@ TEST_F(ResourceMetadataStorageTest, IncompatibleDB_M29) {
|
|
|
| // Construct M29 version DB.
|
| SetDBVersion(6);
|
| - EXPECT_TRUE(storage_->SetLargestChangestamp(kLargestChangestamp));
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->SetLargestChangestamp(kLargestChangestamp));
|
|
|
| leveldb::WriteBatch batch;
|
|
|
| @@ -394,12 +408,16 @@ TEST_F(ResourceMetadataStorageTest, IncompatibleDB_M29) {
|
|
|
| // Resource-ID-to-local-ID mapping is added.
|
| std::string id;
|
| - EXPECT_TRUE(storage_->GetIdByResourceId("abcd", &id)); // "file:" is dropped.
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->GetIdByResourceId("abcd", &id)); // "file:" is dropped.
|
|
|
| // Data is erased, except cache entries.
|
| - EXPECT_EQ(0, storage_->GetLargestChangestamp());
|
| - EXPECT_FALSE(storage_->GetEntry(id, &entry));
|
| - EXPECT_TRUE(storage_->GetCacheEntry(id, &cache_entry));
|
| + int64 largest_changestamp = 0;
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->GetLargestChangestamp(&largest_changestamp));
|
| + EXPECT_EQ(0, largest_changestamp);
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetEntry(id, &entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetCacheEntry(id, &cache_entry));
|
| }
|
|
|
| TEST_F(ResourceMetadataStorageTest, IncompatibleDB_M32) {
|
| @@ -409,7 +427,8 @@ TEST_F(ResourceMetadataStorageTest, IncompatibleDB_M32) {
|
|
|
| // Construct M32 version DB.
|
| SetDBVersion(11);
|
| - EXPECT_TRUE(storage_->SetLargestChangestamp(kLargestChangestamp));
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->SetLargestChangestamp(kLargestChangestamp));
|
|
|
| leveldb::WriteBatch batch;
|
|
|
| @@ -438,11 +457,14 @@ TEST_F(ResourceMetadataStorageTest, IncompatibleDB_M32) {
|
|
|
| // Data is erased, except cache and id mapping entries.
|
| std::string id;
|
| - EXPECT_TRUE(storage_->GetIdByResourceId(resource_id, &id));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetIdByResourceId(resource_id, &id));
|
| EXPECT_EQ(local_id, id);
|
| - EXPECT_EQ(0, storage_->GetLargestChangestamp());
|
| - EXPECT_FALSE(storage_->GetEntry(id, &entry));
|
| - EXPECT_TRUE(storage_->GetCacheEntry(id, &cache_entry));
|
| + int64 largest_changestamp = 0;
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->GetLargestChangestamp(&largest_changestamp));
|
| + EXPECT_EQ(0, largest_changestamp);
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetEntry(id, &entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->GetCacheEntry(id, &cache_entry));
|
| }
|
|
|
| TEST_F(ResourceMetadataStorageTest, IncompatibleDB_Unknown) {
|
| @@ -450,12 +472,13 @@ TEST_F(ResourceMetadataStorageTest, IncompatibleDB_Unknown) {
|
| const std::string key1 = "abcd";
|
|
|
| // Put some data.
|
| - EXPECT_TRUE(storage_->SetLargestChangestamp(kLargestChangestamp));
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->SetLargestChangestamp(kLargestChangestamp));
|
| ResourceEntry entry;
|
| entry.set_local_id(key1);
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
| FileCacheEntry cache_entry;
|
| - EXPECT_TRUE(storage_->PutCacheEntry(key1, cache_entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry(key1, cache_entry));
|
|
|
| // Set newer version, upgrade and reopen DB.
|
| SetDBVersion(ResourceMetadataStorage::kDBVersion + 1);
|
| @@ -467,9 +490,12 @@ TEST_F(ResourceMetadataStorageTest, IncompatibleDB_Unknown) {
|
| ASSERT_TRUE(storage_->Initialize());
|
|
|
| // Data is erased because of the incompatible version.
|
| - EXPECT_EQ(0, storage_->GetLargestChangestamp());
|
| - EXPECT_FALSE(storage_->GetEntry(key1, &entry));
|
| - EXPECT_FALSE(storage_->GetCacheEntry(key1, &cache_entry));
|
| + int64 largest_changestamp = 0;
|
| + EXPECT_EQ(FILE_ERROR_OK,
|
| + storage_->GetLargestChangestamp(&largest_changestamp));
|
| + EXPECT_EQ(0, largest_changestamp);
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetEntry(key1, &entry));
|
| + EXPECT_EQ(FILE_ERROR_NOT_FOUND, storage_->GetCacheEntry(key1, &cache_entry));
|
| }
|
|
|
| TEST_F(ResourceMetadataStorageTest, WrongPath) {
|
| @@ -487,24 +513,24 @@ TEST_F(ResourceMetadataStorageTest, RecoverCacheEntriesFromTrashedResourceMap) {
|
| // Put some cache entries.
|
| FileCacheEntry cache_entry;
|
| cache_entry.set_md5("md5_foo");
|
| - EXPECT_TRUE(storage_->PutCacheEntry("id_foo", cache_entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry("id_foo", cache_entry));
|
| cache_entry.set_md5("md5_bar");
|
| cache_entry.set_is_dirty(true);
|
| - EXPECT_TRUE(storage_->PutCacheEntry("id_bar", cache_entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry("id_bar", cache_entry));
|
|
|
| // Put entry with id_foo.
|
| ResourceEntry entry;
|
| entry.set_local_id("id_foo");
|
| entry.set_base_name("foo");
|
| entry.set_title("foo");
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
|
|
| // Put entry with id_bar as a id_foo's child.
|
| entry.set_local_id("id_bar");
|
| entry.set_parent_local_id("id_foo");
|
| entry.set_base_name("bar");
|
| entry.set_title("bar");
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
|
|
| // Remove parent-child relationship to make the DB invalid.
|
| RemoveChild("id_foo", "bar");
|
| @@ -542,14 +568,14 @@ TEST_F(ResourceMetadataStorageTest, CheckValidity) {
|
| ResourceEntry entry;
|
| entry.set_local_id(key1);
|
| entry.set_base_name(name1);
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
| EXPECT_TRUE(CheckValidity());
|
|
|
| // Put entry with key2 under key1.
|
| entry.set_local_id(key2);
|
| entry.set_parent_local_id(key1);
|
| entry.set_base_name(name2);
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
| EXPECT_TRUE(CheckValidity());
|
|
|
| RemoveChild(key1, name2);
|
| @@ -567,7 +593,7 @@ TEST_F(ResourceMetadataStorageTest, CheckValidity) {
|
| entry.set_local_id(key3);
|
| entry.set_parent_local_id(key2);
|
| entry.set_base_name(name3);
|
| - EXPECT_TRUE(storage_->PutEntry(entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry));
|
| EXPECT_TRUE(CheckValidity());
|
|
|
| // Parent-child relationship with wrong name.
|
| @@ -584,23 +610,23 @@ TEST_F(ResourceMetadataStorageTest, CheckValidity) {
|
|
|
| // Add some cache entries.
|
| FileCacheEntry cache_entry;
|
| - EXPECT_TRUE(storage_->PutCacheEntry(key1, cache_entry));
|
| - EXPECT_TRUE(storage_->PutCacheEntry(key2, cache_entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry(key1, cache_entry));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->PutCacheEntry(key2, cache_entry));
|
|
|
| // Remove key2.
|
| RemoveChild(key1, name2);
|
| EXPECT_FALSE(CheckValidity());
|
| - EXPECT_TRUE(storage_->RemoveEntry(key2));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key2));
|
| EXPECT_FALSE(CheckValidity());
|
|
|
| // Remove key3.
|
| RemoveChild(key2, name3);
|
| EXPECT_FALSE(CheckValidity());
|
| - EXPECT_TRUE(storage_->RemoveEntry(key3));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key3));
|
| EXPECT_TRUE(CheckValidity());
|
|
|
| // Remove key1.
|
| - EXPECT_TRUE(storage_->RemoveEntry(key1));
|
| + EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key1));
|
| EXPECT_TRUE(CheckValidity());
|
| }
|
|
|
|
|