Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Unified Diff: chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc

Issue 10876041: Polish the SystemInfoProvider template code and refactor StorageInfoProvider based on it (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use string16 instead of wstring to avoid Presubmit warning Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;
}

Powered by Google App Engine
This is Rietveld 408576698