| 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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "chrome/browser/chromeos/drive/drive.pb.h" | 12 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 13 #include "chrome/browser/chromeos/drive/test_util.h" | 13 #include "chrome/browser/chromeos/drive/test_util.h" |
| 14 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 16 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
| 17 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" | 17 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" |
| 18 | 18 |
| 19 namespace drive { | 19 namespace drive { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| 22 class ResourceMetadataStorageTest : public testing::Test { | 22 class ResourceMetadataStorageTest : public testing::Test { |
| 23 protected: | 23 protected: |
| 24 virtual void SetUp() override { | 24 void SetUp() override { |
| 25 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 25 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 26 | 26 |
| 27 storage_.reset(new ResourceMetadataStorage( | 27 storage_.reset(new ResourceMetadataStorage( |
| 28 temp_dir_.path(), base::MessageLoopProxy::current().get())); | 28 temp_dir_.path(), base::MessageLoopProxy::current().get())); |
| 29 ASSERT_TRUE(storage_->Initialize()); | 29 ASSERT_TRUE(storage_->Initialize()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Overwrites |storage_|'s version. | 32 // Overwrites |storage_|'s version. |
| 33 void SetDBVersion(int version) { | 33 void SetDBVersion(int version) { |
| 34 ResourceMetadataHeader header; | 34 ResourceMetadataHeader header; |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key3)); | 622 EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key3)); |
| 623 EXPECT_TRUE(CheckValidity()); | 623 EXPECT_TRUE(CheckValidity()); |
| 624 | 624 |
| 625 // Remove key1. | 625 // Remove key1. |
| 626 EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key1)); | 626 EXPECT_EQ(FILE_ERROR_OK, storage_->RemoveEntry(key1)); |
| 627 EXPECT_TRUE(CheckValidity()); | 627 EXPECT_TRUE(CheckValidity()); |
| 628 } | 628 } |
| 629 | 629 |
| 630 } // namespace internal | 630 } // namespace internal |
| 631 } // namespace drive | 631 } // namespace drive |
| OLD | NEW |