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 from telemetry
.page
import page
as page_module
5 from telemetry
.page
import page_set
as page_set_module
8 class BasicPlayPage(page_module
.Page
):
10 def __init__(self
, url
, page_set
):
11 super(BasicPlayPage
, self
).__init
__(url
=url
, page_set
=page_set
)
12 self
.add_browser_metrics
= True
14 def PlayAction(self
, action_runner
):
15 action_runner
.PlayMedia(playing_event_timeout_in_seconds
=60,
16 ended_event_timeout_in_seconds
=60)
18 def RunPageInteractions(self
, action_runner
):
19 self
.PlayAction(action_runner
)
21 def SeekBeforeAndAfterPlayhead(self
, action_runner
):
22 action_runner
.PlayMedia(playing_event_timeout_in_seconds
=60)
23 # Wait for 1 second so that we know the play-head is at ~1s.
25 # Seek to before the play-head location.
26 action_runner
.SeekMedia(seconds
=0.5, timeout_in_seconds
=60,
28 # Seek to after the play-head location.
29 action_runner
.SeekMedia(seconds
=15, timeout_in_seconds
=60,
32 class SeekBeforeAndAfterPlayheadPage(BasicPlayPage
):
34 def __init__(self
, url
, page_set
):
35 super(SeekBeforeAndAfterPlayheadPage
, self
).__init
__(url
=url
,
37 self
.add_browser_metrics
= False
39 def RunPageInteractions(self
, action_runner
):
40 self
.SeekBeforeAndAfterPlayhead(action_runner
)
43 class MediaCnsCasesPageSet(page_set_module
.PageSet
):
45 """ Media benchmark on network constrained conditions. """
48 super(MediaCnsCasesPageSet
, self
).__init
__()
51 # pylint: disable=C0301
52 'file://tough_video_cases/video.html?id=no_constraints_webm&src=tulip2.webm&net=none',
53 # pylint: disable=C0301
54 'file://tough_video_cases/video.html?id=cable_webm&src=tulip2.webm&net=cable',
55 # pylint: disable=C0301
56 'file://tough_video_cases/video.html?id=wifi_webm&src=tulip2.webm&net=wifi',
57 # pylint: disable=C0301
58 'file://tough_video_cases/video.html?id=no_constraints_ogv&src=tulip2.ogv&net=none',
59 # pylint: disable=C0301
60 'file://tough_video_cases/video.html?id=cable_ogv&src=tulip2.ogv&net=cable',
61 # pylint: disable=C0301
62 'file://tough_video_cases/video.html?id=wifi_ogv&src=tulip2.ogv&net=wifi',
63 # pylint: disable=C0301
64 'file://tough_video_cases/video.html?id=no_constraints_mp4&src=tulip2.mp4&net=none',
65 # pylint: disable=C0301
66 'file://tough_video_cases/video.html?id=cable_mp4&src=tulip2.mp4&net=cable',
67 # pylint: disable=C0301
68 'file://tough_video_cases/video.html?id=wifi_mp4&src=tulip2.mp4&net=wifi',
69 # pylint: disable=C0301
70 'file://tough_video_cases/video.html?id=no_constraints_wav&src=tulip2.wav&type=audio&net=none',
71 # pylint: disable=C0301
72 'file://tough_video_cases/video.html?id=cable_wav&src=tulip2.wav&type=audio&net=cable',
73 # pylint: disable=C0301
74 'file://tough_video_cases/video.html?id=wifi_wav&src=tulip2.wav&type=audio&net=wifi',
75 # pylint: disable=C0301
76 'file://tough_video_cases/video.html?id=no_constraints_ogg&src=tulip2.ogg&type=audio&net=none',
77 # pylint: disable=C0301
78 'file://tough_video_cases/video.html?id=cable_ogg&src=tulip2.ogg&type=audio&net=cable',
79 # pylint: disable=C0301
80 'file://tough_video_cases/video.html?id=wifi_ogg&src=tulip2.ogg&type=audio&net=wifi',
81 # pylint: disable=C0301
82 'file://tough_video_cases/video.html?id=no_constraints_mp3&src=tulip2.mp3&type=audio&net=none',
83 # pylint: disable=C0301
84 'file://tough_video_cases/video.html?id=cable_mp3&src=tulip2.mp3&type=audio&net=cable',
85 # pylint: disable=C0301
86 'file://tough_video_cases/video.html?id=wifi_mp3&src=tulip2.mp3&type=audio&net=wifi',
87 # pylint: disable=C0301
88 'file://tough_video_cases/video.html?id=no_constraints_m4a&src=tulip2.m4a&type=audio&net=none',
89 # pylint: disable=C0301
90 'file://tough_video_cases/video.html?id=cable_m4a&src=tulip2.m4a&type=audio&net=cable',
91 # pylint: disable=C0301
92 'file://tough_video_cases/video.html?id=wifi_m4a&src=tulip2.m4a&type=audio&net=wifi'
96 self
.AddUserStory(BasicPlayPage(url
, self
))
99 # pylint: disable=C0301
100 'file://tough_video_cases/video.html?id=wifi_mp3&src=tulip2.mp3&type=audio&net=wifi',
101 # pylint: disable=C0301
102 'file://tough_video_cases/video.html?id=wifi_m4a&src=tulip2.m4a&type=audio&net=wifi',
103 # pylint: disable=C0301
104 'file://tough_video_cases/video.html?id=wifi_ogg&src=tulip2.ogg&type=audio&net=wifi',
105 # pylint: disable=C0301
106 'file://tough_video_cases/video.html?id=wifi_wav&src=tulip2.wav&type=audio&net=wifi',
107 # pylint: disable=C0301
108 'file://tough_video_cases/video.html?id=wifi_mp4&src=tulip2.mp4&type=audio&net=wifi',
109 # pylint: disable=C0301
110 'file://tough_video_cases/video.html?id=wifi_ogv&src=tulip2.ogv&type=audio&net=wifi',
111 # pylint: disable=C0301
112 'file://tough_video_cases/video.html?id=wifi_webm&src=tulip2.webm&type=audio&net=wifi'
115 for url
in urls_list2
:
116 self
.AddUserStory(SeekBeforeAndAfterPlayheadPage(url
, self
))