Commit 4c6c1dc5 authored by Nnamdi Theodore Johnson-Kanu's avatar Nnamdi Theodore Johnson-Kanu Committed by Commit Bot

[CrOS cellular] Add forward and back functionality to psim flow

Bug: 1093185
Change-Id: I47bbd1dc115751de7061ed89bf771a042800a273
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2412554
Commit-Queue: Nnamdi Theodore Johnson-kanu <tjohnsonkanu@google.com>
Reviewed-by: default avatarAzeem Arshad <azeemarshad@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808043}
parent 9f78dd45
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
// #import 'chrome://os-settings/strings.m.js'; // #import 'chrome://os-settings/strings.m.js';
// #import 'chrome://resources/cr_components/chromeos/cellular_setup/psim_flow_ui.m.js'; // #import 'chrome://resources/cr_components/chromeos/cellular_setup/psim_flow_ui.m.js';
// #import {PSimUIState} from 'chrome://resources/cr_components/chromeos/cellular_setup/psim_flow_ui.m.js';
// #import {flush, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // #import {flush, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {assertTrue} from '../../../chai_assert.js'; // #import {assertTrue} from '../../../chai_assert.js';
// clang-format on // clang-format on
...@@ -22,4 +23,13 @@ suite('CrComponentsPsimFlowUiTest', function() { ...@@ -22,4 +23,13 @@ suite('CrComponentsPsimFlowUiTest', function() {
const ironPage = pSimPage.$$('iron-pages'); const ironPage = pSimPage.$$('iron-pages');
assertTrue(!!ironPage); assertTrue(!!ironPage);
}); });
test('forward navigation test', function() {
pSimPage.state_ = cellularSetup.PSimUIState.WAITING_FOR_PORTAL_TO_LOAD;
Polymer.dom.flush();
pSimPage.navigateForward();
assertTrue(
pSimPage.state_ ===
cellularSetup.PSimUIState.WAITING_FOR_ACTIVATION_TO_FINISH);
});
}); });
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
test_namespace_rewrites = [ test_namespace_rewrites = [
"cellularSetup.PSimUIState|PSimUIState",
"global.traceAssertionsForTesting|window.traceAssertionsForTesting", "global.traceAssertionsForTesting|window.traceAssertionsForTesting",
"MockInteractions.blur|blur", "MockInteractions.blur|blur",
"MockInteractions.downAndUp|downAndUp", "MockInteractions.downAndUp|downAndUp",
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
cr.define('cellularSetup', function() { cr.define('cellularSetup', function() {
/** @enum{string} */ /** @enum{string} */
const PSimPageName = { /* #export */ const PSimPageName = {
SIM_DETECT: 'sim-detect-page', SIM_DETECT: 'sim-detect-page',
PROVISIONING: 'provisioning-page', PROVISIONING: 'provisioning-page',
FINAL: 'final-page', FINAL: 'final-page',
}; };
/** @enum{string} */ /** @enum{string} */
const PSimUIState = { /* #export */ const PSimUIState = {
IDLE: 'idle', IDLE: 'idle',
STARTING_ACTIVATION: 'starting-activation', STARTING_ACTIVATION: 'starting-activation',
WAITING_FOR_ACTIVATION_TO_START: 'waiting-for-activation-to-start', WAITING_FOR_ACTIVATION_TO_START: 'waiting-for-activation-to-start',
...@@ -184,6 +184,21 @@ cr.define('cellularSetup', function() { ...@@ -184,6 +184,21 @@ cr.define('cellularSetup', function() {
this.updateButtonBarState_(); this.updateButtonBarState_();
}, },
navigateForward() {
// Navigate forward is only called by clicking next button
// from the provisioning page.
assert(this.selectedPSimPageName_ === PSimPageName.PROVISIONING);
this.state_ = PSimUIState.WAITING_FOR_ACTIVATION_TO_FINISH;
},
/**
* @returns {boolean} true if backward navigation was handled
*/
attemptBackwardNavigation() {
// Back navigation for pSIM flow always goes back to selection page
return false;
},
/** @private */ /** @private */
updateButtonBarState_() { updateButtonBarState_() {
let buttonState; let buttonState;
......
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