| 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 "content/browser/renderer_host/pepper/quota_reservation.h" | 5 #include "content/browser/renderer_host/pepper/quota_reservation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(FakeBackend); | 62 DISALLOW_COPY_AND_ASSIGN(FakeBackend); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 class QuotaReservationTest : public testing::Test { | 67 class QuotaReservationTest : public testing::Test { |
| 68 public: | 68 public: |
| 69 QuotaReservationTest() {} | 69 QuotaReservationTest() {} |
| 70 virtual ~QuotaReservationTest() {} | 70 ~QuotaReservationTest() override {} |
| 71 | 71 |
| 72 virtual void SetUp() override { | 72 void SetUp() override { |
| 73 ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); | 73 ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); |
| 74 | 74 |
| 75 reservation_manager_.reset(new QuotaReservationManager( | 75 reservation_manager_.reset(new QuotaReservationManager( |
| 76 scoped_ptr<QuotaReservationManager::QuotaBackend>(new FakeBackend))); | 76 scoped_ptr<QuotaReservationManager::QuotaBackend>(new FakeBackend))); |
| 77 } | 77 } |
| 78 | 78 |
| 79 virtual void TearDown() override { | 79 void TearDown() override { |
| 80 reservation_manager_.reset(); | 80 reservation_manager_.reset(); |
| 81 base::RunLoop().RunUntilIdle(); | 81 base::RunLoop().RunUntilIdle(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 base::FilePath MakeFilePath(const base::FilePath::StringType& file_name) { | 84 base::FilePath MakeFilePath(const base::FilePath::StringType& file_name) { |
| 85 return work_dir_.path().Append(file_name); | 85 return work_dir_.path().Append(file_name); |
| 86 } | 86 } |
| 87 | 87 |
| 88 storage::FileSystemURL MakeFileSystemURL( | 88 storage::FileSystemURL MakeFileSystemURL( |
| 89 const base::FilePath::StringType& file_name) { | 89 const base::FilePath::StringType& file_name) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 EXPECT_EQ(amount, reserved_quota); | 235 EXPECT_EQ(amount, reserved_quota); |
| 236 EXPECT_EQ(2U, file_growths.size()); | 236 EXPECT_EQ(2U, file_growths.size()); |
| 237 EXPECT_EQ(file1_size, file_growths[kFile1ID].max_written_offset); | 237 EXPECT_EQ(file1_size, file_growths[kFile1ID].max_written_offset); |
| 238 EXPECT_EQ(file3_size, file_growths[kFile3ID].max_written_offset); | 238 EXPECT_EQ(file3_size, file_growths[kFile3ID].max_written_offset); |
| 239 | 239 |
| 240 test->CloseFile(kFile1ID, ppapi::FileGrowth(file1_size, 0)); | 240 test->CloseFile(kFile1ID, ppapi::FileGrowth(file1_size, 0)); |
| 241 test->CloseFile(kFile3ID, ppapi::FileGrowth(file3_size, 0)); | 241 test->CloseFile(kFile3ID, ppapi::FileGrowth(file3_size, 0)); |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace content | 244 } // namespace content |
| OLD | NEW |