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({ ...@@ -48,8 +48,6 @@ Polymer({
const networkConfig = network_config.MojoInterfaceProviderImpl.getInstance() const networkConfig = network_config.MojoInterfaceProviderImpl.getInstance()
.getMojoServiceRemote(); .getMojoServiceRemote();
networkConfig.getNetworkState(guid).then(response => { networkConfig.getNetworkState(guid).then(response => {
// TODO(crbug.com/1093185): Add check for specifically eSIM when
// cellular has an EID property.
if (response.result.type !== if (response.result.type !==
chromeos.networkConfig.mojom.NetworkType.kCellular) { chromeos.networkConfig.mojom.NetworkType.kCellular) {
return; return;
...@@ -67,7 +65,8 @@ Polymer({ ...@@ -67,7 +65,8 @@ Polymer({
setESimIccid_(networkConfig, guid) { setESimIccid_(networkConfig, guid) {
networkConfig.getManagedProperties(guid).then(response => { networkConfig.getManagedProperties(guid).then(response => {
const managedProperty = response.result; const managedProperty = response.result;
if (managedProperty.typeProperties.cellular.iccid) { if (managedProperty.typeProperties.cellular.iccid &&
managedProperty.typeProperties.cellular.eid) {
this.iccid_ = managedProperty.typeProperties.cellular.iccid; this.iccid_ = managedProperty.typeProperties.cellular.iccid;
} }
}); });
......
...@@ -28,12 +28,7 @@ suite('InternetDetailMenu', function() { ...@@ -28,12 +28,7 @@ suite('InternetDetailMenu', function() {
mojoApi_.resetForTest(); mojoApi_.resetForTest();
mojom = chromeos.networkConfig.mojom; mojom = chromeos.networkConfig.mojom;
mojoApi_.resetForTest();
mojoApi_.setNetworkTypeEnabledState(mojom.NetworkType.kCellular, true); 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) { function getManagedProperties(type, name) {
...@@ -56,6 +51,15 @@ suite('InternetDetailMenu', function() { ...@@ -56,6 +51,15 @@ suite('InternetDetailMenu', function() {
await flushAsync(); 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() { function flushAsync() {
Polymer.dom.flush(); Polymer.dom.flush();
// Use setTimeout to wait for the next macrotask. // Use setTimeout to wait for the next macrotask.
...@@ -63,20 +67,32 @@ suite('InternetDetailMenu', function() { ...@@ -63,20 +67,32 @@ suite('InternetDetailMenu', function() {
} }
test('Do not show tripple dot when no iccid is present', async function() { test('Do not show tripple dot when no iccid is present', async function() {
const cellular = addEsimCellularNetwork(null, '11111111111111111111111111111111');
getManagedProperties(mojom.NetworkType.kCellular, 'cellular');
cellular.typeProperties.cellular.iccid = null;
mojoApi_.setManagedPropertiesForTest(cellular);
init(); init();
await flushAsync();
let trippleDot = internetDetailMenu.$$('#moreNetworkDetail'); let trippleDot = internetDetailMenu.$$('#moreNetworkDetail');
assertFalse(!!trippleDot); assertFalse(!!trippleDot);
addEsimCellularNetwork('100000', '11111111111111111111111111111111');
cellular.typeProperties.cellular.iccid = '100000'; const params = new URLSearchParams;
mojoApi_.setManagedPropertiesForTest(cellular); 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; const params = new URLSearchParams;
params.append('guid', 'cellular_guid'); params.append('guid', 'cellular_guid');
...@@ -89,7 +105,14 @@ suite('InternetDetailMenu', function() { ...@@ -89,7 +105,14 @@ suite('InternetDetailMenu', function() {
}); });
test('Rename menu click', async function() { test('Rename menu click', async function() {
addEsimCellularNetwork('100000', '11111111111111111111111111111111');
init(); init();
const params = new URLSearchParams;
params.append('guid', 'cellular_guid');
settings.Router.getInstance().navigateTo(
settings.routes.NETWORK_DETAIL, params);
await flushAsync(); await flushAsync();
const trippleDot = internetDetailMenu.$$('#moreNetworkDetail'); const trippleDot = internetDetailMenu.$$('#moreNetworkDetail');
assertTrue(!!trippleDot); assertTrue(!!trippleDot);
...@@ -109,7 +132,14 @@ suite('InternetDetailMenu', function() { ...@@ -109,7 +132,14 @@ suite('InternetDetailMenu', function() {
}); });
test('Remove menu button click', async function() { test('Remove menu button click', async function() {
addEsimCellularNetwork('100000', '11111111111111111111111111111111');
init(); init();
const params = new URLSearchParams;
params.append('guid', 'cellular_guid');
settings.Router.getInstance().navigateTo(
settings.routes.NETWORK_DETAIL, params);
await flushAsync(); await flushAsync();
const trippleDot = internetDetailMenu.$$('#moreNetworkDetail'); const trippleDot = internetDetailMenu.$$('#moreNetworkDetail');
assertTrue(!!trippleDot); 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