Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: google_apis/test/embedded_setup_chromeos.html

Issue 1057393004: Add unit test for the back button in the new GAIA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/webview_login_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/test/embedded_setup_chromeos.html
diff --git a/google_apis/test/embedded_setup_chromeos.html b/google_apis/test/embedded_setup_chromeos.html
index d2175f00336984473505f1dc0c5ccd946e5ece05..082c9ecc15d252d99450cba15c776c652c48e6f4 100644
--- a/google_apis/test/embedded_setup_chromeos.html
+++ b/google_apis/test/embedded_setup_chromeos.html
@@ -21,6 +21,7 @@ gaia.chromeOSLogin.registerHtml5Listener = function() {
}
};
window.addEventListener('message', onMessage);
+ window.addEventListener("popstate", function(e) { goBack(); });
}
gaia.chromeOSLogin.clearOldAttempts = function() {
@@ -50,6 +51,19 @@ gaia.chromeOSLogin.backButton = function(show) {
gaia.chromeOSLogin.parent_webview_url_);
};
+function goFirstPage() {
+ document.getElementById('page1').hidden = false;
+ document.getElementById('page2').hidden = true;
+ history.replaceState({}, '', window.location.pathname + '#identifier');
+ gaia.chromeOSLogin.backButton(false);
+}
+
+function goBack() {
+ if (!document.getElementById('page2').hidden) {
+ goFirstPage();
+ }
+}
+
function goNext() {
if (!document.getElementById("page1").hidden) {
document.getElementById("page1").hidden = true;
@@ -88,8 +102,7 @@ function goNext() {
function onLoad() {
gaia.chromeOSLogin.registerHtml5Listener();
- document.getElementById("page1").hidden = false;
- history.replaceState({}, "", window.location.pathname + "#identifier");
+ goFirstPage();
gaia.chromeOSLogin.clearOldAttempts();
}
« no previous file with comments | « chrome/browser/chromeos/login/webview_login_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698