OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 console.log('Test script injected!'); |
| 6 |
| 7 function getQueryParam(key, defaultVal) { |
| 8 if (!defaultVal) defaultVal = ''; |
| 9 key = key.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]'); |
| 10 var regex = new RegExp('[\\?&]' + key + '=([^&#]*)'); |
| 11 var qs = regex.exec(window.location.href); |
| 12 if (qs == null) |
| 13 return defaultVal; |
| 14 else |
| 15 return qs[1]; |
| 16 } |
| 17 |
| 18 if (document.URL.match(/https\:\/\/www\.google\.com\/accounts\/ServiceLogin/) || |
| 19 document.URL.match(/https\:\/\/accounts\.google\.com\/ServiceLogin/) || |
| 20 document.URL.match( |
| 21 /https\:\/\/gaiastaging\.corp\.google\.com\/ServiceLogin/) || |
| 22 document.URL.match(/https\:\/\/insecure\.com\/accounts\/ServiceLogin/)) { |
| 23 var testEmail = unescape(getQueryParam('test_email')); |
| 24 var testPassword = unescape(getQueryParam('test_pwd')); |
| 25 console.log('Got test account info: ' + testEmail + '/' + testPassword); |
| 26 document.getElementById('Email').value = testEmail; |
| 27 document.getElementById('Passwd').value = testPassword; |
| 28 console.log('Form field changed!'); |
| 29 if (testEmail != '') { |
| 30 document.getElementById('signIn').click(); |
| 31 console.log('Form submitted!'); |
| 32 } |
| 33 } |
OLD | NEW |