Commit 80ca6114 authored by Trent Begin's avatar Trent Begin Committed by Commit Bot

cros_healthd: add kNotRun diagnostic routine status enum

This enum represents a routine state where the routine was not run
because it is not currently applicatble to the device.  e.g. Secure WiFi
test when the device is not connected to WiFi.

Bug: b:173063870
Change-Id: I0899c284fc51f3878e468e3aff1b6fadbf6ae7c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537776Reviewed-by: default avatarOleh Lamzin <lamzin@google.com>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Trent Begin <tbegin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827399}
parent bf8e3e1c
...@@ -47,6 +47,7 @@ mojom::StandardRoutineResult TestStatusToResult( ...@@ -47,6 +47,7 @@ mojom::StandardRoutineResult TestStatusToResult(
return mojom::StandardRoutineResult::kExecutionError; return mojom::StandardRoutineResult::kExecutionError;
case healthd::DiagnosticRoutineStatusEnum::kFailedToStart: case healthd::DiagnosticRoutineStatusEnum::kFailedToStart:
case healthd::DiagnosticRoutineStatusEnum::kUnsupported: case healthd::DiagnosticRoutineStatusEnum::kUnsupported:
case healthd::DiagnosticRoutineStatusEnum::kNotRun:
return mojom::StandardRoutineResult::kUnableToRun; return mojom::StandardRoutineResult::kUnableToRun;
case healthd::DiagnosticRoutineStatusEnum::kReady: case healthd::DiagnosticRoutineStatusEnum::kReady:
case healthd::DiagnosticRoutineStatusEnum::kRunning: case healthd::DiagnosticRoutineStatusEnum::kRunning:
......
...@@ -154,6 +154,8 @@ health::mojom::DiagnosticRoutineStatusEnum Convert( ...@@ -154,6 +154,8 @@ health::mojom::DiagnosticRoutineStatusEnum Convert(
return health::mojom::DiagnosticRoutineStatusEnum::kCancelling; return health::mojom::DiagnosticRoutineStatusEnum::kCancelling;
case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kUnsupported: case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kUnsupported:
return health::mojom::DiagnosticRoutineStatusEnum::kUnsupported; return health::mojom::DiagnosticRoutineStatusEnum::kUnsupported;
case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kNotRun:
return health::mojom::DiagnosticRoutineStatusEnum::kNotRun;
} }
NOTREACHED(); NOTREACHED();
return static_cast<health::mojom::DiagnosticRoutineStatusEnum>( return static_cast<health::mojom::DiagnosticRoutineStatusEnum>(
......
...@@ -37,6 +37,8 @@ TEST(DiagnosticsServiceConvertersTest, ConvertDiagnosticRoutineStatusEnum) { ...@@ -37,6 +37,8 @@ TEST(DiagnosticsServiceConvertersTest, ConvertDiagnosticRoutineStatusEnum) {
health::DiagnosticRoutineStatusEnum::kCancelling); health::DiagnosticRoutineStatusEnum::kCancelling);
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kUnsupported), EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kUnsupported),
health::DiagnosticRoutineStatusEnum::kUnsupported); health::DiagnosticRoutineStatusEnum::kUnsupported);
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kNotRun),
health::DiagnosticRoutineStatusEnum::kNotRun);
} }
TEST(DiagnosticsServiceConvertersTest, TEST(DiagnosticsServiceConvertersTest,
......
...@@ -286,6 +286,7 @@ enum DiagnosticRoutineStatusEnum { ...@@ -286,6 +286,7 @@ enum DiagnosticRoutineStatusEnum {
kRemoved = 8, // Routine has been removed and is no longer valid. kRemoved = 8, // Routine has been removed and is no longer valid.
kCancelling = 9, // Routine is in the process of being cancelled. kCancelling = 9, // Routine is in the process of being cancelled.
kUnsupported = 10, // Routine is not supported by the device. kUnsupported = 10, // Routine is not supported by the device.
kNotRun = 11, // Routine was not run because it is currently not applicable.
}; };
// Enumeration of each of the messages a diagnostics routine can pass back. // Enumeration of each of the messages a diagnostics routine can pass back.
......
...@@ -120,6 +120,7 @@ class DiagnosticsProxy { ...@@ -120,6 +120,7 @@ class DiagnosticsProxy {
[statusEnum.kRemoved, 'removed'], [statusEnum.kRemoved, 'removed'],
[statusEnum.kCancelling, 'cancelling'], [statusEnum.kCancelling, 'cancelling'],
[statusEnum.kUnsupported, 'unsupported'], [statusEnum.kUnsupported, 'unsupported'],
[statusEnum.kNotRun, 'not-run'],
]); ]);
if (this.enumToStatus_.size !== statusEnum.MAX_VALUE + 1) { if (this.enumToStatus_.size !== statusEnum.MAX_VALUE + 1) {
......
...@@ -103,6 +103,8 @@ TEST_F('TelemetryExtensionUIBrowserTest', 'ConvertDiagnosticsEnums', () => { ...@@ -103,6 +103,8 @@ TEST_F('TelemetryExtensionUIBrowserTest', 'ConvertDiagnosticsEnums', () => {
diagnosticsProxy.convertStatus(statusEnum.kCancelling), 'cancelling'); diagnosticsProxy.convertStatus(statusEnum.kCancelling), 'cancelling');
assertEquals( assertEquals(
diagnosticsProxy.convertStatus(statusEnum.kUnsupported), 'unsupported'); diagnosticsProxy.convertStatus(statusEnum.kUnsupported), 'unsupported');
assertEquals(
diagnosticsProxy.convertStatus(statusEnum.kNotRun), 'not-run');
// Unit tests for convertUserMessage // Unit tests for convertUserMessage
const userMessageEnum = const userMessageEnum =
......
...@@ -64,6 +64,7 @@ enum DiagnosticRoutineStatusEnum { ...@@ -64,6 +64,7 @@ enum DiagnosticRoutineStatusEnum {
kRemoved = 8, // Routine has been removed and is no longer valid. kRemoved = 8, // Routine has been removed and is no longer valid.
kCancelling = 9, // Routine is in the process of being cancelled. kCancelling = 9, // Routine is in the process of being cancelled.
kUnsupported = 10, // Routine is not supported by the device. kUnsupported = 10, // Routine is not supported by the device.
kNotRun = 11, // Routine was not run because it is currently not applicable.
}; };
// Enumeration of each of the messages a diagnostics routine can pass back. // Enumeration of each of the messages a diagnostics routine can pass back.
......
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