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

Side by Side Diff: chrome/browser/extensions/api/system_info_cpu/system_info_cpu_apitest.cc

Issue 10914060: Refine systemInfo.cpu API defintions and provide systemInfo.cpu.get impl for Windows and Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "base/command_line.h" 4 #include "base/command_line.h"
5 #include "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h" 6 #include "chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 9
10 namespace extensions { 10 namespace extensions {
11 11
12 using api::experimental_system_info_cpu::CpuInfo; 12 using api::experimental_system_info_cpu::CpuInfo;
13 using api::experimental_system_info_cpu::CpuCoreInfo;
14 13
15 class MockCpuInfoProviderImpl : public CpuInfoProvider { 14 class MockCpuInfoProviderImpl : public CpuInfoProvider {
16 public: 15 public:
17 MockCpuInfoProviderImpl() {} 16 MockCpuInfoProviderImpl() {}
18 ~MockCpuInfoProviderImpl() {} 17 ~MockCpuInfoProviderImpl() {}
19 18
20 virtual bool QueryInfo(CpuInfo* info) OVERRIDE { 19 virtual bool QueryInfo(CpuInfo* info) OVERRIDE {
21 DCHECK(info); 20 if (!info) return false;
22 21
23 info->cores.clear(); 22 info->num_of_processors = 4;
23 info->arch_name = "x86";
24 info->model_name = "unknown";
24 25
25 static const unsigned int kNumberOfCores = 4;
26 for (unsigned int i = 0; i < kNumberOfCores; ++i) {
27 linked_ptr<CpuCoreInfo> core(new CpuCoreInfo());
28 core->load = i*10;
29 info->cores.push_back(core);
30 }
31 return true; 26 return true;
32 } 27 }
33 }; 28 };
34 29
35 class SystemInfoCpuApiTest: public ExtensionApiTest { 30 class SystemInfoCpuApiTest: public ExtensionApiTest {
36 public: 31 public:
37 SystemInfoCpuApiTest() {} 32 SystemInfoCpuApiTest() {}
38 ~SystemInfoCpuApiTest() {} 33 ~SystemInfoCpuApiTest() {}
39 34
40 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 35 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
(...skipping 12 matching lines...) Expand all
53 48
54 private: 49 private:
55 scoped_ptr<MessageLoop> message_loop_; 50 scoped_ptr<MessageLoop> message_loop_;
56 }; 51 };
57 52
58 IN_PROC_BROWSER_TEST_F(SystemInfoCpuApiTest, Cpu) { 53 IN_PROC_BROWSER_TEST_F(SystemInfoCpuApiTest, Cpu) {
59 ASSERT_TRUE(RunExtensionTest("systeminfo/cpu")) << message_; 54 ASSERT_TRUE(RunExtensionTest("systeminfo/cpu")) << message_;
60 } 55 }
61 56
62 } // namespace extensions 57 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_win.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698