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

Unified Diff: chrome/browser/resources/gaia_auth/test/content.js

Issue 10443024: Added chrome switch that lets tests override URL path, moved GAIA auth extension from CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/gaia_auth/test/content.js
diff --git a/chrome/browser/resources/gaia_auth/test/content.js b/chrome/browser/resources/gaia_auth/test/content.js
new file mode 100644
index 0000000000000000000000000000000000000000..4df1a11a61c44e222b95c07947490671b1677295
--- /dev/null
+++ b/chrome/browser/resources/gaia_auth/test/content.js
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+console.log('Test script injected!');
+
+function getQueryParam(key, defaultVal) {
+ if (!defaultVal) defaultVal = '';
+ key = key.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');
+ var regex = new RegExp('[\\?&]' + key + '=([^&#]*)');
+ var qs = regex.exec(window.location.href);
+ if (qs == null)
+ return defaultVal;
+ else
+ return qs[1];
+}
+
+if (document.URL.match(/https\:\/\/www\.google\.com\/accounts\/ServiceLogin/) ||
+ document.URL.match(/https\:\/\/accounts\.google\.com\/ServiceLogin/) ||
+ document.URL.match(
+ /https\:\/\/gaiastaging\.corp\.google\.com\/ServiceLogin/) ||
+ document.URL.match(/https\:\/\/insecure\.com\/accounts\/ServiceLogin/)) {
+ var testEmail = unescape(getQueryParam('test_email'));
+ var testPassword = unescape(getQueryParam('test_pwd'));
+ console.log('Got test account info: ' + testEmail + '/' + testPassword);
+ document.getElementById('Email').value = testEmail;
+ document.getElementById('Passwd').value = testPassword;
+ console.log('Form field changed!');
+ if (testEmail != '') {
+ document.getElementById('signIn').click();
+ console.log('Form submitted!');
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698