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 "webkit/browser/fileapi/quota/quota_reservation_manager.h" | 5 #include "webkit/browser/fileapi/quota/quota_reservation_manager.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/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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 scoped_ptr<QuotaReservationManager::QuotaBackend> backend(new FakeBackend); | 105 scoped_ptr<QuotaReservationManager::QuotaBackend> backend(new FakeBackend); |
106 reservation_manager_.reset(new QuotaReservationManager(backend.Pass())); | 106 reservation_manager_.reset(new QuotaReservationManager(backend.Pass())); |
107 } | 107 } |
108 | 108 |
109 virtual void TearDown() OVERRIDE { | 109 virtual void TearDown() OVERRIDE { |
110 reservation_manager_.reset(); | 110 reservation_manager_.reset(); |
111 } | 111 } |
112 | 112 |
113 int64 GetFileSize() { | 113 int64 GetFileSize() { |
114 int64 size = 0; | 114 int64 size = 0; |
115 file_util::GetFileSize(file_path_, &size); | 115 base::GetFileSize(file_path_, &size); |
116 return size; | 116 return size; |
117 } | 117 } |
118 | 118 |
119 void SetFileSize(int64 size) { | 119 void SetFileSize(int64 size) { |
120 bool created = false; | 120 bool created = false; |
121 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; | 121 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; |
122 base::PlatformFile file = CreatePlatformFile( | 122 base::PlatformFile file = CreatePlatformFile( |
123 file_path_, | 123 file_path_, |
124 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE, | 124 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE, |
125 &created, &error); | 125 &created, &error); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 EXPECT_EQ(400, GetFileSize()); | 350 EXPECT_EQ(400, GetFileSize()); |
351 EXPECT_EQ(0, fake_backend()->on_memory_usage()); | 351 EXPECT_EQ(0, fake_backend()->on_memory_usage()); |
352 EXPECT_EQ(400 - kInitialFileSize, fake_backend()->on_disk_usage()); | 352 EXPECT_EQ(400 - kInitialFileSize, fake_backend()->on_disk_usage()); |
353 } | 353 } |
354 | 354 |
355 // TODO(tzik): Add Truncate test. | 355 // TODO(tzik): Add Truncate test. |
356 // TODO(tzik): Add PluginCrash test and DropReservationManager test. | 356 // TODO(tzik): Add PluginCrash test and DropReservationManager test. |
357 | 357 |
358 } // namespace fileapi | 358 } // namespace fileapi |
OLD | NEW |