1# Copyright 2019 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 linkedin_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 SkiaDesktopPage(page_module.Page):
17
18  def __init__(self, url, page_set):
19    super(SkiaDesktopPage, 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_linkedin_desktop.json'
25
26  def RunNavigateSteps(self, action_runner):
27    if self.wpr_mode != wpr_modes.WPR_REPLAY:
28      credentials_path=os.path.join(os.path.dirname(os.path.abspath(__file__)),
29                                    'data/credentials.json')
30      linkedin_login.LoginDesktopAccount(action_runner, 'linkedin',
31                                         credentials_path)
32      action_runner.Wait(15)
33    action_runner.Navigate(self.url)
34    action_runner.Wait(15)
35
36
37class SkiaLinkedinDesktopPageSet(story.StorySet):
38  """ Pages designed to represent the median, not highly optimized web """
39
40  def __init__(self):
41    super(SkiaLinkedinDesktopPageSet, self).__init__(
42      archive_data_file='data/skia_linkedin_desktop.json')
43
44    urls_list = [
45      # go/skia-skps-3-2019
46      'https://www.linkedin.com/in/linustorvalds',
47    ]
48
49    for url in urls_list:
50      self.AddStory(SkiaDesktopPage(url, self))
51