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