Commit 9e62f60c authored by Theo Johnson-kanu's avatar Theo Johnson-kanu Committed by Chromium LUCI CQ

[CrOS cellular] Add eid check in internet detail menu

Bug: 1093185
Change-Id: Ibf6267c9a41bb0800848980dc203e7c43f1e23fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628039
Commit-Queue: Nnamdi Theodore Johnson-kanu <tjohnsonkanu@google.com>
Reviewed-by: default avatarAzeem Arshad <azeemarshad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843287}
parent b35fb6cf
......@@ -48,8 +48,6 @@ Polymer({
const networkConfig = network_config.MojoInterfaceProviderImpl.getInstance()
.getMojoServiceRemote();
networkConfig.getNetworkState(guid).then(response => {
// TODO(crbug.com/1093185): Add check for specifically eSIM when
// cellular has an EID property.
if (response.result.type !==
chromeos.networkConfig.mojom.NetworkType.kCellular) {
return;
......@@ -67,7 +65,8 @@ Polymer({
setESimIccid_(networkConfig, guid) {
networkConfig.getManagedProperties(guid).then(response => {
const managedProperty = response.result;
if (managedProperty.typeProperties.cellular.iccid) {
if (managedProperty.typeProperties.cellular.iccid &&
managedProperty.typeProperties.cellular.eid) {
this.iccid_ = managedProperty.typeProperties.cellular.iccid;
}
});
......
......@@ -28,12 +28,7 @@ suite('InternetDetailMenu', function() {
mojoApi_.resetForTest();
mojom = chromeos.networkConfig.mojom;
mojoApi_.resetForTest();
mojoApi_.setNetworkTypeEnabledState(mojom.NetworkType.kCellular, true);
const cellular =
getManagedProperties(mojom.NetworkType.kCellular, 'cellular');
cellular.typeProperties.cellular.iccid = '100000000';
mojoApi_.setManagedPropertiesForTest(cellular);
});
function getManagedProperties(type, name) {
......@@ -56,6 +51,15 @@ suite('InternetDetailMenu', function() {
await flushAsync();
}
async function addEsimCellularNetwork(iccid, eid) {
const cellular =
getManagedProperties(mojom.NetworkType.kCellular, 'cellular');
cellular.typeProperties.cellular.iccid = iccid;
cellular.typeProperties.cellular.eid = eid;
mojoApi_.setManagedPropertiesForTest(cellular);
await flushAsync();
}
function flushAsync() {
Polymer.dom.flush();
// Use setTimeout to wait for the next macrotask.
......@@ -63,20 +67,32 @@ suite('InternetDetailMenu', function() {
}
test('Do not show tripple dot when no iccid is present', async function() {
const cellular =
getManagedProperties(mojom.NetworkType.kCellular, 'cellular');
cellular.typeProperties.cellular.iccid = null;
mojoApi_.setManagedPropertiesForTest(cellular);
addEsimCellularNetwork(null, '11111111111111111111111111111111');
init();
await flushAsync();
let trippleDot = internetDetailMenu.$$('#moreNetworkDetail');
assertFalse(!!trippleDot);
addEsimCellularNetwork('100000', '11111111111111111111111111111111');
cellular.typeProperties.cellular.iccid = '100000';
mojoApi_.setManagedPropertiesForTest(cellular);
const params = new URLSearchParams;
params.append('guid', 'cellular_guid');
settings.Router.getInstance().navigateTo(
settings.routes.NETWORK_DETAIL, params);
await flushAsync();
trippleDot = internetDetailMenu.$$('#moreNetworkDetail');
assertTrue(!!trippleDot);
});
test('Do not show tripple dot when no eid is present', async function() {
addEsimCellularNetwork('100000', null);
init();
let trippleDot = internetDetailMenu.$$('#moreNetworkDetail');
assertFalse(!!trippleDot);
addEsimCellularNetwork('100000', '11111111111111111111111111111111');
const params = new URLSearchParams;
params.append('guid', 'cellular_guid');
......@@ -89,7 +105,14 @@ suite('InternetDetailMenu', function() {
});
test('Rename menu click', async function() {
addEsimCellularNetwork('100000', '11111111111111111111111111111111');
init();
const params = new URLSearchParams;
params.append('guid', 'cellular_guid');
settings.Router.getInstance().navigateTo(
settings.routes.NETWORK_DETAIL, params);
await flushAsync();
const trippleDot = internetDetailMenu.$$('#moreNetworkDetail');
assertTrue(!!trippleDot);
......@@ -109,7 +132,14 @@ suite('InternetDetailMenu', function() {
});
test('Remove menu button click', async function() {
addEsimCellularNetwork('100000', '11111111111111111111111111111111');
init();
const params = new URLSearchParams;
params.append('guid', 'cellular_guid');
settings.Router.getInstance().navigateTo(
settings.routes.NETWORK_DETAIL, params);
await flushAsync();
const trippleDot = internetDetailMenu.$$('#moreNetworkDetail');
assertTrue(!!trippleDot);
......
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