| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/fileapi/file_system_usage_cache.h" | 5 #include "webkit/fileapi/file_system_usage_cache.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace fileapi { | 12 namespace fileapi { |
| 13 | 13 |
| 14 class FileSystemUsageCacheTest : public testing::Test { | 14 class FileSystemUsageCacheTest : public testing::Test { |
| 15 public: | 15 public: |
| 16 FileSystemUsageCacheTest() {} | 16 FileSystemUsageCacheTest() {} |
| 17 | 17 |
| 18 void SetUp() { | 18 void SetUp() { |
| 19 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 19 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 20 } | 20 } |
| 21 | 21 |
| 22 protected: | 22 protected: |
| 23 FilePath GetUsageFilePath() { | 23 FilePath GetUsageFilePath() { |
| 24 return data_dir_.path().AppendASCII(FileSystemUsageCache::kUsageFileName); | 24 return data_dir_.path().Append(FileSystemUsageCache::kUsageFileName); |
| 25 } | 25 } |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 ScopedTempDir data_dir_; | 28 ScopedTempDir data_dir_; |
| 29 | 29 |
| 30 DISALLOW_COPY_AND_ASSIGN(FileSystemUsageCacheTest); | 30 DISALLOW_COPY_AND_ASSIGN(FileSystemUsageCacheTest); |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 TEST_F(FileSystemUsageCacheTest, CreateTest) { | 33 TEST_F(FileSystemUsageCacheTest, CreateTest) { |
| 34 FilePath usage_file_path = GetUsageFilePath(); | 34 FilePath usage_file_path = GetUsageFilePath(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 FilePath usage_file_path = GetUsageFilePath(); | 127 FilePath usage_file_path = GetUsageFilePath(); |
| 128 EXPECT_FALSE(FileSystemUsageCache::IncrementDirty(usage_file_path)); | 128 EXPECT_FALSE(FileSystemUsageCache::IncrementDirty(usage_file_path)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 TEST_F(FileSystemUsageCacheTest, DecrementDirtyWithoutCacheFileTest) { | 131 TEST_F(FileSystemUsageCacheTest, DecrementDirtyWithoutCacheFileTest) { |
| 132 FilePath usage_file_path = GetUsageFilePath(); | 132 FilePath usage_file_path = GetUsageFilePath(); |
| 133 EXPECT_FALSE(FileSystemUsageCache::IncrementDirty(usage_file_path)); | 133 EXPECT_FALSE(FileSystemUsageCache::IncrementDirty(usage_file_path)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace fileapi | 136 } // namespace fileapi |
| OLD | NEW |