0

[CrOS Network] Disable mobile toggle when uninitialized

This CL updated Mobile data enable/disable toggle button to be visible
but disabled when cellular device is uninitialized, previously the
toggle visibility was set to false.

Screenshots:
before: https://screenshot.googleplex.com/4bcK2h9uUXjeaKW
after: https://screenshot.googleplex.com/VrS7gLthBizDzug

Bug: b/240429929
Test: Deployed to test device and verified change, updated test and ran  cq
Change-Id: I6cbc0ad5907edf5b69c5955c9f37350c43cc6379
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3787412
Commit-Queue: Theo Johnson-kanu <tjohnsonkanu@google.com>
Reviewed-by: Chad Duffin <chadduffin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1029529}
This commit is contained in:
Theo Johnson-Kanu
2022-07-29 00:05:30 +00:00
committed by Chromium LUCI CQ
parent 510817425a
commit 0804b7ff39
2 changed files with 5 additions and 2 deletions

View File

@ -426,7 +426,8 @@ void NetworkListViewControllerImpl::UpdateMobileToggleAndSetStatusMessage() {
if (cellular_state == DeviceStateType::kUninitialized) {
CreateInfoLabelIfMissingAndUpdate(IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR,
&mobile_status_message_);
mobile_header_view_->SetToggleVisibility(/*visible=*/false);
mobile_header_view_->SetToggleState(/*enabled=*/false,
/*is_on=*/false);
return;
}

View File

@ -902,7 +902,9 @@ TEST_F(NetworkListViewControllerTest,
base::RunLoop().RunUntilIdle();
EXPECT_NE(nullptr, GetMobileStatusMessage());
EXPECT_FALSE(GetMobileToggleButton()->GetVisible());
EXPECT_TRUE(GetMobileToggleButton()->GetVisible());
EXPECT_FALSE(GetMobileSubHeader()->is_toggle_enabled());
EXPECT_FALSE(GetMobileSubHeader()->is_toggle_on());
EXPECT_EQ(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_INITIALIZING_CELLULAR),
GetMobileStatusMessage()->label()->GetText());