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
3# found in the LICENSE file.
4# pylint: disable=W0401,W0614
5
6import os
7
8from page_sets.login_helpers import google_login
9
10from telemetry import story
11from telemetry.page import page as page_module
12from telemetry.page import shared_page_state
13from telemetry.util import wpr_modes
14
15
16class SkiaBuildbotDesktopPage(page_module.Page):
17
18  def __init__(self, url, page_set):
19    super(SkiaBuildbotDesktopPage, self).__init__(
20        url=url,
21        name=url,
22        page_set=page_set,
23        shared_page_state_class=shared_page_state.SharedDesktopPageState)
24    self.archive_data_file = 'data/skia_gmail_desktop.json'
25
26  def RunSmoothness(self, action_runner):
27    action_runner.ScrollElement()
28
29  def RunNavigateSteps(self, action_runner):
30    if self.wpr_mode != wpr_modes.WPR_REPLAY:
31      credentials_path = os.path.join(
32          os.path.dirname(os.path.abspath(__file__)), 'data/credentials.json')
33      google_login.BaseLoginGoogle(action_runner, 'google', credentials_path)
34      action_runner.Wait(10)
35    action_runner.Navigate(self.url)
36    action_runner.Wait(10)
37
38
39class SkiaGmailDesktopPageSet(story.StorySet):
40  """ Pages designed to represent the median, not highly optimized web """
41
42  def __init__(self):
43    super(SkiaGmailDesktopPageSet, self).__init__(
44      archive_data_file='data/skia_gmail_desktop.json')
45
46    urls_list = [
47      # Why: productivity, top google properties, long email .
48      'https://mail.google.com/mail/?shva=1#inbox/13ba91194d0b8a2e',
49    ]
50
51    for url in urls_list:
52      self.AddStory(SkiaBuildbotDesktopPage(url, self))
53