| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 page_sets.system_health import platforms | 5 from page_sets.system_health import platforms |
| 6 from page_sets.system_health import system_health_story | 6 from page_sets.system_health import system_health_story |
| 7 | 7 |
| 8 from page_sets.login_helpers import google_login | 8 from page_sets.login_helpers import google_login |
| 9 from page_sets.login_helpers import pandora_login | 9 from page_sets.login_helpers import pandora_login |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 action_runner.WaitForElement(selector=selector) | 38 action_runner.WaitForElement(selector=selector) |
| 39 action_runner.ClickElement(selector=selector) | 39 action_runner.ClickElement(selector=selector) |
| 40 | 40 |
| 41 def _WaitForPlayTime(self, action_runner): | 41 def _WaitForPlayTime(self, action_runner): |
| 42 action_runner.Wait(self.PLAY_DURATION) | 42 action_runner.Wait(self.PLAY_DURATION) |
| 43 while self._GetTimeInSeconds(action_runner) < self.PLAY_DURATION: | 43 while self._GetTimeInSeconds(action_runner) < self.PLAY_DURATION: |
| 44 action_runner.Wait( | 44 action_runner.Wait( |
| 45 self.PLAY_DURATION - self._GetTimeInSeconds(action_runner)) | 45 self.PLAY_DURATION - self._GetTimeInSeconds(action_runner)) |
| 46 | 46 |
| 47 def _GetTimeInSeconds(self, action_runner): | 47 def _GetTimeInSeconds(self, action_runner): |
| 48 minutes, seconds = action_runner.EvaluateJavaScript2( | 48 minutes, seconds = action_runner.EvaluateJavaScript( |
| 49 'document.querySelector({{ selector }}).textContent', | 49 'document.querySelector({{ selector }}).textContent', |
| 50 selector=self.TIME_SELECTOR).split(':') | 50 selector=self.TIME_SELECTOR).split(':') |
| 51 return int(minutes * 60 + seconds) | 51 return int(minutes * 60 + seconds) |
| 52 | 52 |
| 53 | 53 |
| 54 ################################################################################ | 54 ################################################################################ |
| 55 # Audio stories. | 55 # Audio stories. |
| 56 ################################################################################ | 56 ################################################################################ |
| 57 | 57 |
| 58 | 58 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 PLAY_SELECTOR = None | 107 PLAY_SELECTOR = None |
| 108 STOP_SELECTOR = '.pauseButton' | 108 STOP_SELECTOR = '.pauseButton' |
| 109 TIME_SELECTOR = '.elapsedTime' | 109 TIME_SELECTOR = '.elapsedTime' |
| 110 SEARCH_SELECTOR = '.searchInput' | 110 SEARCH_SELECTOR = '.searchInput' |
| 111 | 111 |
| 112 def _Login(self, action_runner): | 112 def _Login(self, action_runner): |
| 113 pandora_login.LoginAccount(action_runner, 'pandora', self.credentials_path) | 113 pandora_login.LoginAccount(action_runner, 'pandora', self.credentials_path) |
| 114 | 114 |
| 115 def _NavigateToMedia(self, action_runner): | 115 def _NavigateToMedia(self, action_runner): |
| 116 pass # Audio autoplays on Pandora, no need to search. | 116 pass # Audio autoplays on Pandora, no need to search. |
| OLD | NEW |