Commit 65d14692 authored by Mahmoud Gawad's avatar Mahmoud Gawad Committed by Commit Bot

[Telemetry SWX] Remove paramters from routines

cros_healthd had removed two paramters from two battery routines:
- |low_mah| and |high_mah| from 'BatteryCapacityRoutine'.
- |maximum_cycle_count| and |percent_battery_wear_allowed| from
'BatteryHealthRoutine'.

This CL removes the corresponding parameters from the corresponding
routines found in TelemetryExtension in both:
- Mojo interface exposed to Telemetry SWXs.
- WebIDL interface exposed to third-party code.
Also removes the dependency on the removed parameters from
browser_tests.

Bug: b:171327161
Change-Id: Idaa57d0a05986883c26337a151f0c0adfb5f5272
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2507698Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarOleh Lamzin <lamzin@google.com>
Commit-Queue: Mahmoud Gawad <mgawad@google.com>
Cr-Commit-Position: refs/heads/master@{#823534}
parent 048aae96
......@@ -64,10 +64,7 @@ void DiagnosticsService::GetRoutineUpdate(
std::move(callback)));
}
// TODO(b/171327161): Remove |low_mah| and |high_mah| from this routine.
void DiagnosticsService::RunBatteryCapacityRoutine(
uint32_t low_mah,
uint32_t high_mah,
RunBatteryCapacityRoutineCallback callback) {
GetService()->RunBatteryCapacityRoutine(
base::BindOnce(
......@@ -79,11 +76,7 @@ void DiagnosticsService::RunBatteryCapacityRoutine(
std::move(callback)));
}
// TODO(b/171327161): Remove |maximum_cycle_count| and
// |percent_battery_wear_allowed| from this routine.
void DiagnosticsService::RunBatteryHealthRoutine(
uint32_t maximum_cycle_count,
uint32_t percent_battery_wear_allowed,
RunBatteryHealthRoutineCallback callback) {
GetService()->RunBatteryHealthRoutine(
base::BindOnce(
......
......@@ -38,12 +38,8 @@ class DiagnosticsService : public health::mojom::DiagnosticsService {
bool include_output,
GetRoutineUpdateCallback callback) override;
void RunBatteryCapacityRoutine(
uint32_t low_mah,
uint32_t high_mah,
RunBatteryCapacityRoutineCallback callback) override;
void RunBatteryHealthRoutine(
uint32_t maximum_cycle_count,
uint32_t percent_battery_wear_allowed,
RunBatteryHealthRoutineCallback callback) override;
void RunSmartctlCheckRoutine(
RunSmartctlCheckRoutineCallback callback) override;
......
......@@ -42,38 +42,29 @@ interface DiagnosticsService {
=> (RoutineUpdate routine_update);
// Requests that the BatteryCapacity routine is created and started on the
// platform. This routine checks the battery's design capacity against the
// inputs. The routine will pass iff the design capacity of the battery read
// from the platform is inclusively within these bounds. This routine is only
// available if GetAvailableRoutines returned kBatteryCapactity.
//
// The request:
// * |low_mah| - lower bound for the battery's design capacity (mAh).
// * |high_mah| - upper bound for the battery's design capacity (mAh).
// platform. This routine checks the battery's design capacity against inputs
// configured in cros_config. If no configuration data is present in
// cros_config, the routine will fall back to fleet-wide default values of
// [1000, 10000]. The routine will pass iff the design capacity of the battery
// read from the platform is inclusively within these bounds. This routine is
// only available if GetAvailableRoutines returned kBatteryCapactity.
//
// The response:
// * |response| - contains a unique identifier and status for the created
// routine.
RunBatteryCapacityRoutine(uint32 low_mah, uint32 high_mah)
=> (RunRoutineResponse response);
RunBatteryCapacityRoutine() => (RunRoutineResponse response);
// Requests that the BatteryHealth routine is created and started on the
// platform. This routine checks the cycle count and percent wear of the
// battery. This routine is only available if GetAvailableRoutines returned
// kBatteryHealth.
//
// The request:
// * |maximum_cycle_count| - maximum cycle count allowed for the routine to
// pass.
// * |percent_battery_wear_allowed| - maximum percent battery wear allowed for
// the routine to pass.
// battery against inputs configured in cros_config. If no configuration data
// is present in cros_config, the routine will fall back to fleet-wide default
// values of 1000 for the maximum allowable cycle count and 50% for maximum
// battery wear percentage allowed. This routine is only available if
// GetAvailableRoutines returned kBatteryHealth.
//
// The response:
// * |response| - contains a unique identifier and status for the created
// routine.
RunBatteryHealthRoutine(uint32 maximum_cycle_count,
uint32 percent_battery_wear_allowed)
=> (RunRoutineResponse response);
RunBatteryHealthRoutine() => (RunRoutineResponse response);
// Requests that the SmartctlCheck routine is created and started on the
// platform. This routine checks available spare NVMe capacity against the
......
......@@ -80,18 +80,14 @@ dpsl_internal.DiagnosticsGetRoutineUpdateResponse;
/**
* Request message sent by the unprivileged context to the privileged
* context to run battery capacity routine.
* @typedef {{
* lowMah: !number,
* highMah: !number}}
* @typedef { null }
*/
dpsl_internal.DiagnosticsRunBatteryCapacityRoutineRequest;
/**
* Request message sent by the unprivileged context to the privileged
* context to run battery health routine.
* @typedef {{
* maximumCycleCount: !number,
* percentBatteryWearAllowed: !number}}
* @typedef { null }
*/
dpsl_internal.DiagnosticsRunBatteryHealthRoutineRequest;
......
......@@ -354,32 +354,18 @@ class DiagnosticsProxy {
/**
* Runs battery capacity routine.
* @param { !Object } message
* @return { !RunRoutineResponsePromise }
*/
async handleRunBatteryCapacityRoutine(message) {
const request =
/**
* @type {!dpsl_internal.DiagnosticsRunBatteryCapacityRoutineRequest}
*/
(message);
return await getOrCreateDiagnosticsService().runBatteryCapacityRoutine(
request.lowMah, request.highMah);
async handleRunBatteryCapacityRoutine() {
return await getOrCreateDiagnosticsService().runBatteryCapacityRoutine();
};
/**
* Runs battery health routine.
* @param { !Object } message
* @return { !RunRoutineResponsePromise }
*/
async handleRunBatteryHealthRoutine(message) {
const request =
/**
* @type {!dpsl_internal.DiagnosticsRunBatteryHealthRoutineRequest}
*/
(message);
return await getOrCreateDiagnosticsService().runBatteryHealthRoutine(
request.maximumCycleCount, request.percentBatteryWearAllowed);
async handleRunBatteryHealthRoutine() {
return await getOrCreateDiagnosticsService().runBatteryHealthRoutine();
};
/**
......@@ -973,14 +959,12 @@ untrustedMessagePipe.registerHandler(
untrustedMessagePipe.registerHandler(
dpsl_internal.Message.DIAGNOSTICS_RUN_BATTERY_CAPACITY_ROUTINE,
(message) => diagnosticsProxy.genericRunRoutineHandler(
(message) => diagnosticsProxy.handleRunBatteryCapacityRoutine(message),
message));
() => diagnosticsProxy.handleRunBatteryCapacityRoutine(), message));
untrustedMessagePipe.registerHandler(
dpsl_internal.Message.DIAGNOSTICS_RUN_BATTERY_HEALTH_ROUTINE,
(message) => diagnosticsProxy.genericRunRoutineHandler(
(message) => diagnosticsProxy.handleRunBatteryHealthRoutine(message),
message));
() => diagnosticsProxy.handleRunBatteryHealthRoutine(), message));
untrustedMessagePipe.registerHandler(
dpsl_internal.Message.DIAGNOSTICS_RUN_SMARTCTL_CHECK_ROUTINE,
......
......@@ -77,21 +77,13 @@ chromeos.test_support = {};
/**
* Requests battery capacity routine to be run.
* @param { !number } lowMah
* @param { !number } highMah
* @return { !Promise<!Object> }
* @public
*/
async runBatteryCapacityRoutine(lowMah, highMah) {
const message =
/**
@type {!dpsl_internal.DiagnosticsRunBatteryCapacityRoutineRequest}
*/
({lowMah: lowMah, highMah: highMah});
async runBatteryCapacityRoutine() {
const response =
/** @type {!Object} */ (await messagePipe.sendMessage(
dpsl_internal.Message.DIAGNOSTICS_RUN_BATTERY_CAPACITY_ROUTINE,
message));
dpsl_internal.Message.DIAGNOSTICS_RUN_BATTERY_CAPACITY_ROUTINE));
if (response instanceof Error) {
throw response;
}
......@@ -100,25 +92,13 @@ chromeos.test_support = {};
/**
* Requests battery health routine to be run.
* @param { !number } maximumCycleCount
* @param { !number } percentBatteryWearAllowed
* @return { !Promise<!Object> }
* @public
*/
async runBatteryHealthRoutine(
maximumCycleCount, percentBatteryWearAllowed) {
const message =
/**
@type {!dpsl_internal.DiagnosticsRunBatteryCapacityRoutineRequest}
*/
({
maximumCycleCount: maximumCycleCount,
percentBatteryWearAllowed: percentBatteryWearAllowed
});
async runBatteryHealthRoutine() {
const response =
/** @type {!Object} */ (await messagePipe.sendMessage(
dpsl_internal.Message.DIAGNOSTICS_RUN_BATTERY_HEALTH_ROUTINE,
message));
dpsl_internal.Message.DIAGNOSTICS_RUN_BATTERY_HEALTH_ROUTINE));
if (response instanceof Error) {
throw response;
}
......
......@@ -117,7 +117,7 @@ UNTRUSTED_TEST(
UNTRUSTED_TEST(
'UntrustedDiagnosticsRequestRunBatteryCapacityRoutine', async () => {
const response =
await chromeos.diagnostics.runBatteryCapacityRoutine(3000, 4000);
await chromeos.diagnostics.runBatteryCapacityRoutine();
assertDeepEquals(response, {id: 123456789, status: 'ready'});
});
......@@ -125,7 +125,7 @@ UNTRUSTED_TEST(
UNTRUSTED_TEST(
'UntrustedDiagnosticsRequestRunBatteryHealthRoutine', async () => {
const response =
await chromeos.diagnostics.runBatteryHealthRoutine(10, 5);
await chromeos.diagnostics.runBatteryHealthRoutine();
assertDeepEquals(response, {id: 123456789, status: 'ready'});
});
......
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