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

Side by Side Diff: tools/telemetry/telemetry/internal/backends/chrome/oobe.py

Issue 1370913002: ChromeOS: fix user signin by alias. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment added. Created 5 years, 2 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from functools import partial 5 from functools import partial
6 import logging 6 import logging
7 7
8 from telemetry.core import exceptions 8 from telemetry.core import exceptions
9 from telemetry.core import util 9 from telemetry.core import util
10 from telemetry.internal.browser import web_contents 10 from telemetry.internal.browser import web_contents
(...skipping 30 matching lines...) Expand all
41 if self.EvaluateJavaScript("typeof %s == 'undefined'" % api): 41 if self.EvaluateJavaScript("typeof %s == 'undefined'" % api):
42 raise exceptions.LoginException('%s js api missing' % api) 42 raise exceptions.LoginException('%s js api missing' % api)
43 43
44 js = api + '(' + ("'%s'," * len(args)).rstrip(',') + ');' 44 js = api + '(' + ("'%s'," * len(args)).rstrip(',') + ');'
45 self.ExecuteJavaScript(js % args) 45 self.ExecuteJavaScript(js % args)
46 46
47 def NavigateGuestLogin(self): 47 def NavigateGuestLogin(self):
48 """Logs in as guest.""" 48 """Logs in as guest."""
49 self._ExecuteOobeApi('Oobe.guestLoginForTesting') 49 self._ExecuteOobeApi('Oobe.guestLoginForTesting')
50 50
51 def NavigateFakeLogin(self, username, password): 51 def NavigateFakeLogin(self, username, password, gaia_id):
52 """Fake user login.""" 52 """Fake user login."""
53 self._ExecuteOobeApi('Oobe.loginForTesting', username, password) 53 self._ExecuteOobeApi('Oobe.loginForTesting', username, password, gaia_id)
54 54
55 def NavigateGaiaLogin(self, username, password, 55 def NavigateGaiaLogin(self, username, password,
56 enterprise_enroll=False, 56 enterprise_enroll=False,
57 for_user_triggered_enrollment=False): 57 for_user_triggered_enrollment=False):
58 """Logs in using the GAIA webview or IFrame, whichever is 58 """Logs in using the GAIA webview or IFrame, whichever is
59 present. |enterprise_enroll| allows for enterprise enrollment. 59 present. |enterprise_enroll| allows for enterprise enrollment.
60 |for_user_triggered_enrollment| should be False for remora enrollment.""" 60 |for_user_triggered_enrollment| should be False for remora enrollment."""
61 self._ExecuteOobeApi('Oobe.skipToLoginForTesting') 61 self._ExecuteOobeApi('Oobe.skipToLoginForTesting')
62 if for_user_triggered_enrollment: 62 if for_user_triggered_enrollment:
63 self._ExecuteOobeApi('Oobe.switchToEnterpriseEnrollmentForTesting') 63 self._ExecuteOobeApi('Oobe.switchToEnterpriseEnrollmentForTesting')
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 gaia_webview_context.EvaluateJavaScript(""" 108 gaia_webview_context.EvaluateJavaScript("""
109 document.getElementById('%s').value='%s'; 109 document.getElementById('%s').value='%s';
110 document.getElementById('%s').click()""" 110 document.getElementById('%s').click()"""
111 % (field, value, nextField)) 111 % (field, value, nextField))
112 112
113 def _WaitForField(self, field_id): 113 def _WaitForField(self, field_id):
114 gaia_webview_context = util.WaitFor(self._GaiaWebviewContext, 5) 114 gaia_webview_context = util.WaitFor(self._GaiaWebviewContext, 5)
115 util.WaitFor(gaia_webview_context.HasReachedQuiescence, 20) 115 util.WaitFor(gaia_webview_context.HasReachedQuiescence, 20)
116 gaia_webview_context.WaitForJavaScriptExpression( 116 gaia_webview_context.WaitForJavaScriptExpression(
117 "document.getElementById('%s') != null" % field_id, 20) 117 "document.getElementById('%s') != null" % field_id, 20)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698