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

Side by Side Diff: tools/perf/page_sets/login_helpers/chrome_login.py

Issue 2719853003: [Telemetry refactor] Drop "2" from method calls to JS API (Closed)
Patch Set: Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 page_sets.login_helpers import login_utils 5 from page_sets.login_helpers import login_utils
6 from telemetry.core import util 6 from telemetry.core import util
7 from telemetry.page import action_runner as action_runner_module 7 from telemetry.page import action_runner as action_runner_module
8 8
9 9
10 def GetGaiaContext(tab): 10 def GetGaiaContext(tab):
(...skipping 26 matching lines...) Expand all
37 37
38 action_runner.Navigate('chrome://chrome-signin') 38 action_runner.Navigate('chrome://chrome-signin')
39 39
40 # Get the Gaia webview context within the sign in extension to create a Gaia 40 # Get the Gaia webview context within the sign in extension to create a Gaia
41 # action_runner. The action runner will then execute JS in the Gaia context. 41 # action_runner. The action runner will then execute JS in the Gaia context.
42 gaia_context = util.WaitFor(lambda: GetGaiaContext(action_runner.tab), 5) 42 gaia_context = util.WaitFor(lambda: GetGaiaContext(action_runner.tab), 5)
43 if not gaia_context: 43 if not gaia_context:
44 raise RuntimeError('Can not find GAIA webview context for sign in.') 44 raise RuntimeError('Can not find GAIA webview context for sign in.')
45 gaia_action_runner = action_runner_module.ActionRunner(gaia_context) 45 gaia_action_runner = action_runner_module.ActionRunner(gaia_context)
46 46
47 new_flow = gaia_action_runner.EvaluateJavaScript2( 47 new_flow = gaia_action_runner.EvaluateJavaScript(
48 'document.querySelector("#gaia_firsform") != null') 48 'document.querySelector("#gaia_firsform") != null')
49 gaia_form_id = 'gaia_firstform' if new_flow else 'gaia_loginform' 49 gaia_form_id = 'gaia_firstform' if new_flow else 'gaia_loginform'
50 login_utils.InputForm(gaia_action_runner, account_name, input_id='Email', 50 login_utils.InputForm(gaia_action_runner, account_name, input_id='Email',
51 form_id=gaia_form_id) 51 form_id=gaia_form_id)
52 if new_flow: 52 if new_flow:
53 gaia_action_runner.ClickElement(selector='#%s #next' % gaia_form_id) 53 gaia_action_runner.ClickElement(selector='#%s #next' % gaia_form_id)
54 login_utils.InputForm(gaia_action_runner, password, input_id='Passwd', 54 login_utils.InputForm(gaia_action_runner, password, input_id='Passwd',
55 form_id=gaia_form_id) 55 form_id=gaia_form_id)
56 gaia_action_runner.ClickElement(selector='#signIn') 56 gaia_action_runner.ClickElement(selector='#signIn')
57 action_runner.WaitForNavigate() 57 action_runner.WaitForNavigate()
OLDNEW
« no previous file with comments | « tools/perf/page_sets/key_silk_cases.py ('k') | tools/perf/page_sets/login_helpers/dropbox_login.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698