1a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch# Copyright 2014 The Chromium Authors. All rights reserved.
2a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch# Use of this source code is governed by a BSD-style license that can be
3a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch# found in the LICENSE file.
4a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochfrom telemetry.page import page as page_module
5a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochfrom telemetry.page import page_set as page_set_module
6a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
7a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
8010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)class ToughPinchZoomCasesPage(page_module.Page):
9a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
10010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  def __init__(self, url, page_set, name=''):
11010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)    super(ToughPinchZoomCasesPage, self).__init__(url=url, page_set=page_set,
12010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                                  name=name)
13a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.credentials_path = 'data/credentials.json'
14a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.user_agent_type = 'desktop'
15a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.archive_data_file = 'data/tough_pinch_zoom_cases.json'
16a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
17a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunSmoothness(self, action_runner):
18116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    interaction = action_runner.BeginGestureInteraction(
19116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch        'PinchAction', is_smooth=True)
20116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    action_runner.PinchPage()
21116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    interaction.End()
22a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
23a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
24a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass GoogleSearchPage(ToughPinchZoomCasesPage):
25a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
26a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: top google property; a google tab is often open. """
27a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
28a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
29a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(GoogleSearchPage, self).__init__(
30a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='https://www.google.com/#hl=en&q=barack+obama',
31a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      page_set=page_set)
32a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
33a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
35f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.WaitForElement(text='Next')
36a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
37a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
38a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass GmailPage(ToughPinchZoomCasesPage):
39a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
40a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: productivity, top google properties """
41a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
42a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
43a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(GmailPage, self).__init__(
44a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='https://mail.google.com/mail/',
45a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      page_set=page_set)
46a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
47a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.credentials = 'google'
48a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
49a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
50cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
51f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.WaitForJavaScriptCondition(
52f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)        'window.gmonkey !== undefined &&'
53f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)        'document.getElementById("gb") !== null')
54a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
55a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
56a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass GoogleCalendarPage(ToughPinchZoomCasesPage):
57a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
58a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: productivity, top google properties """
59a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
60a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
61a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(GoogleCalendarPage, self).__init__(
62a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='https://www.google.com/calendar/',
63a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      page_set=page_set)
64a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
65a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.credentials = 'google'
66a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
67a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
68cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
69f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.Wait(2)
70a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
71a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunSmoothness(self, action_runner):
72116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    interaction = action_runner.BeginGestureInteraction(
73116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch        'PinchAction', is_smooth=True)
74116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    action_runner.PinchPage(left_anchor_ratio=0.1, top_anchor_ratio=0.3)
75116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    interaction.End()
76a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
77a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
78a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass GoogleImageSearchPage(ToughPinchZoomCasesPage):
79a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
80a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: tough image case; top google properties """
81a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
82a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
83a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(GoogleImageSearchPage, self).__init__(
84a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='https://www.google.com/search?q=cats&tbm=isch',
85a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      page_set=page_set)
86a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
87a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.credentials = 'google'
88a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
89a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
90a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass GooglePlusPage(ToughPinchZoomCasesPage):
91a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
92a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: social; top google property; Public profile; infinite scrolls """
93a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
94a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
95a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(GooglePlusPage, self).__init__(
96a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='https://plus.google.com/+BarackObama/posts',
97a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      page_set=page_set)
98a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
99a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.credentials = 'google'
100a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
101a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
102cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
103f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.WaitForElement(text='Home')
104a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
105a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunSmoothness(self, action_runner):
106116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    interaction = action_runner.BeginGestureInteraction(
107116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch        'PinchAction', is_smooth=True)
108116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    action_runner.PinchElement(selector='[id="110031535020051778989-tab-bar"]')
109116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    interaction.End()
110a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
111a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
112a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass YoutubePage(ToughPinchZoomCasesPage):
113a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
114a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: #3 (Alexa global) """
115a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
116a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
117a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(YoutubePage, self).__init__(
118a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='http://www.youtube.com',
119a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      page_set=page_set)
120a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
121a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.credentials = 'google'
122a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
123a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
124cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
125f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.Wait(2)
126a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
127a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass BlogSpotPage(ToughPinchZoomCasesPage):
128a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
129a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """
130a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  Why: #11 (Alexa global), google property; some blogger layouts have infinite
131a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  scroll but more interesting
132a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """
133a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
134a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
135a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(BlogSpotPage, self).__init__(
136a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='http://googlewebmastercentral.blogspot.com/',
137010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)      page_set=page_set, name='Blogger')
138a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
139a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
140cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
141f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.WaitForElement(text='accessibility')
142a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
143a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
144a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass FacebookPage(ToughPinchZoomCasesPage):
145a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
146a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: top social,Public profile """
147a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
148a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
149a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(FacebookPage, self).__init__(
150a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='http://www.facebook.com/barackobama',
151010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)      page_set=page_set, name='Facebook')
152a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.credentials = 'facebook'
153a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
154a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
155cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
156f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.WaitForElement(text='About')
157a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
158a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
159a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass LinkedinPage(ToughPinchZoomCasesPage):
160a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
161a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: #12 (Alexa global),Public profile """
162a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
163a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
164a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(LinkedinPage, self).__init__(
165a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='http://www.linkedin.com/in/linustorvalds',
166010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)      page_set=page_set, name='LinkedIn')
167a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
168a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
169a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass WikipediaPage(ToughPinchZoomCasesPage):
170a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
171a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: #6 (Alexa) most visited worldwide,Picked an interesting page """
172a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
173a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
174a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(WikipediaPage, self).__init__(
175a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='http://en.wikipedia.org/wiki/Wikipedia',
176010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)      page_set=page_set, name='Wikipedia (1 tab)')
177a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
178a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
179a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass TwitterPage(ToughPinchZoomCasesPage):
180a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
181a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: #8 (Alexa global),Picked an interesting page """
182a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
183a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
184a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(TwitterPage, self).__init__(
185a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='https://twitter.com/katyperry',
186010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)      page_set=page_set, name='Twitter')
187a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
188a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
189cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
190f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.Wait(2)
191a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
192a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass ESPNPage(ToughPinchZoomCasesPage):
193a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
194a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: #1 sports """
195a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
196a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
197a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(ESPNPage, self).__init__(
198a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='http://espn.go.com/nba',
199010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)      page_set=page_set, name='ESPN')
200a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
201a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
202a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass WeatherDotComPage(ToughPinchZoomCasesPage):
203a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
204a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: #7 (Alexa news); #27 total time spent,Picked interesting page """
205a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
206a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
207a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(WeatherDotComPage, self).__init__(
208a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      # pylint: disable=C0301
209a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='http://www.weather.com/weather/right-now/Mountain+View+CA+94043',
210010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)      page_set=page_set, name='Weather.com')
211a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
212a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
213a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass YahooGamePage(ToughPinchZoomCasesPage):
214a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
215a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Why: #1 games according to Alexa (with actual games in it) """
216a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
217a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self, page_set):
218a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(YahooGamePage, self).__init__(
219a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      url='http://games.yahoo.com',
220a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      page_set=page_set)
221a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
222a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def RunNavigateSteps(self, action_runner):
223cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    action_runner.NavigateToPage(self)
224f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    action_runner.Wait(2)
225a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
226cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
227cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class YahooAnswersPage(ToughPinchZoomCasesPage):
228cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
229cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  """ Why: #1 Alexa reference """
230cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
231cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  def __init__(self, page_set):
232cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    super(YahooAnswersPage, self).__init__(
233cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      url='http://answers.yahoo.com',
234cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      page_set=page_set)
235cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
236cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  def RunSmoothness(self, action_runner):
237116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    interaction = action_runner.BeginGestureInteraction(
238116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch        'PinchAction', is_smooth=True)
239116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    action_runner.PinchElement(selector='#ya-content-apps')
240116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    interaction.End()
241cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
242cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
243a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass ToughPinchZoomCasesPageSet(page_set_module.PageSet):
244a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
245a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  """ Set of pages that are tricky to pinch-zoom """
246a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
247a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  def __init__(self):
248a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    super(ToughPinchZoomCasesPageSet, self).__init__(
249a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      credentials_path='data/credentials.json',
250a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      user_agent_type='desktop',
251f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      archive_data_file='data/tough_pinch_zoom_cases.json',
252f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      bucket=page_set_module.PARTNER_BUCKET)
253a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
254a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(GoogleSearchPage(self))
255a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(GmailPage(self))
256a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(GoogleCalendarPage(self))
257a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(GoogleImageSearchPage(self))
258a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(GooglePlusPage(self))
259a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(YoutubePage(self))
260a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(BlogSpotPage(self))
261a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(FacebookPage(self))
262a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(LinkedinPage(self))
263a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(WikipediaPage(self))
264a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(TwitterPage(self))
265a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(ESPNPage(self))
266a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
267a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    # Why: #1 news worldwide (Alexa global)
268a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(ToughPinchZoomCasesPage('http://news.yahoo.com', self))
269a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
270a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    # Why: #2 news worldwide
271a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(ToughPinchZoomCasesPage('http://www.cnn.com', self))
272a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
273a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(WeatherDotComPage(self))
274a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
275a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    # Why: #1 world commerce website by visits; #3 commerce in the US by time
276a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    # spent
277a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(ToughPinchZoomCasesPage('http://www.amazon.com', self))
278a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
279a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    # Why: #1 commerce website by time spent by users in US
280a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(ToughPinchZoomCasesPage('http://www.ebay.com', self))
281a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
282a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(YahooGamePage(self))
283a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
284a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    # Why: #1 Alexa recreation
285a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(ToughPinchZoomCasesPage('http://booking.com', self))
286a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
287cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    self.AddPage(YahooAnswersPage(self))
288a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
289a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    # Why: #1 Alexa sports
290a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    self.AddPage(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self))
291