| Index: chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc
|
| diff --git a/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc b/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc
|
| index c55d0ae3edb2866c75d556dcfc059c1ec7a4a828..9d467065b64c6b7c75ad9e932199b5b5a417ae2d 100644
|
| --- a/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc
|
| +++ b/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc
|
| @@ -2,22 +2,62 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
| #include "base/command_line.h"
|
| +#include "base/message_loop.h"
|
| +#include "chrome/browser/extensions/api/system_info_storage/storage_info_provider.h"
|
| #include "chrome/browser/extensions/extension_apitest.h"
|
| #include "chrome/common/chrome_switches.h"
|
|
|
| namespace extensions {
|
|
|
| +using api::experimental_system_info_storage::StorageInfo;
|
| +using api::experimental_system_info_storage::StorageUnitInfo;
|
| +
|
| +class MockStorageInfoProvider : public StorageInfoProvider {
|
| + public:
|
| + MockStorageInfoProvider() {}
|
| + virtual ~MockStorageInfoProvider() {}
|
| +
|
| + virtual bool QueryInfo(StorageInfo* info) OVERRIDE {
|
| + info->units.clear();
|
| +
|
| + linked_ptr<StorageUnitInfo> unit(new StorageUnitInfo());
|
| + unit->id = "0xbeaf";
|
| + unit->type = systeminfo::kStorageTypeUnknown;
|
| + unit->capacity = 4098;
|
| + unit->available_capacity = 1024;
|
| +
|
| + info->units.push_back(unit);
|
| + return true;
|
| + }
|
| +
|
| + virtual bool QueryUnitInfo(const std::string& id,
|
| + StorageUnitInfo* info) OVERRIDE {
|
| + return false;
|
| + }
|
| +};
|
| +
|
| class SystemInfoStorageApiTest: public ExtensionApiTest {
|
| public:
|
| SystemInfoStorageApiTest() {}
|
| ~SystemInfoStorageApiTest() {}
|
| +
|
| virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
|
| ExtensionApiTest::SetUpCommandLine(command_line);
|
| command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
|
| }
|
| +
|
| + virtual void SetUpInProcessBrowserTestFixture() {
|
| + ExtensionApiTest::SetUpInProcessBrowserTestFixture();
|
| + message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI));
|
| + }
|
| +
|
| + private:
|
| + scoped_ptr<MessageLoop> message_loop_;
|
| };
|
|
|
| IN_PROC_BROWSER_TEST_F(SystemInfoStorageApiTest, Storage) {
|
| + StorageInfoProvider* provider = new MockStorageInfoProvider();
|
| + StorageInfoProvider::InitializeForTesting(provider);
|
| ASSERT_TRUE(RunExtensionTest("systeminfo/storage")) << message_;
|
| }
|
|
|
|
|