Revert 285173 "Removed InProcessBrowserTest::CleanUpOnMainThread()"
[chromium-blink-merge.git] / chrome / browser / extensions / api / system_memory / system_memory_apitest.cc
blobdc2cccdd6506c579df0683d1a206acc4cf469224
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/message_loop/message_loop.h"
6 #include "chrome/browser/extensions/api/system_memory/memory_info_provider.h"
7 #include "chrome/browser/extensions/extension_apitest.h"
9 namespace extensions {
11 using api::system_memory::MemoryInfo;
13 class MockMemoryInfoProviderImpl : public MemoryInfoProvider {
14 public:
15 MockMemoryInfoProviderImpl() {}
17 virtual bool QueryInfo() OVERRIDE {
18 info_.capacity = 4096;
19 info_.available_capacity = 1024;
20 return true;
22 private:
23 virtual ~MockMemoryInfoProviderImpl() {}
26 class SystemMemoryApiTest: public ExtensionApiTest {
27 public:
28 SystemMemoryApiTest() {}
29 virtual ~SystemMemoryApiTest() {}
31 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
32 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
33 message_loop_.reset(new base::MessageLoopForUI);
36 private:
37 scoped_ptr<base::MessageLoop> message_loop_;
40 IN_PROC_BROWSER_TEST_F(SystemMemoryApiTest, Memory) {
41 scoped_refptr<MemoryInfoProvider> provider = new MockMemoryInfoProviderImpl();
42 // The provider is owned by the single MemoryInfoProvider instance.
43 MemoryInfoProvider::InitializeForTesting(provider);
44 ASSERT_TRUE(RunExtensionTest("system/memory")) << message_;
47 } // namespace extensions