gaia_login_test.html revision c407dc5cd9bdc5668497f21b26b09d988ab439de
1<!DOCTYPE html> 2<html> 3<!-- 4This page is a simple testing environment for gaia_login.html to help 5iterate on the design without having to compile and launch the 6browser. Note that you must supply the "--allow-file-access-from-files" 7for the chrome you are using to load this page for this to work. 8--> 9<style> 10body { 11 background-color: #d0d0d0; 12} 13 14#iframe { 15 height: 375px; 16 width: 421px; 17 border: 0px; 18 float: left; 19} 20#options { 21 float: left; 22} 23 24</style> 25<script> 26function gel(id) { 27 return document.getElementById(id); 28} 29 30function get_selected_value(el) { 31 for (var i = 0; i < el.length; ++i) { 32 if (el[i].checked) 33 return el[i].value; 34 } 35 return null; 36} 37 38function set_up_testing() { 39 var win = window.frames[0]; 40 var doc = win.document; 41 var form = gel("form"); 42 form.addEventListener("change", function() { update(); }, true); 43 44 win.JSON = {}; 45 win.JSON.parse = function() { 46 return { 47 error: get_selected_value(form.error), 48 user: "homer@gmail.com", 49 captchaUrl: "https://www.google.com/accounts/Captcha" 50 }; 51 }; 52 53 console.log(win.JSON.parse()); 54 55 set_text("introduction", 56 "Chromium sync makes it easy to share your data (such as " + 57 "bookmarks and preferences) between your computers. Chromium " + 58 "synchronizes your data by storing it online with Google when " + 59 "you login with your Google Account."); 60 set_text("settingupsync", "Setting up sync"); 61 set_text("errorsigningin", "Error signing in."); 62 set_text("signinsuffix", "Account"); 63 set_text("emaillabel", "Email:"); 64 set_text("cannotbeblank", "cannotbeblank"); 65 set_text("passwordlabel", "Password:"); 66 set_text("invalidcredentials", "Invalid user name or password."); 67 set_text("captchainstructions", 68 "Enter the correct password above and then type the characters " + 69 "you see in the picture below."); 70 set_text("couldnotconnect", "Could not connect to the server"); 71 set_text("value:signin", "Sign in"); 72 set_text("href:cannotaccessaccounturl", "href:cannotaccessaccounturl"); 73 set_text("cannotaccessaccount", "I cannot access my account"); 74 set_text("href:createnewaccounturl", "href:createnewaccounturl"); 75 set_text("createaccount", "Create a Google account"); 76 set_text("value:cancel", "Cancel"); 77 78 function set_text(id, text) { 79 if (id.indexOf(":") >= 0) { 80 var node = doc.evaluate("//*[@i18n-values='" + id + "']", 81 doc, 82 null, 83 XPathResult.FIRST_ORDERED_NODE_TYPE, 84 null).singleNodeValue; 85 node.setAttribute(id.split(":")[0], text); 86 } else { 87 var node = doc.evaluate("//*[@i18n-content='" + id + "']", 88 doc, 89 null, 90 XPathResult.FIRST_ORDERED_NODE_TYPE, 91 null).singleNodeValue; 92 node.innerHTML = text; 93 } 94 } 95 96 win.initForm(); 97} 98 99function update() { 100 window.frames[0].document.location.reload(); 101} 102 103</script> 104<body> 105<div> 106<iframe 107 id="iframe" 108 src="gaia_login.html" 109 onload="set_up_testing()"> 110</iframe> 111<div id="options"> 112<form id="form" name="form"> 113<p> 114 <input type="radio" name="error" value="" checked> No Error 115 <input type="radio" name="error" value="1"> Bad Password 116 <input type="radio" name="error" value="3"> Lost Connection 117 <input type="radio" name="error" value="4"> Captcha 118</p> 119</form> 120</div> 121</div> 122</body> 123</html> 124