OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/resource_metadata_storage.h" | 5 #include "chrome/browser/chromeos/drive/resource_metadata_storage.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 // Data is erased because of the incompatible version. | 426 // Data is erased because of the incompatible version. |
427 EXPECT_EQ(0, storage_->GetLargestChangestamp()); | 427 EXPECT_EQ(0, storage_->GetLargestChangestamp()); |
428 EXPECT_FALSE(storage_->GetEntry(key1, &entry)); | 428 EXPECT_FALSE(storage_->GetEntry(key1, &entry)); |
429 EXPECT_FALSE(storage_->GetCacheEntry(key1, &cache_entry)); | 429 EXPECT_FALSE(storage_->GetCacheEntry(key1, &cache_entry)); |
430 } | 430 } |
431 | 431 |
432 TEST_F(ResourceMetadataStorageTest, WrongPath) { | 432 TEST_F(ResourceMetadataStorageTest, WrongPath) { |
433 // Create a file. | 433 // Create a file. |
434 base::FilePath path; | 434 base::FilePath path; |
435 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &path)); | 435 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &path)); |
436 | 436 |
437 storage_.reset(new ResourceMetadataStorage( | 437 storage_.reset(new ResourceMetadataStorage( |
438 path, base::MessageLoopProxy::current().get())); | 438 path, base::MessageLoopProxy::current().get())); |
439 // Cannot initialize DB beacause the path does not point a directory. | 439 // Cannot initialize DB beacause the path does not point a directory. |
440 ASSERT_FALSE(storage_->Initialize()); | 440 ASSERT_FALSE(storage_->Initialize()); |
441 } | 441 } |
442 | 442 |
443 TEST_F(ResourceMetadataStorageTest, RecoverCacheEntriesFromTrashedResourceMap) { | 443 TEST_F(ResourceMetadataStorageTest, RecoverCacheEntriesFromTrashedResourceMap) { |
444 // Put some cache entries. | 444 // Put some cache entries. |
445 FileCacheEntry cache_entry; | 445 FileCacheEntry cache_entry; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 EXPECT_TRUE(storage_->RemoveEntry(key3)); | 556 EXPECT_TRUE(storage_->RemoveEntry(key3)); |
557 EXPECT_TRUE(CheckValidity()); | 557 EXPECT_TRUE(CheckValidity()); |
558 | 558 |
559 // Remove key1. | 559 // Remove key1. |
560 EXPECT_TRUE(storage_->RemoveEntry(key1)); | 560 EXPECT_TRUE(storage_->RemoveEntry(key1)); |
561 EXPECT_TRUE(CheckValidity()); | 561 EXPECT_TRUE(CheckValidity()); |
562 } | 562 } |
563 | 563 |
564 } // namespace internal | 564 } // namespace internal |
565 } // namespace drive | 565 } // namespace drive |
OLD | NEW |