Chromium Code Reviews| Index: chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h |
| diff --git a/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h b/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c05685d1945d3d222e27af07155b4f0007c71b29 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_TEST_STORAGE_INFO_PROVIDER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_TEST_STORAGE_INFO_PROVIDER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "chrome/browser/extensions/api/system_info_storage/storage_info_provider.h" |
| +#include "chrome/browser/storage_monitor/storage_info.h" |
| + |
| +struct TestUnitInfo { |
| + const char* device_id; |
| + const char* name; |
| + const char* type; |
| + // Total amount of the storage device space, in bytes. |
| + double capacity; |
| + // The available amount of the storage space, in bytes. |
| + double available_capacity; |
| + // The change step of available capacity for simulating the free space change. |
| + // Increasing |available_capacity| with a fixed change_step. |
|
Hongbo Min
2013/06/27 12:35:26
nit: Each querying operation will increase the |av
Haojian Wu
2013/06/28 14:51:05
Done.
|
| + int change_step; |
| +}; |
| + |
| +class TestStorageInfoProvider : public extensions::StorageInfoProvider { |
| + public: |
| + TestStorageInfoProvider(const struct TestUnitInfo* testing_data, size_t n); |
| + |
| + static chrome::StorageInfo BuildStorageInfo(const TestUnitInfo& unit); |
| + |
| + protected: |
| + virtual ~TestStorageInfoProvider(); |
| + |
| + // StorageInfoProvider implementations. |
| + virtual bool QueryInfo(extensions::StorageInfo* info) OVERRIDE; |
| + virtual std::vector<chrome::StorageInfo> GetAllStorages() const OVERRIDE; |
| + virtual int64 GetStorageFreeSpaceFromId(const std::string& id) OVERRIDE; |
| + |
| + std::vector<struct TestUnitInfo> testing_data_; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_TEST_STORAGE_INFO_PROVIDER_H_ |
| + |