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 CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chrome/browser/chromeos/drive/file_cache.h" | 11 #include "chrome/browser/chromeos/drive/file_cache.h" |
12 | 12 |
13 namespace drive { | 13 namespace drive { |
14 | 14 |
15 // This class is used to report fake free disk space. In particular, this | 15 // 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. | 16 // class can be used to simulate a case where disk is full, or nearly full. |
17 class FakeFreeDiskSpaceGetter : public internal::FreeDiskSpaceGetterInterface { | 17 class FakeFreeDiskSpaceGetter : public internal::FreeDiskSpaceGetterInterface { |
18 public: | 18 public: |
19 FakeFreeDiskSpaceGetter(); | 19 FakeFreeDiskSpaceGetter(); |
20 virtual ~FakeFreeDiskSpaceGetter(); | 20 virtual ~FakeFreeDiskSpaceGetter(); |
21 | 21 |
| 22 // Resets this instance. |
| 23 void Reset(); |
| 24 |
22 // If this function is not called, AmountOfFreeDiskSpace() will return 0 | 25 // If this function is not called, AmountOfFreeDiskSpace() will return 0 |
23 // repeatedly. | 26 // repeatedly. |
24 // | 27 // |
25 // If this function is only called once, AmountOfFreeDiskSpace() will | 28 // If this function is only called once, AmountOfFreeDiskSpace() will |
26 // return the fake value repeatedly. | 29 // return the fake value repeatedly. |
27 // | 30 // |
28 // If this function is called multiple times, AmountOfFreeDiskSpace() will | 31 // If this function is called multiple times, AmountOfFreeDiskSpace() will |
29 // return the fake values in the same order these values were recorded. The | 32 // return the fake values in the same order these values were recorded. The |
30 // last value will be returned repeatedly. | 33 // last value will be returned repeatedly. |
31 void set_fake_free_disk_space(int64 fake_free_disk_space) { | 34 void set_fake_free_disk_space(int64 fake_free_disk_space) { |
32 fake_values_.push_back(fake_free_disk_space); | 35 fake_values_.push_back(fake_free_disk_space); |
33 } | 36 } |
34 | 37 |
35 // FreeDiskSpaceGetterInterface overrides. | 38 // FreeDiskSpaceGetterInterface overrides. |
36 virtual int64 AmountOfFreeDiskSpace() OVERRIDE; | 39 virtual int64 AmountOfFreeDiskSpace() OVERRIDE; |
37 | 40 |
38 private: | 41 private: |
39 std::vector<int64> fake_values_; | 42 std::vector<int64> fake_values_; |
40 | 43 |
41 DISALLOW_COPY_AND_ASSIGN(FakeFreeDiskSpaceGetter); | 44 DISALLOW_COPY_AND_ASSIGN(FakeFreeDiskSpaceGetter); |
42 }; | 45 }; |
43 | 46 |
44 } // namespace drive | 47 } // namespace drive |
45 | 48 |
46 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ | 49 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FAKE_FREE_DISK_SPACE_GETTER_H_ |
OLD | NEW |