blob: 9e11ee46a358f494e2f1b7051b013a892d7ce328 [file] [log] [blame]
ulan38fc6e62015-07-23 15:27:371# Copyright 2015 The Chromium 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
5from page_sets.login_helpers import google_login
6
7from telemetry.page import page as page_module
8from telemetry.page import shared_page_state
9
10import os
11
12def _DeterministicPerformanceCounters():
13 with open(os.path.join(os.path.dirname(__file__),
14 'deterministic_performance_counters.js')) as f:
15 return f.read()
16
17class GooglePages(page_module.Page):
18 def __init__(self, url, page_set, shared_page_state_class,
19 name='', credentials=None):
20 super(GooglePages, self).__init__(
21 url=url, page_set=page_set, name=name,
22 credentials_path='data/credentials.json',
23 shared_page_state_class=shared_page_state_class)
ulan38fc6e62015-07-23 15:27:3724 self.credentials = credentials
25 self.script_to_evaluate_on_commit = _DeterministicPerformanceCounters()
26
27
28class GmailPage(GooglePages):
29 def __init__(self, page_set,
30 shared_page_state_class=shared_page_state.SharedPageState):
31 super(GmailPage, self).__init__(
32 url='https://mail.google.com/mail/',
33 page_set=page_set,
ashleymariebd6683a2017-06-05 20:44:2034 shared_page_state_class=shared_page_state_class,
35 name='https://mail.google.com/mail/')
ulan38fc6e62015-07-23 15:27:3736
37 def RunNavigateSteps(self, action_runner):
38 google_login.LoginGoogleAccount(action_runner, 'google',
39 self.credentials_path)
40 super(GmailPage, self).RunNavigateSteps(action_runner)
perezjud42421be2017-02-28 09:40:2041 action_runner.WaitForJavaScriptCondition(
ulan38fc6e62015-07-23 15:27:3742 'window.gmonkey !== undefined &&'
43 'document.getElementById("gb") !== null')