Skip to content

Commit

Permalink
[CrOS Settings] Fix 'Activate' button showing for activated networks.
Browse files Browse the repository at this point in the history
Add check for activation status when setting isPSimUnactivatedNetwork_
in network-list-item. Previously, there was no check, causing any
network with a paymentPortal url to display an 'Activate' button.

(cherry picked from commit 9d00287)

Bug: 1196507
Change-Id: Id90933d91aa8dcf4bad905c371a99c98f1a4ce19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2822789
Commit-Queue: Gordon Seto <gordonseto@google.com>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#871714}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2826772
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Gordon Seto <gordonseto@google.com>
Cr-Commit-Position: refs/branch-heads/4472@{#86}
Cr-Branched-From: 3d60439-refs/heads/master@{#870763}
  • Loading branch information
Gordon Seto authored and Chromium LUCI CQ committed Apr 15, 2021
1 parent 108469d commit 70af380
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ suite('NetworkListItemTest', function() {
mojom.NetworkType.kCellular, 'cellular');
managedPropertiesActivated.typeProperties.cellular.activationState =
mojom.ActivationStateType.kActivated;
managedPropertiesActivated.typeProperties.cellular.paymentPortal = {
url: 'url'
};
mojoApi_.setManagedPropertiesForTest(managedPropertiesActivated);

listItem.item =
Expand All @@ -142,6 +145,25 @@ suite('NetworkListItemTest', function() {
// Activate button should not be showing.
assertFalse(!!listItem.$$('#activateButton'));

// Set item to an unactivated eSIM network with a payment URL.
const managedPropertiesESimNotActivated =
OncMojo.getDefaultManagedProperties(
mojom.NetworkType.kCellular, 'cellular');
managedPropertiesESimNotActivated.typeProperties.cellular.eid = 'eid';
managedPropertiesESimNotActivated.typeProperties.cellular.activationState =
mojom.ActivationStateType.kNotActivated;
managedPropertiesESimNotActivated.typeProperties.cellular.paymentPortal = {
url: 'url'
};
mojoApi_.setManagedPropertiesForTest(managedPropertiesESimNotActivated);

listItem.item = OncMojo.managedPropertiesToNetworkState(
managedPropertiesESimNotActivated);
await flushAsync();

// Activate button should not be showing.
assertFalse(!!listItem.$$('#activateButton'));

// Set item to an unactivated pSIM network with a payment URL.
const managedPropertiesNotActivated = OncMojo.getDefaultManagedProperties(
mojom.NetworkType.kCellular, 'cellular');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,19 @@ Polymer({
if (!this.isUpdatedCellularUiEnabled_) {
return false;
}
if (!managedProperties || !managedProperties.typeProperties.cellular) {
if (!managedProperties) {
return false;
}
const paymentPortal =
managedProperties.typeProperties.cellular.paymentPortal;
if (paymentPortal && paymentPortal.url) {
const cellularProperties = managedProperties.typeProperties.cellular;
if (!cellularProperties || cellularProperties.eid) {
return false;
}
if (cellularProperties.activationState !==
chromeos.networkConfig.mojom.ActivationStateType.kNotActivated) {
return false;
}
if (cellularProperties.paymentPortal &&
cellularProperties.paymentPortal.url) {
return true;
}
return false;
Expand Down

0 comments on commit 70af380

Please sign in to comment.