[Telemetry] Deprecate nvme_wear_level routine
See b/330446206 for more context. Bug: b/330446206 Test: unit_tests --gtest_filter="*Telemetry*" Test: unit_tests --gtest_filter="*DeviceCommandRunRoutineJobTest*" Test: unit_tests --gtest_filter="*DiagnosticsService*" Test: extensions_unittests --gtest_filter="*TelemetryExtension*" Test: browser_tests --gtest_filter="*TelemetryExtension*" Change-Id: I47e17142d95856585dad8631e8df659412ebeeee Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5400901 Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> Reviewed-by: Byron Lee <byronlee@chromium.org> Commit-Queue: Denny Huang <dennyh@google.com> Cr-Commit-Position: refs/heads/main@{#1281048}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
3ae71530c8
commit
f83bcd9661
chrome
browser
ash
policy
telemetry_extension
chromeos
common
chromeos
extensions
chromeos
ash
services
cros_healthd
crosapi
docs/telemetry_extension
@ -314,30 +314,9 @@ void DeviceCommandRunRoutineJob::RunImpl(CallbackWithResult result_callback) {
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(result_callback)));
|
||||
break;
|
||||
}
|
||||
case ash::cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel: {
|
||||
constexpr char kWearLevelThresholdFieldName[] = "wearLevelThreshold";
|
||||
std::optional<int> wear_level_threshold =
|
||||
params_dict_.FindInt(kWearLevelThresholdFieldName);
|
||||
ash::cros_healthd::mojom::NullableUint32Ptr routine_duration;
|
||||
// The NVMe wear level routine expects one optional integer >= 0.
|
||||
if (wear_level_threshold.has_value()) {
|
||||
// If the optional integer parameter is specified, it must be >= 0.
|
||||
int value = wear_level_threshold.value();
|
||||
if (value < 0) {
|
||||
SYSLOG(ERROR) << "Invalid parameters for NVMe wear level routine.";
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(std::move(result_callback), ResultType::kFailure,
|
||||
CreatePayload(MakeInvalidParametersResponse())));
|
||||
break;
|
||||
}
|
||||
routine_duration = ash::cros_healthd::mojom::NullableUint32::New(value);
|
||||
}
|
||||
diagnostics_service->RunNvmeWearLevelRoutine(
|
||||
std::move(routine_duration),
|
||||
base::BindOnce(
|
||||
&DeviceCommandRunRoutineJob::OnCrosHealthdResponseReceived,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(result_callback)));
|
||||
case ash::cros_healthd::mojom::DiagnosticRoutineEnum::
|
||||
DEPRECATED_kNvmeWearLevel: {
|
||||
NOTIMPLEMENTED();
|
||||
break;
|
||||
}
|
||||
case ash::cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeSelfTest: {
|
||||
|
@ -44,10 +44,6 @@ constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
|
||||
constexpr char kExpectedStatusFieldName[] = "expectedStatus";
|
||||
constexpr char kExpectedPowerTypeFieldName[] = "expectedPowerType";
|
||||
|
||||
// String constants identifying the parameter fields for the NVMe wear level
|
||||
// routine.
|
||||
constexpr char kWearLevelThresholdFieldName[] = "wearLevelThreshold";
|
||||
|
||||
// String constants identifying the parameter fields for the NVMe self-test
|
||||
// routine.
|
||||
constexpr char kNvmeSelfTestTypeFieldName[] = "nvmeSelfTestType";
|
||||
@ -684,61 +680,6 @@ TEST_F(DeviceCommandRunRoutineJobTest,
|
||||
})));
|
||||
}
|
||||
|
||||
TEST_F(DeviceCommandRunRoutineJobTest, RunNvmeWearLevelRoutineSuccess) {
|
||||
auto run_routine_response =
|
||||
ash::cros_healthd::mojom::RunRoutineResponse::New(kId, kStatus);
|
||||
ash::cros_healthd::FakeCrosHealthd::Get()->SetRunRoutineResponseForTesting(
|
||||
run_routine_response);
|
||||
auto params_dict =
|
||||
base::Value::Dict().Set(kWearLevelThresholdFieldName, kPositiveInt);
|
||||
EXPECT_TRUE(
|
||||
RunJob(ash::cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel,
|
||||
std::move(params_dict),
|
||||
base::BindLambdaForTesting([](RemoteCommandJob* job) {
|
||||
EXPECT_EQ(job->status(), RemoteCommandJob::SUCCEEDED);
|
||||
std::unique_ptr<std::string> payload = job->GetResultPayload();
|
||||
EXPECT_TRUE(payload);
|
||||
EXPECT_EQ(CreateSuccessPayload(kId, kStatus), *payload);
|
||||
})));
|
||||
}
|
||||
|
||||
// Test that the NVMe wear level routine can be run without the
|
||||
// wearLevelThreshold parameter.
|
||||
TEST_F(DeviceCommandRunRoutineJobTest,
|
||||
RunNvmeWearLevelRoutineWithoutWearLevelThreshold) {
|
||||
auto run_routine_response =
|
||||
ash::cros_healthd::mojom::RunRoutineResponse::New(kId, kStatus);
|
||||
ash::cros_healthd::FakeCrosHealthd::Get()->SetRunRoutineResponseForTesting(
|
||||
run_routine_response);
|
||||
base::Value::Dict params_dict;
|
||||
EXPECT_TRUE(
|
||||
RunJob(ash::cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel,
|
||||
std::move(params_dict),
|
||||
base::BindLambdaForTesting([](RemoteCommandJob* job) {
|
||||
EXPECT_EQ(job->status(), RemoteCommandJob::SUCCEEDED);
|
||||
std::unique_ptr<std::string> payload = job->GetResultPayload();
|
||||
EXPECT_TRUE(payload);
|
||||
EXPECT_EQ(CreateSuccessPayload(kId, kStatus), *payload);
|
||||
})));
|
||||
}
|
||||
|
||||
// Test that a negative wearLevelThreshold parameter causes the NVMe wear level
|
||||
// routine to fail.
|
||||
TEST_F(DeviceCommandRunRoutineJobTest,
|
||||
RunNvmeWearLevelRoutineInvalidWearLevelThreshold) {
|
||||
base::Value::Dict params_dict;
|
||||
params_dict.Set(kWearLevelThresholdFieldName, kNegativeInt);
|
||||
EXPECT_TRUE(
|
||||
RunJob(ash::cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel,
|
||||
std::move(params_dict),
|
||||
base::BindLambdaForTesting([](RemoteCommandJob* job) {
|
||||
EXPECT_EQ(job->status(), RemoteCommandJob::FAILED);
|
||||
std::unique_ptr<std::string> payload = job->GetResultPayload();
|
||||
EXPECT_TRUE(payload);
|
||||
EXPECT_EQ(CreateInvalidParametersFailurePayload(), *payload);
|
||||
})));
|
||||
}
|
||||
|
||||
TEST_F(DeviceCommandRunRoutineJobTest, RunNvmeSelfTestRoutineSuccess) {
|
||||
constexpr auto kValidNvmeSelfTestTypeEnum =
|
||||
ash::cros_healthd::mojom::NvmeSelfTestTypeEnum::kShortSelfTest;
|
||||
|
@ -409,19 +409,11 @@ void DiagnosticsServiceAsh::RunNvmeSelfTestRoutine(
|
||||
std::move(callback)));
|
||||
}
|
||||
|
||||
void DiagnosticsServiceAsh::RunNvmeWearLevelRoutine(
|
||||
void DiagnosticsServiceAsh::DEPRECATED_RunNvmeWearLevelRoutine(
|
||||
uint32_t wear_level_threshold,
|
||||
RunNvmeWearLevelRoutineCallback callback) {
|
||||
GetService()->RunNvmeWearLevelRoutine(
|
||||
cros_healthd::mojom::NullableUint32::New(wear_level_threshold),
|
||||
base::BindOnce(
|
||||
[](crosapi::mojom::DiagnosticsService::RunNvmeWearLevelRoutineCallback
|
||||
callback,
|
||||
cros_healthd::mojom::RunRoutineResponsePtr ptr) {
|
||||
std::move(callback).Run(
|
||||
converters::diagnostics::ConvertDiagnosticsPtr(std::move(ptr)));
|
||||
},
|
||||
std::move(callback)));
|
||||
DEPRECATED_RunNvmeWearLevelRoutineCallback callback) {
|
||||
// This routine is deprecated.
|
||||
std::move(callback).Run(nullptr);
|
||||
}
|
||||
|
||||
void DiagnosticsServiceAsh::RunPrimeSearchRoutine(
|
||||
|
@ -109,9 +109,9 @@ class DiagnosticsServiceAsh : public crosapi::mojom::DiagnosticsService {
|
||||
void RunNvmeSelfTestRoutine(
|
||||
crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum nvme_self_test_type,
|
||||
RunNvmeSelfTestRoutineCallback callback) override;
|
||||
void RunNvmeWearLevelRoutine(
|
||||
void DEPRECATED_RunNvmeWearLevelRoutine(
|
||||
uint32_t wear_level_threshold,
|
||||
RunNvmeWearLevelRoutineCallback callback) override;
|
||||
DEPRECATED_RunNvmeWearLevelRoutineCallback callback) override;
|
||||
void RunPrimeSearchRoutine(uint32_t length_seconds,
|
||||
RunPrimeSearchRoutineCallback callback) override;
|
||||
void RunSensitiveSensorRoutine(
|
||||
|
@ -79,7 +79,6 @@ TEST_F(DiagnosticsServiceAshTest, GetAvailableRoutinesSuccess) {
|
||||
cros_healthd::mojom::DiagnosticRoutineEnum::kDnsResolverPresent,
|
||||
cros_healthd::mojom::DiagnosticRoutineEnum::kLanConnectivity,
|
||||
cros_healthd::mojom::DiagnosticRoutineEnum::kMemory,
|
||||
cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel,
|
||||
cros_healthd::mojom::DiagnosticRoutineEnum::kSignalStrength,
|
||||
cros_healthd::mojom::DiagnosticRoutineEnum::kGatewayCanBePinged,
|
||||
cros_healthd::mojom::DiagnosticRoutineEnum::kSmartctlCheck,
|
||||
@ -114,7 +113,6 @@ TEST_F(DiagnosticsServiceAshTest, GetAvailableRoutinesSuccess) {
|
||||
crosapi::mojom::DiagnosticsRoutineEnum::kDnsResolverPresent,
|
||||
crosapi::mojom::DiagnosticsRoutineEnum::kLanConnectivity,
|
||||
crosapi::mojom::DiagnosticsRoutineEnum::kMemory,
|
||||
crosapi::mojom::DiagnosticsRoutineEnum::kNvmeWearLevel,
|
||||
crosapi::mojom::DiagnosticsRoutineEnum::kSignalStrength,
|
||||
crosapi::mojom::DiagnosticsRoutineEnum::kGatewayCanBePinged,
|
||||
crosapi::mojom::DiagnosticsRoutineEnum::kSmartctlCheck,
|
||||
@ -585,27 +583,6 @@ TEST_F(DiagnosticsServiceAshTest, RunNvmeSelfTestRoutineSuccess) {
|
||||
->DidExpectedDiagnosticsParametersMatch());
|
||||
}
|
||||
|
||||
TEST_F(DiagnosticsServiceAshTest, RunNvmeWearLevelRoutineSuccess) {
|
||||
// Configure FakeCrosHealthd.
|
||||
SetSuccessfulRoutineResponse();
|
||||
base::Value::Dict expected_passed_parameters;
|
||||
expected_passed_parameters.Set("wear_level_threshold", 80);
|
||||
cros_healthd::FakeCrosHealthd::Get()
|
||||
->SetExpectedLastPassedDiagnosticsParametersForTesting(
|
||||
std::move(expected_passed_parameters));
|
||||
|
||||
base::test::TestFuture<crosapi::mojom::DiagnosticsRunRoutineResponsePtr>
|
||||
future;
|
||||
diagnostics_service()->RunNvmeWearLevelRoutine(80, future.GetCallback());
|
||||
|
||||
ASSERT_TRUE(future.Wait());
|
||||
const auto& result = future.Get();
|
||||
ValidateResponse(result,
|
||||
cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel);
|
||||
EXPECT_TRUE(cros_healthd::FakeCrosHealthd::Get()
|
||||
->DidExpectedDiagnosticsParametersMatch());
|
||||
}
|
||||
|
||||
TEST_F(DiagnosticsServiceAshTest, RunPrimeSearchRoutineSuccess) {
|
||||
// Configure FakeCrosHealthd.
|
||||
SetSuccessfulRoutineResponse();
|
||||
|
@ -81,8 +81,6 @@ std::optional<crosapi::mojom::DiagnosticsRoutineEnum> Convert(
|
||||
return crosapi::mojom::DiagnosticsRoutineEnum::kCpuStress;
|
||||
case cros_healthd::mojom::DiagnosticRoutineEnum::kFloatingPointAccuracy:
|
||||
return crosapi::mojom::DiagnosticsRoutineEnum::kFloatingPointAccuracy;
|
||||
case cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel:
|
||||
return crosapi::mojom::DiagnosticsRoutineEnum::kNvmeWearLevel;
|
||||
case cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeSelfTest:
|
||||
return crosapi::mojom::DiagnosticsRoutineEnum::kNvmeSelfTest;
|
||||
case cros_healthd::mojom::DiagnosticRoutineEnum::kDiskRead:
|
||||
@ -131,6 +129,9 @@ std::optional<crosapi::mojom::DiagnosticsRoutineEnum> Convert(
|
||||
return crosapi::mojom::DiagnosticsRoutineEnum::kBluetoothPairing;
|
||||
case cros_healthd::mojom::DiagnosticRoutineEnum::kFan:
|
||||
return crosapi::mojom::DiagnosticsRoutineEnum::kFan;
|
||||
// Below are deprecated routines.
|
||||
case cros_healthd::mojom::DiagnosticRoutineEnum::DEPRECATED_kNvmeWearLevel:
|
||||
return crosapi::mojom::DiagnosticsRoutineEnum::DEPRECATED_kNvmeWearLevel;
|
||||
default:
|
||||
return std::nullopt;
|
||||
}
|
||||
|
@ -61,10 +61,6 @@ TEST(DiagnosticsServiceConvertersTest, ConvertDiagnosticRoutineEnum) {
|
||||
crosapi::DiagnosticsRoutineEnum::kMemory);
|
||||
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineEnum::kNvmeSelfTest),
|
||||
crosapi::DiagnosticsRoutineEnum::kNvmeSelfTest);
|
||||
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineEnum::kNvmeWearLevel),
|
||||
crosapi::DiagnosticsRoutineEnum::kNvmeWearLevel);
|
||||
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineEnum::kNvmeWearLevel),
|
||||
crosapi::DiagnosticsRoutineEnum::kNvmeWearLevel);
|
||||
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineEnum::kPrimeSearch),
|
||||
crosapi::DiagnosticsRoutineEnum::kPrimeSearch);
|
||||
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineEnum::kSignalStrength),
|
||||
@ -95,6 +91,9 @@ TEST(DiagnosticsServiceConvertersTest, ConvertDiagnosticRoutineEnum) {
|
||||
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineEnum::kFan),
|
||||
crosapi::DiagnosticsRoutineEnum::kFan);
|
||||
|
||||
EXPECT_EQ(
|
||||
Convert(cros_healthd::DiagnosticRoutineEnum::DEPRECATED_kNvmeWearLevel),
|
||||
crosapi::DiagnosticsRoutineEnum::DEPRECATED_kNvmeWearLevel);
|
||||
EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineEnum::kArcHttp),
|
||||
std::nullopt);
|
||||
}
|
||||
|
@ -537,19 +537,6 @@ std::string GetServiceWorkerForError(const std::string& error) {
|
||||
);
|
||||
chrome.test.succeed();
|
||||
},
|
||||
async function runNvmeWearLevelRoutine() {
|
||||
await chrome.test.assertPromiseRejects(
|
||||
chrome.os.diagnostics.runNvmeWearLevelRoutine(
|
||||
{
|
||||
wear_level_threshold: 80
|
||||
}
|
||||
),
|
||||
'Error: Unauthorized access to ' +
|
||||
'chrome.os.diagnostics.runNvmeWearLevelRoutine. ' +
|
||||
'%s'
|
||||
);
|
||||
chrome.test.succeed();
|
||||
},
|
||||
async function runPowerButtonRoutine() {
|
||||
await chrome.test.assertPromiseRejects(
|
||||
chrome.os.diagnostics.runPowerButtonRoutine(
|
||||
|
@ -432,18 +432,6 @@ void OsDiagnosticsRunNvmeSelfTestRoutineFunction::RunIfAllowed() {
|
||||
GetOnResult());
|
||||
}
|
||||
|
||||
// OsDiagnosticsRunNvmeWearLevelRoutineFunction --------------------------------
|
||||
|
||||
void OsDiagnosticsRunNvmeWearLevelRoutineFunction::RunIfAllowed() {
|
||||
const auto params = GetParams<cx_diag::RunNvmeWearLevelRoutine::Params>();
|
||||
if (!params) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetRemoteService()->RunNvmeWearLevelRoutine(
|
||||
params->request.wear_level_threshold, GetOnResult());
|
||||
}
|
||||
|
||||
// OsDiagnosticsRunSensitiveSensorRoutineFunction -----------------------------
|
||||
|
||||
void OsDiagnosticsRunSensitiveSensorRoutineFunction::RunIfAllowed() {
|
||||
|
@ -346,17 +346,6 @@ class OsDiagnosticsRunNvmeSelfTestRoutineFunction
|
||||
void RunIfAllowed() override;
|
||||
};
|
||||
|
||||
class OsDiagnosticsRunNvmeWearLevelRoutineFunction
|
||||
: public DiagnosticsApiRunRoutineFunctionBase {
|
||||
DECLARE_EXTENSION_FUNCTION("os.diagnostics.runNvmeWearLevelRoutine",
|
||||
OS_DIAGNOSTICS_RUNNVMEWEARLEVELROUTINE)
|
||||
private:
|
||||
~OsDiagnosticsRunNvmeWearLevelRoutineFunction() override = default;
|
||||
|
||||
// BaseTelemetryExtensionApiGuardFunction:
|
||||
void RunIfAllowed() override;
|
||||
};
|
||||
|
||||
class OsDiagnosticsRunSensitiveSensorRoutineFunction
|
||||
: public DiagnosticsApiRunRoutineFunctionBase {
|
||||
DECLARE_EXTENSION_FUNCTION("os.diagnostics.runSensitiveSensorRoutine",
|
||||
|
@ -106,7 +106,6 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionDiagnosticsApiBrowserTest,
|
||||
crosapi::DiagnosticsRoutineEnum::kDnsResolverPresent,
|
||||
crosapi::DiagnosticsRoutineEnum::kLanConnectivity,
|
||||
crosapi::DiagnosticsRoutineEnum::kMemory,
|
||||
crosapi::DiagnosticsRoutineEnum::kNvmeWearLevel,
|
||||
crosapi::DiagnosticsRoutineEnum::kSignalStrength,
|
||||
crosapi::DiagnosticsRoutineEnum::kGatewayCanBePinged,
|
||||
crosapi::DiagnosticsRoutineEnum::kSmartctlCheck,
|
||||
@ -150,7 +149,6 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionDiagnosticsApiBrowserTest,
|
||||
"dns_resolver_present",
|
||||
"lan_connectivity",
|
||||
"memory",
|
||||
"nvme_wear_level",
|
||||
"signal_strength",
|
||||
"gateway_can_be_pinged",
|
||||
"smartctl_check",
|
||||
@ -1048,43 +1046,6 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionDiagnosticsApiBrowserTest,
|
||||
)");
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(TelemetryExtensionDiagnosticsApiBrowserTest,
|
||||
RunNvmeWearLevelRoutineSuccess) {
|
||||
// Configure FakeDiagnosticsService.
|
||||
{
|
||||
auto expected_response = crosapi::DiagnosticsRunRoutineResponse::New();
|
||||
expected_response->id = 0;
|
||||
expected_response->status = crosapi::DiagnosticsRoutineStatusEnum::kReady;
|
||||
|
||||
// Set the return value for a call to RunNvmeWearLevelRoutine.
|
||||
auto fake_service_impl = std::make_unique<FakeDiagnosticsService>();
|
||||
fake_service_impl->SetRunRoutineResponse(std::move(expected_response));
|
||||
|
||||
// Set the expected runtime actions.
|
||||
fake_service_impl->SetExpectedLastPassedParameters(
|
||||
base::Value::Dict().Set("wear_level_threshold", 80));
|
||||
fake_service_impl->SetExpectedLastCalledRoutine(
|
||||
crosapi::DiagnosticsRoutineEnum::kNvmeWearLevel);
|
||||
|
||||
SetServiceForTesting(std::move(fake_service_impl));
|
||||
}
|
||||
|
||||
CreateExtensionAndRunServiceWorker(R"(
|
||||
chrome.test.runTests([
|
||||
async function runNvmeWearLevelRoutine() {
|
||||
const response =
|
||||
await chrome.os.diagnostics.runNvmeWearLevelRoutine(
|
||||
{
|
||||
wear_level_threshold: 80
|
||||
}
|
||||
);
|
||||
chrome.test.assertEq({id: 0, status: "ready"}, response);
|
||||
chrome.test.succeed();
|
||||
}
|
||||
]);
|
||||
)");
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(TelemetryExtensionDiagnosticsApiBrowserTest,
|
||||
RunSensitiveSensorRoutineSuccess) {
|
||||
// Configure FakeDiagnosticsService.
|
||||
|
@ -64,9 +64,6 @@ bool ConvertMojoRoutine(crosapi::DiagnosticsRoutineEnum in,
|
||||
case crosapi::DiagnosticsRoutineEnum::kMemory:
|
||||
*out = cx_diag::RoutineType::kMemory;
|
||||
return true;
|
||||
case crosapi::DiagnosticsRoutineEnum::kNvmeWearLevel:
|
||||
*out = cx_diag::RoutineType::kNvmeWearLevel;
|
||||
return true;
|
||||
case crosapi::DiagnosticsRoutineEnum::kSignalStrength:
|
||||
*out = cx_diag::RoutineType::kSignalStrength;
|
||||
return true;
|
||||
@ -115,6 +112,8 @@ bool ConvertMojoRoutine(crosapi::DiagnosticsRoutineEnum in,
|
||||
case crosapi::DiagnosticsRoutineEnum::kFan:
|
||||
*out = cx_diag::RoutineType::kFan;
|
||||
return true;
|
||||
// Below are deprecated routines.
|
||||
case crosapi::DiagnosticsRoutineEnum::DEPRECATED_kNvmeWearLevel:
|
||||
case crosapi::DiagnosticsRoutineEnum::kUnknown:
|
||||
return false;
|
||||
}
|
||||
|
11
chrome/browser/chromeos/extensions/telemetry/api/diagnostics/diagnostics_api_converters_unittest.cc
11
chrome/browser/chromeos/extensions/telemetry/api/diagnostics/diagnostics_api_converters_unittest.cc
@ -106,12 +106,6 @@ TEST(TelemetryExtensionDiagnosticsApiConvertersUnitTest,
|
||||
crosapi::DiagnosticsRoutineEnum::kNvmeSelfTest, &out));
|
||||
EXPECT_EQ(out, cx_diag::RoutineType::kNvmeSelfTest);
|
||||
}
|
||||
{
|
||||
cx_diag::RoutineType out = cx_diag::RoutineType::kNone;
|
||||
EXPECT_TRUE(ConvertMojoRoutine(
|
||||
crosapi::DiagnosticsRoutineEnum::kNvmeWearLevel, &out));
|
||||
EXPECT_EQ(out, cx_diag::RoutineType::kNvmeWearLevel);
|
||||
}
|
||||
{
|
||||
cx_diag::RoutineType out = cx_diag::RoutineType::kNone;
|
||||
EXPECT_TRUE(ConvertMojoRoutine(
|
||||
@ -167,6 +161,11 @@ TEST(TelemetryExtensionDiagnosticsApiConvertersUnitTest,
|
||||
ConvertMojoRoutine(crosapi::DiagnosticsRoutineEnum::kFan, &out));
|
||||
EXPECT_EQ(out, cx_diag::RoutineType::kFan);
|
||||
}
|
||||
{
|
||||
cx_diag::RoutineType out = cx_diag::RoutineType::kNone;
|
||||
EXPECT_FALSE(ConvertMojoRoutine(
|
||||
crosapi::DiagnosticsRoutineEnum::DEPRECATED_kNvmeWearLevel, &out));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(TelemetryExtensionDiagnosticsApiConvertersUnitTest, ConvertRoutineStatus) {
|
||||
|
@ -321,18 +321,10 @@ void FakeDiagnosticsService::RunNvmeSelfTestRoutine(
|
||||
base::BindOnce(std::move(callback), run_routine_response_->Clone()));
|
||||
}
|
||||
|
||||
void FakeDiagnosticsService::RunNvmeWearLevelRoutine(
|
||||
void FakeDiagnosticsService::DEPRECATED_RunNvmeWearLevelRoutine(
|
||||
uint32_t wear_level_threshold,
|
||||
RunNvmeWearLevelRoutineCallback callback) {
|
||||
actual_passed_parameters_.clear();
|
||||
actual_passed_parameters_.Set("wear_level_threshold",
|
||||
static_cast<int32_t>(wear_level_threshold));
|
||||
|
||||
actual_called_routine_ = crosapi::DiagnosticsRoutineEnum::kNvmeWearLevel;
|
||||
|
||||
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(std::move(callback), run_routine_response_->Clone()));
|
||||
DEPRECATED_RunNvmeWearLevelRoutineCallback callback) {
|
||||
std::move(callback).Run(nullptr);
|
||||
}
|
||||
|
||||
void FakeDiagnosticsService::RunPrimeSearchRoutine(
|
||||
|
@ -90,9 +90,9 @@ class FakeDiagnosticsService : public crosapi::mojom::DiagnosticsService {
|
||||
void RunNvmeSelfTestRoutine(
|
||||
crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum nvme_self_test_type,
|
||||
RunNvmeSelfTestRoutineCallback callback) override;
|
||||
void RunNvmeWearLevelRoutine(
|
||||
void DEPRECATED_RunNvmeWearLevelRoutine(
|
||||
uint32_t wear_level_threshold,
|
||||
RunNvmeWearLevelRoutineCallback callback) override;
|
||||
DEPRECATED_RunNvmeWearLevelRoutineCallback callback) override;
|
||||
void RunPrimeSearchRoutine(uint32_t length_seconds,
|
||||
RunPrimeSearchRoutineCallback callback) override;
|
||||
void RunSensitiveSensorRoutine(
|
||||
|
@ -27,7 +27,6 @@ namespace os.diagnostics {
|
||||
disk_read,
|
||||
dns_resolution,
|
||||
memory,
|
||||
nvme_wear_level,
|
||||
smartctl_check,
|
||||
lan_connectivity,
|
||||
signal_strength,
|
||||
@ -152,10 +151,6 @@ namespace os.diagnostics {
|
||||
NvmeSelfTestType test_type;
|
||||
};
|
||||
|
||||
dictionary RunNvmeWearLevelRequest {
|
||||
long wear_level_threshold;
|
||||
};
|
||||
|
||||
dictionary RunSmartctlCheckRequest {
|
||||
long? percentage_used_threshold;
|
||||
};
|
||||
@ -469,10 +464,6 @@ namespace os.diagnostics {
|
||||
RunNvmeSelfTestRequest request,
|
||||
RunRoutineCallback callback);
|
||||
|
||||
static void runNvmeWearLevelRoutine(
|
||||
RunNvmeWearLevelRequest request,
|
||||
RunRoutineCallback callback);
|
||||
|
||||
static void runSensitiveSensorRoutine(RunRoutineCallback callback);
|
||||
|
||||
static void runSignalStrengthRoutine(RunRoutineCallback callback);
|
||||
|
@ -404,26 +404,16 @@ void FakeCrosHealthd::RunFloatingPointAccuracyRoutine(
|
||||
callback_delay_);
|
||||
}
|
||||
|
||||
void FakeCrosHealthd::DEPRECATED_RunNvmeWearLevelRoutine(
|
||||
void FakeCrosHealthd::DEPRECATED_RunNvmeWearLevelRoutineWithThreshold(
|
||||
uint32_t wear_level_threshold,
|
||||
RunNvmeWearLevelRoutineCallback callback) {
|
||||
DEPRECATED_RunNvmeWearLevelRoutineWithThresholdCallback callback) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void FakeCrosHealthd::RunNvmeWearLevelRoutine(
|
||||
void FakeCrosHealthd::DEPRECATED_RunNvmeWearLevelRoutine(
|
||||
mojom::NullableUint32Ptr wear_level_threshold,
|
||||
RunNvmeWearLevelRoutineCallback callback) {
|
||||
actual_passed_parameters_.clear();
|
||||
if (!wear_level_threshold.is_null()) {
|
||||
actual_passed_parameters_.Set(
|
||||
"wear_level_threshold", static_cast<int>(wear_level_threshold->value));
|
||||
}
|
||||
|
||||
last_run_routine_ = mojom::DiagnosticRoutineEnum::kNvmeWearLevel;
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(std::move(callback), run_routine_response_.Clone()),
|
||||
callback_delay_);
|
||||
DEPRECATED_RunNvmeWearLevelRoutineCallback callback) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void FakeCrosHealthd::RunNvmeSelfTestRoutine(
|
||||
|
@ -228,12 +228,13 @@ class FakeCrosHealthd final : public mojom::CrosHealthdDiagnosticsService,
|
||||
void RunFloatingPointAccuracyRoutine(
|
||||
mojom::NullableUint32Ptr length_seconds,
|
||||
RunFloatingPointAccuracyRoutineCallback callback) override;
|
||||
void DEPRECATED_RunNvmeWearLevelRoutine(
|
||||
void DEPRECATED_RunNvmeWearLevelRoutineWithThreshold(
|
||||
uint32_t wear_level_threshold,
|
||||
RunNvmeWearLevelRoutineCallback callback) override;
|
||||
void RunNvmeWearLevelRoutine(
|
||||
DEPRECATED_RunNvmeWearLevelRoutineWithThresholdCallback callback)
|
||||
override;
|
||||
void DEPRECATED_RunNvmeWearLevelRoutine(
|
||||
mojom::NullableUint32Ptr wear_level_threshold,
|
||||
RunNvmeWearLevelRoutineCallback callback) override;
|
||||
DEPRECATED_RunNvmeWearLevelRoutineCallback callback) override;
|
||||
void RunNvmeSelfTestRoutine(mojom::NvmeSelfTestTypeEnum nvme_self_test_type,
|
||||
RunNvmeSelfTestRoutineCallback callback) override;
|
||||
void RunDiskReadRoutine(mojom::DiskReadRoutineTypeEnum type,
|
||||
|
@ -196,8 +196,8 @@ interface CrosHealthdDiagnosticsService {
|
||||
RunFloatingPointAccuracyRoutine@9(NullableUint32? length_seconds)
|
||||
=> (RunRoutineResponse response);
|
||||
|
||||
// Requests that the NvmeWearLevel routine is created and started on the
|
||||
// platform. This routine examines wear level of NVMe against input
|
||||
// [Deprecated] Requests that the NvmeWearLevel routine is created and started
|
||||
// on the platform. This routine examines wear level of NVMe against input
|
||||
// threshold.
|
||||
// The availability of this routine can be determined by checking that
|
||||
// kNvmeWearLevel is returned by GetAvailableRoutines.
|
||||
@ -211,12 +211,13 @@ interface CrosHealthdDiagnosticsService {
|
||||
// The response:
|
||||
// * |response| - contains a unique identifier and status for the created
|
||||
// routine.
|
||||
DEPRECATED_RunNvmeWearLevelRoutine@10(uint32 wear_level_threshold)
|
||||
=> (RunRoutineResponse response);
|
||||
DEPRECATED_RunNvmeWearLevelRoutineWithThreshold@10(
|
||||
uint32 wear_level_threshold)
|
||||
=> (RunRoutineResponse response);
|
||||
|
||||
[MinVersion=1] RunNvmeWearLevelRoutine@32(
|
||||
NullableUint32? wear_level_threshold)
|
||||
=> (RunRoutineResponse response);
|
||||
[MinVersion=1] DEPRECATED_RunNvmeWearLevelRoutine@32(
|
||||
NullableUint32? wear_level_threshold)
|
||||
=> (RunRoutineResponse response);
|
||||
|
||||
// Requests that the NvmeSelfTest routine is created and started on the
|
||||
// platform. This routine launches the NVMe self-test, a tool to perform
|
||||
|
@ -27,7 +27,7 @@ enum DiagnosticRoutineEnum {
|
||||
kCpuCache = 5,
|
||||
kCpuStress = 6,
|
||||
kFloatingPointAccuracy = 7,
|
||||
kNvmeWearLevel = 8,
|
||||
DEPRECATED_kNvmeWearLevel = 8,
|
||||
kNvmeSelfTest = 9,
|
||||
kDiskRead = 10,
|
||||
kPrimeSearch = 11,
|
||||
|
@ -171,9 +171,9 @@ interface DiagnosticsService {
|
||||
RunFloatingPointAccuracyRoutine@8(uint32 length_seconds)
|
||||
=> (DiagnosticsRunRoutineResponse response);
|
||||
|
||||
// Requests that the NvmeWearLevel routine is created and started on the
|
||||
// platform. This routine examines wear level of NVMe against input
|
||||
// threshold.
|
||||
// [Deprecated in M125] Requests that the NvmeWearLevel routine is created and
|
||||
// started on the platform. This routine examines wear level of NVMe against
|
||||
// input threshold.
|
||||
// The availability of this routine can be determined by checking that
|
||||
// kNvmeWearLevel is returned by GetAvailableRoutines.
|
||||
//
|
||||
@ -184,7 +184,7 @@ interface DiagnosticsService {
|
||||
// The response:
|
||||
// * |response| - contains a unique identifier and status for the created
|
||||
// routine.
|
||||
RunNvmeWearLevelRoutine@9(uint32 wear_level_threshold)
|
||||
DEPRECATED_RunNvmeWearLevelRoutine@9(uint32 wear_level_threshold)
|
||||
=> (DiagnosticsRunRoutineResponse response);
|
||||
|
||||
// Requests that the NvmeSelfTest routine is created and started on the
|
||||
@ -511,7 +511,7 @@ enum DiagnosticsRoutineEnum {
|
||||
kCpuCache = 4,
|
||||
kCpuStress = 5,
|
||||
kFloatingPointAccuracy = 6,
|
||||
kNvmeWearLevel = 7,
|
||||
DEPRECATED_kNvmeWearLevel = 7,
|
||||
kNvmeSelfTest = 8,
|
||||
kDiskRead = 9,
|
||||
kPrimeSearch = 10,
|
||||
|
@ -28,7 +28,6 @@ extension-event based interface in M119. The interface is described in
|
||||
| disk_read |
|
||||
| dns_resolution |
|
||||
| memory |
|
||||
| nvme_wear_level |
|
||||
| smartctl_check |
|
||||
| lan_connectivity |
|
||||
| signal_strength |
|
||||
@ -134,11 +133,6 @@ extension-event based interface in M119. The interface is described in
|
||||
------------ | ------- | ----------- |
|
||||
| timeout_seconds | number | A timeout for the routine |
|
||||
|
||||
### RunNvmeWearLevelRequest
|
||||
| Property Name | Type | Description |
|
||||
------------ | ------- | ----------- |
|
||||
| wear_level_threshold | number | Threshold number in percentage which routine examines wear level status against |
|
||||
|
||||
### RunNvmeSelfTestRequest
|
||||
| Property Name | Type | Description |
|
||||
------------ | ------- | ----------- |
|
||||
@ -206,7 +200,6 @@ extension-event based interface in M119. The interface is described in
|
||||
| runLanConnectivityRoutine | () => Promise<RunRoutineResponse\> | `os.diagnostics` | M102 |
|
||||
| runMemoryRoutine | () => Promise<RunRoutineResponse\> | `os.diagnostics` | M96 |
|
||||
| runNvmeSelfTestRoutine | (params: RunNvmeSelfTestRequest) => Promise<RunRoutineResponse\> | `os.diagnostics` | M110 |
|
||||
| runNvmeWearLevelRoutine | (params: RunNvmeWearLevelRequest) => Promise<RunRoutineResponse\> | `os.diagnostics` | M102 |
|
||||
| runPowerButtonRoutine | (params: RunPowerButtonRequest) => Promise<RunRoutineResponse\> | `os.diagnostics` | M117 |
|
||||
| runSensitiveSensorRoutine | () => Promise<RunRoutineResponse\> | `os.diagnostics` | M110 |
|
||||
| runSignalStrengthRoutine | () => Promise<RunRoutineResponse\> | `os.diagnostics` | M108 |
|
||||
|
Reference in New Issue
Block a user