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 // StorageInfoProvider unit tests. | 5 // StorageInfoProvider unit tests. |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide
r.h" | 9 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide
r.h" |
10 #include "chrome/browser/storage_monitor/test_storage_monitor.h" | 10 #include "chrome/browser/storage_monitor/test_storage_monitor.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 struct TestUnitInfo { | 28 struct TestUnitInfo { |
29 std::string id; | 29 std::string id; |
30 std::string type; | 30 std::string type; |
31 double capacity; | 31 double capacity; |
32 double available_capacity; | 32 double available_capacity; |
33 // The change step of free space. | 33 // The change step of free space. |
34 int change_step; | 34 int change_step; |
35 }; | 35 }; |
36 | 36 |
37 const struct TestUnitInfo kTestingData[] = { | 37 const struct TestUnitInfo kTestingData[] = { |
38 {"C:", "unknown", 1000, 10, 0}, | 38 {"C:", systeminfo::kStorageTypeUnknown, 1000, 10, 0}, |
39 {"d:", "removable", 2000, 10, 1 }, | 39 {"d:", systeminfo::kStorageTypeRemovable, 2000, 10, 1 }, |
40 {"/home","harddisk", 3000, 10, 2}, | 40 {"/home", systeminfo::kStorageTypeFixed, 3000, 10, 2}, |
41 {"/", "removable", 4000, 10, 3} | 41 {"/", systeminfo::kStorageTypeRemovable, 4000, 10, 3} |
42 }; | 42 }; |
43 | 43 |
44 // The watching interval for unit test is 1 milliseconds. | 44 // The watching interval for unit test is 1 milliseconds. |
45 const size_t kWatchingIntervalMs = 1u; | 45 const size_t kWatchingIntervalMs = 1u; |
46 // The number of times of checking watched storages. | 46 // The number of times of checking watched storages. |
47 const int kCheckTimes = 10; | 47 const int kCheckTimes = 10; |
48 | 48 |
49 class MockStorageObserver : public StorageInfoObserver { | 49 class MockStorageObserver : public StorageInfoObserver { |
50 public: | 50 public: |
51 MockStorageObserver() {} | 51 MockStorageObserver() {} |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 MockStorageObserver mock_observer; | 323 MockStorageObserver mock_observer; |
324 storage_info_provider_->AddObserver(&mock_observer); | 324 storage_info_provider_->AddObserver(&mock_observer); |
325 storage_info_provider_->StartWatching(invalid_id); | 325 storage_info_provider_->StartWatching(invalid_id); |
326 EXPECT_CALL(mock_observer, | 326 EXPECT_CALL(mock_observer, |
327 OnStorageFreeSpaceChanged(invalid_id, _, _)).Times(0); | 327 OnStorageFreeSpaceChanged(invalid_id, _, _)).Times(0); |
328 RunAllPendingAndFlushBlockingPool(); | 328 RunAllPendingAndFlushBlockingPool(); |
329 storage_info_provider_->RemoveObserver(&mock_observer); | 329 storage_info_provider_->RemoveObserver(&mock_observer); |
330 } | 330 } |
331 | 331 |
332 } // namespace extensions | 332 } // namespace extensions |
OLD | NEW |