| OLD | NEW |
| 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 | 4 |
| 5 // systeminfo.cpu api test | 5 // systeminfo.cpu api test |
| 6 // browser_tests.exe --gtest_filter=SystemInfoCpuApiTest.* | 6 // browser_tests.exe --gtest_filter=SystemInfoCpuApiTest.* |
| 7 | 7 |
| 8 chrome.systemInfo = chrome.experimental.systemInfo; | |
| 9 | |
| 10 var userStep = 3; | 8 var userStep = 3; |
| 11 var kernelStep = 2; | 9 var kernelStep = 2; |
| 12 var idleStep = 1; | 10 var idleStep = 1; |
| 13 function calculateUsage(count) { | 11 function calculateUsage(count) { |
| 14 return (100 - idleStep * 100/(userStep + kernelStep + idleStep)); | 12 return (100 - idleStep * 100/(userStep + kernelStep + idleStep)); |
| 15 } | 13 } |
| 16 | 14 |
| 17 chrome.test.runTests([ | 15 chrome.test.runTests([ |
| 18 function testGet() { | 16 function testGet() { |
| 19 for(var i = 0; i < 20; ++i) { | 17 for(var i = 0; i < 20; ++i) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 | 33 |
| 36 chrome.test.assertEq(updateInfo.usagePerProcessor.length, 4); | 34 chrome.test.assertEq(updateInfo.usagePerProcessor.length, 4); |
| 37 for (var i = 0; i < updateInfo.usagePerProcessor.length; ++i) | 35 for (var i = 0; i < updateInfo.usagePerProcessor.length; ++i) |
| 38 chrome.test.assertEq(updateInfo.usagePerProcessor[i], expectedUsage); | 36 chrome.test.assertEq(updateInfo.usagePerProcessor[i], expectedUsage); |
| 39 if (++numOfUpdatedEvent > 5) | 37 if (++numOfUpdatedEvent > 5) |
| 40 doneUpdatedEvent(); | 38 doneUpdatedEvent(); |
| 41 }); | 39 }); |
| 42 } | 40 } |
| 43 ]); | 41 ]); |
| 44 | 42 |
| OLD | NEW |