Temporarily disable durable storage browser test
[chromium-blink-merge.git] / google_apis / test / embedded_setup_chromeos.html
blob082c9ecc15d252d99450cba15c776c652c48e6f4
1 <html>
2 <head>
3 <script>
4 var gaia = gaia || {};
5 gaia.chromeOSLogin = {};
7 gaia.chromeOSLogin.parent_webview_signin_url_ = 'chrome://chrome-signin';
8 gaia.chromeOSLogin.parent_webview_oob_url_ = 'chrome://oobe';
9 gaia.chromeOSLogin.parent_webview_ = undefined;
10 gaia.chromeOSLogin.parent_webview_url_ = undefined;
12 gaia.chromeOSLogin.registerHtml5Listener = function() {
13 var onMessage = function(e) {
14 if (e.origin == gaia.chromeOSLogin.parent_webview_signin_url_ ||
15 e.origin == gaia.chromeOSLogin.parent_webview_oob_url_) {
16 gaia.chromeOSLogin.parent_webview_ = e.source;
17 gaia.chromeOSLogin.parent_webview_url_ = e.origin;
19 // Repeat clearOldAttempts as soon as we got parent.
20 gaia.chromeOSLogin.clearOldAttempts();
23 window.addEventListener('message', onMessage);
24 window.addEventListener("popstate", function(e) { goBack(); });
27 gaia.chromeOSLogin.clearOldAttempts = function() {
28 var msg = {
29 'method': 'clearOldAttempts'
31 gaia.chromeOSLogin.parent_webview_.postMessage(msg,
32 gaia.chromeOSLogin.parent_webview_url_);
35 gaia.chromeOSLogin.attemptLogin = function(email, password) {
36 var msg = {
37 'method': 'attemptLogin',
38 'email': email,
39 'password': password,
41 gaia.chromeOSLogin.parent_webview_.postMessage(msg,
42 gaia.chromeOSLogin.parent_webview_url_);
45 gaia.chromeOSLogin.backButton = function(show) {
46 var msg = {
47 'method': 'backButton',
48 'show': show,
50 gaia.chromeOSLogin.parent_webview_.postMessage(msg,
51 gaia.chromeOSLogin.parent_webview_url_);
54 function goFirstPage() {
55 document.getElementById('page1').hidden = false;
56 document.getElementById('page2').hidden = true;
57 history.replaceState({}, '', window.location.pathname + '#identifier');
58 gaia.chromeOSLogin.backButton(false);
61 function goBack() {
62 if (!document.getElementById('page2').hidden) {
63 goFirstPage();
67 function goNext() {
68 if (!document.getElementById("page1").hidden) {
69 document.getElementById("page1").hidden = true;
70 document.getElementById("page2").hidden = false;
71 history.pushState({}, "", window.location.pathname + "#challengepassword");
73 request = new XMLHttpRequest();
74 request.open('POST', '/_/embedded/lookup/accountlookup', true);
75 request.onreadystatechange = function() {
76 if (request.readyState == 4 && request.status == 200) {
77 if (request.getResponseHeader("continue"))
78 location.assign(request.getResponseHeader("continue"));
81 var email = document.getElementById("identifier").value;
82 request.send('identifier=' + encodeURIComponent(email));
84 gaia.chromeOSLogin.attemptLogin(email, "");
85 gaia.chromeOSLogin.backButton(true);
86 } else if (!document.getElementById("page2").hidden) {
87 var email = document.getElementById("identifier").value;
88 var password = document.getElementById("password").value;
90 request = new XMLHttpRequest();
91 request.open('POST', '/_/embedded/signin/challenge', true);
92 request.onreadystatechange = function() {
93 if (request.readyState == 4 && request.status == 200) {
94 history.pushState({}, "", window.location.pathname + "#close");
97 request.send('identifier=' + encodeURIComponent(email));
99 gaia.chromeOSLogin.attemptLogin(email, password);
103 function onLoad() {
104 gaia.chromeOSLogin.registerHtml5Listener();
105 goFirstPage();
106 gaia.chromeOSLogin.clearOldAttempts();
109 </script>
110 </head>
111 <body onload='onLoad();'>
112 Local Auth Server:<br>
113 <div id="page1" hidden>
114 Email
115 <input id="identifier" name="identifier" type="email" spellcheck="false" autocomplete="off" formnovalidate="">
116 </div>
117 <div id="page2" hidden>
118 Password
119 <input id="password" name="password" type="password" spellcheck="false" autocomplete="off" formnovalidate="">
120 </div><br>
121 <div id='nextButton' onclick='goNext();'>Next</div>
122 </body>
123 </html>