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

Side by Side Diff: google_apis/test/embedded_setup_chromeos.html

Issue 1054403002: Basic tests for new webview based signin flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove flaky back-button check 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 unified diff | Download patch
« no previous file with comments | « google_apis/gaia/fake_gaia.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script>
4 var gaia = gaia || {};
5 gaia.chromeOSLogin = {};
6
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;
11
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;
18
19 // Repeat clearOldAttempts as soon as we got parent.
20 gaia.chromeOSLogin.clearOldAttempts();
21 }
22 };
23 window.addEventListener('message', onMessage);
24 }
25
26 gaia.chromeOSLogin.clearOldAttempts = function() {
27 var msg = {
28 'method': 'clearOldAttempts'
29 };
30 gaia.chromeOSLogin.parent_webview_.postMessage(msg,
31 gaia.chromeOSLogin.parent_webview_url_);
32 };
33
34 gaia.chromeOSLogin.attemptLogin = function(email, password) {
35 var msg = {
36 'method': 'attemptLogin',
37 'email': email,
38 'password': password,
39 };
40 gaia.chromeOSLogin.parent_webview_.postMessage(msg,
41 gaia.chromeOSLogin.parent_webview_url_);
42 };
43
44 gaia.chromeOSLogin.backButton = function(show) {
45 var msg = {
46 'method': 'backButton',
47 'show': show,
48 };
49 gaia.chromeOSLogin.parent_webview_.postMessage(msg,
50 gaia.chromeOSLogin.parent_webview_url_);
51 };
52
53 function goNext() {
54 if (!document.getElementById("page1").hidden) {
55 document.getElementById("page1").hidden = true;
56 document.getElementById("page2").hidden = false;
57 history.pushState({}, "", window.location.pathname + "#challengepassword");
58
59 request = new XMLHttpRequest();
60 request.open('POST', '/_/embedded/lookup/accountlookup', true);
61 request.onreadystatechange = function() {
62 if (request.readyState == 4 && request.status == 200) {
63 if (request.getResponseHeader("continue"))
64 location.assign(request.getResponseHeader("continue"));
65 }
66 };
67 var email = document.getElementById("identifier").value;
68 request.send('identifier=' + encodeURIComponent(email));
69
70 gaia.chromeOSLogin.attemptLogin(email, "");
71 gaia.chromeOSLogin.backButton(true);
72 } else if (!document.getElementById("page2").hidden) {
73 var email = document.getElementById("identifier").value;
74 var password = document.getElementById("password").value;
75
76 request = new XMLHttpRequest();
77 request.open('POST', '/_/embedded/signin/challenge', true);
78 request.onreadystatechange = function() {
79 if (request.readyState == 4 && request.status == 200) {
80 history.pushState({}, "", window.location.pathname + "#close");
81 }
82 };
83 request.send('identifier=' + encodeURIComponent(email));
84
85 gaia.chromeOSLogin.attemptLogin(email, password);
86 }
87 }
88
89 function onLoad() {
90 gaia.chromeOSLogin.registerHtml5Listener();
91 document.getElementById("page1").hidden = false;
92 history.replaceState({}, "", window.location.pathname + "#identifier");
93 gaia.chromeOSLogin.clearOldAttempts();
94 }
95
96 </script>
97 </head>
98 <body onload='onLoad();'>
99 Local Auth Server:<br>
100 <div id="page1" hidden>
101 Email
102 <input id="identifier" name="identifier" type="email" spellcheck="false" aut ocomplete="off" formnovalidate="">
103 </div>
104 <div id="page2" hidden>
105 Password
106 <input id="password" name="password" type="password" spellcheck="false" auto complete="off" formnovalidate="">
107 </div><br>
108 <div id='nextButton' onclick='goNext();'>Next</div>
109 </body>
110 </html>
OLDNEW
« no previous file with comments | « google_apis/gaia/fake_gaia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698