Commit 8eb425c8 authored by Zentaro Kavanagh's avatar Zentaro Kavanagh Committed by Commit Bot

Diagnostics: Initialize fake results for routines

Bug: 1125150
Test: browser_tests --gtest_filter=DiagnosticsApp*
Change-Id: I696e35be95121112cf9ce1e401ca13ff188ca488
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518195
Commit-Queue: Zentaro Kavanagh <zentaro@chromium.org>
Auto-Submit: Zentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823730}
parent a82f715d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import {BatteryChargeStatus, BatteryHealth, CpuUsage, ExternalPowerSource, MemoryUsage, SystemInfo} from './diagnostics_types.js' import {BatteryChargeStatus, BatteryHealth, CpuUsage, ExternalPowerSource, MemoryUsage, RoutineName, StandardRoutineResult, SystemInfo} from './diagnostics_types.js'
/* @type {!Array<!BatteryChargeStatus>} */ /* @type {!Array<!BatteryChargeStatus>} */
export const fakeBatteryChargeStatus = [ export const fakeBatteryChargeStatus = [
...@@ -144,3 +144,12 @@ export const fakeSystemInfoWithoutBattery = { ...@@ -144,3 +144,12 @@ export const fakeSystemInfoWithoutBattery = {
total_memory_kib: 128000, total_memory_kib: 128000,
version: {milestone_version: 'M99'}, version: {milestone_version: 'M99'},
}; };
/* @type {!Map<RoutineName, StandardRoutineResult} */
export const fakeRoutineResults = new Map([
[RoutineName.kCpuStress, StandardRoutineResult.kTestPassed],
[RoutineName.kCpuCache, StandardRoutineResult.kTestPassed],
[RoutineName.kFloatingPoint, StandardRoutineResult.kTestFailed],
[RoutineName.kPrimeSearch, StandardRoutineResult.kErrorExecuting],
[RoutineName.kMemory, StandardRoutineResult.kTestPassed],
]);
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import {assert} from 'chrome://resources/js/assert.m.js'; import {assert} from 'chrome://resources/js/assert.m.js';
import {SystemDataProviderInterface, SystemInfo, SystemRoutineControllerInterface} from './diagnostics_types.js'; import {SystemDataProviderInterface, SystemInfo, SystemRoutineControllerInterface} from './diagnostics_types.js';
import {fakeBatteryChargeStatus, fakeBatteryHealth, fakeBatteryInfo, fakeCpuUsage, fakeMemoryUsage, fakeSystemInfo} from './fake_data.js'; import {fakeBatteryChargeStatus, fakeBatteryHealth, fakeBatteryInfo, fakeCpuUsage, fakeMemoryUsage, fakeRoutineResults, fakeSystemInfo} from './fake_data.js';
import {FakeSystemDataProvider} from './fake_system_data_provider.js'; import {FakeSystemDataProvider} from './fake_system_data_provider.js';
import {FakeSystemRoutineController} from './fake_system_routine_controller.js'; import {FakeSystemRoutineController} from './fake_system_routine_controller.js';
...@@ -48,6 +48,11 @@ function setupFakeSystemRoutineController_() { ...@@ -48,6 +48,11 @@ function setupFakeSystemRoutineController_() {
// Add a small delay while running fake routines. // Add a small delay while running fake routines.
controller.setDelayTimeInMillisecondsForTesting(2000); controller.setDelayTimeInMillisecondsForTesting(2000);
// Add fake results for routines.
for (const [routine, result] of fakeRoutineResults.entries()) {
controller.setFakeStandardRoutineResult(routine, result);
}
// Set the fake controller. // Set the fake controller.
setSystemRoutineControllerForTesting(controller); setSystemRoutineControllerForTesting(controller);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment