Commit 63a656aa authored by Xiaohui Chen's avatar Xiaohui Chen Committed by Commit Bot

Fix assistant autotest api to handle more ready states

It is possible that more than one states indicate ready state,
e.g. |VISIBLE|.

Bug: None
Test: locally run multiple tast tests in sequence
Change-Id: I2ad3a89e7bc0839c60a78f6b3c4360ff05b27a35
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1836022
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarAchuith Bhandarkar <achuith@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702464}
parent 571101c1
......@@ -1717,9 +1717,11 @@ AutotestPrivateSetAssistantEnabledFunction::Run() {
if (!err_msg.empty())
return RespondNow(Error(err_msg));
auto new_state = params->enabled ? ash::mojom::AssistantState::READY
: ash::mojom::AssistantState::NOT_READY;
if (ash::AssistantState::Get()->assistant_state() == new_state)
// Any state that's not |NOT_READY| would be considered a ready state.
const bool not_ready = (ash::AssistantState::Get()->assistant_state() ==
ash::mojom::AssistantState::NOT_READY);
const bool success = (params->enabled != not_ready);
if (success)
return RespondNow(NoArguments());
// Assistant service has not responded yet, set up a delayed timer to wait for
......
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