OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from telemetry.core import util | 5 from telemetry.core import util |
6 from telemetry.page.actions import seek | 6 from telemetry.page.actions import seek |
7 from telemetry.unittest import tab_test_case | 7 from telemetry.unittest import tab_test_case |
8 | 8 |
9 | |
10 AUDIO_1_SEEKED_CHECK = 'window.__hasEventCompleted("#audio_1", "seeked");' | 9 AUDIO_1_SEEKED_CHECK = 'window.__hasEventCompleted("#audio_1", "seeked");' |
11 VIDEO_1_SEEKED_CHECK = 'window.__hasEventCompleted("#video_1", "seeked");' | 10 VIDEO_1_SEEKED_CHECK = 'window.__hasEventCompleted("#video_1", "seeked");' |
12 | 11 |
13 | 12 |
14 class SeekActionTest(tab_test_case.TabTestCase): | 13 class SeekActionTest(tab_test_case.TabTestCase): |
15 | 14 |
16 def setUp(self): | 15 def setUp(self): |
17 tab_test_case.TabTestCase.setUp(self) | 16 tab_test_case.TabTestCase.setUp(self) |
18 self.Navigate('video_test.html') | 17 self.Navigate('video_test.html') |
19 | 18 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 self.assertTrue(self._tab.EvaluateJavaScript(AUDIO_1_SEEKED_CHECK)) | 52 self.assertTrue(self._tab.EvaluateJavaScript(AUDIO_1_SEEKED_CHECK)) |
54 | 53 |
55 def testSeekWaitForSeekTimeout(self): | 54 def testSeekWaitForSeekTimeout(self): |
56 """Tests that wait_for_seeked timeouts if video does not seek.""" | 55 """Tests that wait_for_seeked timeouts if video does not seek.""" |
57 action = seek.SeekAction(seconds=1, selector='#video_1', | 56 action = seek.SeekAction(seconds=1, selector='#video_1', |
58 timeout_in_seconds=1) | 57 timeout_in_seconds=1) |
59 action.WillRunAction(self._tab) | 58 action.WillRunAction(self._tab) |
60 self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""') | 59 self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""') |
61 self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK)) | 60 self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK)) |
62 self.assertRaises(util.TimeoutException, action.RunAction, self._tab) | 61 self.assertRaises(util.TimeoutException, action.RunAction, self._tab) |
OLD | NEW |