Index: chrome/test/data/register_form.html |
diff --git a/chrome/test/data/register_form.html b/chrome/test/data/register_form.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5793a940b93f4be65ce0957aaed30618838c39e3 |
--- /dev/null |
+++ b/chrome/test/data/register_form.html |
@@ -0,0 +1,81 @@ |
+<!DOCTYPE html> |
+<!-- Test page for Chrome OS register form that is hosted at OEM partner site |
+ and is loaded in chrome://register host page --> |
+<html><head> |
+<title>Registration test form</title> |
+<style> |
+ |
+#main { |
+ position: absolute; |
+ left: 0; |
+ right: 0; |
+ top: 0; |
+ bottom: 0; |
+ padding: 10px; |
+ overflow: hidden; |
+ background: -webkit-gradient(linear, left top, left bottom, from(#FAFBFB), to(#CCD1D4)); |
+} |
+</style> |
+<script> |
+document.addEventListener('DOMContentLoaded', load); |
+var hostUrl = 'chrome://register'; |
+ |
+window.addEventListener('message', processMessage); |
+ |
+function $(o) { |
+ return document.getElementById(o); |
+} |
+ |
+function load() { |
+ var msg = { |
+ type: 'get_user_info', |
+ domain: location.href, |
+ payload: {} |
+ }; |
+ window.parent.postMessage(msg, hostUrl); |
+ $('url').textContent = location.href; |
+} |
+ |
+function processMessage(e) { |
+ // TODO(nkostylev): e.origin is passed as null and not checked. |
+ // Probably because it's served from chrome:// scheme. |
+ if (e.data.domain != hostUrl) |
+ return; |
+ |
+ if (e.data.type == 'set_user_info') { |
+ // TODO(nkostylev): Extract all available system/user info. |
+ // http://crosbug.com/4813 |
+ var info = e.data.payload; |
+ $('info').textContent = 'OS: ' + info.os_name + ', ' + |
+ info.os_version + ' SKU:' + info.system_sku; |
+ } |
+ |
+ $('messageInfo').textContent = 'e.origin: ' + e.origin + |
+ ', e.data.domain: ' + e.data.domain; |
+} |
+ |
+function registration(result) { |
+ var msg = { |
+ type: 'complete_registration', |
+ domain: location.href, |
+ payload: { |
+ registration_status: result |
+ } |
+ }; |
+ var parent = window.parent; |
+ parent.postMessage(msg, hostUrl); |
+} |
+</script> |
+</head> |
+<body> |
+<div id="main"> |
+ <h3>Register your computer with Google</h3> |
+ <i>This registration form is hosted at </i><div id="url"></div><br> |
+ <i>User info received from host page:</i><br> |
+ <div id="info"></div><br> |
+ <i>Message info:</i><br> |
+ <div id="messageInfo"></div><br> |
+ <input type="button" value="Skip" onclick="registration(false);"> |
+ <input type="button" value="Register" onclick="registration(true);"> |
+</div> |
+</body></html> |