Commit 6a965f39 authored by Azeem Arshad's avatar Azeem Arshad Committed by Commit Bot

[CrOS Cellular] Fix roaming toggle subtext not updating.

This issue was caused because allow roaming is a device level
property in Shill but it's represented at network level in ONC.
Fixed this by adding a request for network properties after
device state is updated. Also added a test case to cover this.

Fixed: 1123143
Change-Id: Icf7babb11a4e27cd22b081bdc9abc19036f60666
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389230
Commit-Queue: Azeem Arshad <azeemarshad@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804037}
parent 7fa67e3f
......@@ -607,9 +607,7 @@ Polymer({
shouldGetNetworkDetails =
this.deviceState_.deviceState != newDeviceState.deviceState;
this.deviceState_ = newDeviceState;
} else if (
this.deviceState_ &&
this.deviceState_.scanning != newDeviceState.scanning) {
} else if (this.deviceState_.scanning != newDeviceState.scanning) {
// Update just the scanning state to avoid interrupting other parts of
// the UI (e.g. custom IP addresses or nameservers).
this.deviceState_.scanning = newDeviceState.scanning;
......@@ -618,6 +616,12 @@ Polymer({
if (type === mojom.NetworkType.kCellular) {
shouldGetNetworkDetails = true;
}
} else if (type === mojom.NetworkType.kCellular) {
// If there are no device state property changes but type is
// cellular, then always fetch network details. This is because
// for cellular networks, some shill device level properties are
// represented at network level in ONC.
shouldGetNetworkDetails = true;
}
if (shouldGetNetworkDetails) {
this.getNetworkDetails_();
......
......@@ -326,6 +326,32 @@ suite('InternetDetailPage', function() {
});
});
test('Cellular roaming subtext', async function() {
const mojom = chromeos.networkConfig.mojom;
mojoApi_.setNetworkTypeEnabledState(mojom.NetworkType.kCellular, true);
mojoApi_.setManagedPropertiesForTest(
getManagedProperties(mojom.NetworkType.kCellular, 'cellular'));
internetDetailPage.init('cellular_guid', 'Cellular', 'cellular');
await flushAsync();
const roamingToggle = internetDetailPage.$$('#allowDataRoaming');
assertTrue(!!roamingToggle);
assertEquals(
internetDetailPage.i18n('networkAllowDataRoamingDisabled'),
roamingToggle.subLabel);
const cellularNetwork =
getManagedProperties(mojom.NetworkType.kCellular, 'cellular');
cellularNetwork.typeProperties.cellular.allowRoaming = true;
mojoApi_.setManagedPropertiesForTest(cellularNetwork);
// Notify device state list change since allow roaming is
// device level property in shill.
internetDetailPage.onDeviceStateListChanged();
await flushAsync();
assertEquals(
internetDetailPage.i18n('networkAllowDataRoamingEnabledHome'),
roamingToggle.subLabel);
});
test('Deep link to disconnect button', async () => {
const mojom = chromeos.networkConfig.mojom;
mojoApi_.setNetworkTypeEnabledState(mojom.NetworkType.kCellular, true);
......
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