This source file includes following definitions.
- QueryInfo
- SetUpInProcessBrowserTestFixture
- IN_PROC_BROWSER_TEST_F
#include "base/message_loop/message_loop.h"
#include "chrome/browser/extensions/api/system_memory/memory_info_provider.h"
#include "chrome/browser/extensions/extension_apitest.h"
namespace extensions {
using api::system_memory::MemoryInfo;
class MockMemoryInfoProviderImpl : public MemoryInfoProvider {
public:
MockMemoryInfoProviderImpl() {}
virtual bool QueryInfo() OVERRIDE {
info_.capacity = 4096;
info_.available_capacity = 1024;
return true;
}
private:
virtual ~MockMemoryInfoProviderImpl() {}
};
class SystemMemoryApiTest: public ExtensionApiTest {
public:
SystemMemoryApiTest() {}
virtual ~SystemMemoryApiTest() {}
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
message_loop_.reset(new base::MessageLoopForUI);
}
private:
scoped_ptr<base::MessageLoop> message_loop_;
};
IN_PROC_BROWSER_TEST_F(SystemMemoryApiTest, Memory) {
scoped_refptr<MemoryInfoProvider> provider = new MockMemoryInfoProviderImpl();
MemoryInfoProvider::InitializeForTesting(provider);
ASSERT_TRUE(RunExtensionTest("system/memory")) << message_;
}
}