| 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 #ifndef COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ | 5 #ifndef COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ |
| 6 #define COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ | 6 #define COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <list> | 10 #include <list> |
| 9 | 11 |
| 10 #include "base/basictypes.h" | 12 #include "base/macros.h" |
| 11 #include "components/drive/file_cache.h" | 13 #include "components/drive/file_cache.h" |
| 12 | 14 |
| 13 namespace drive { | 15 namespace drive { |
| 14 | 16 |
| 15 // This class is used to report fake free disk space. In particular, this | 17 // This class is used to report fake free disk space. In particular, this |
| 16 // class can be used to simulate a case where disk is full, or nearly full. | 18 // class can be used to simulate a case where disk is full, or nearly full. |
| 17 class FakeFreeDiskSpaceGetter : public internal::FreeDiskSpaceGetterInterface { | 19 class FakeFreeDiskSpaceGetter : public internal::FreeDiskSpaceGetterInterface { |
| 18 public: | 20 public: |
| 19 FakeFreeDiskSpaceGetter(); | 21 FakeFreeDiskSpaceGetter(); |
| 20 ~FakeFreeDiskSpaceGetter() override; | 22 ~FakeFreeDiskSpaceGetter() override; |
| 21 | 23 |
| 22 void set_default_value(int64 value) { default_value_ = value; } | 24 void set_default_value(int64_t value) { default_value_ = value; } |
| 23 | 25 |
| 24 // Pushes the given value to the back of the fake value list. | 26 // Pushes the given value to the back of the fake value list. |
| 25 // | 27 // |
| 26 // If the fake value list is empty, AmountOfFreeDiskSpace() will return | 28 // If the fake value list is empty, AmountOfFreeDiskSpace() will return |
| 27 // |default_value_| repeatedly. | 29 // |default_value_| repeatedly. |
| 28 // Otherwise, AmountOfFreeDiskSpace() will return the value at the front of | 30 // Otherwise, AmountOfFreeDiskSpace() will return the value at the front of |
| 29 // the list and removes it from the list. | 31 // the list and removes it from the list. |
| 30 void PushFakeValue(int64 value); | 32 void PushFakeValue(int64_t value); |
| 31 | 33 |
| 32 // FreeDiskSpaceGetterInterface overrides. | 34 // FreeDiskSpaceGetterInterface overrides. |
| 33 int64 AmountOfFreeDiskSpace() override; | 35 int64_t AmountOfFreeDiskSpace() override; |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 std::list<int64> fake_values_; | 38 std::list<int64_t> fake_values_; |
| 37 int64 default_value_; | 39 int64_t default_value_; |
| 38 | 40 |
| 39 DISALLOW_COPY_AND_ASSIGN(FakeFreeDiskSpaceGetter); | 41 DISALLOW_COPY_AND_ASSIGN(FakeFreeDiskSpaceGetter); |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 } // namespace drive | 44 } // namespace drive |
| 43 | 45 |
| 44 #endif // COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ | 46 #endif // COMPONENTS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ |
| OLD | NEW |