~canonical-platform-qa/ubuntu-system-tests/trunk

« back to all changes in this revision

Viewing changes to ubuntu_system_tests/helpers/mediaplayer/__init__.py

  • Committer: Tarmac
  • Author(s): Sergio Cazzolato
  • Date: 2016-02-10 14:20:31 UTC
  • mfrom: (277.4.26 base_test_refactor)
  • Revision ID: tarmac-20160210142031-j2py2zg1d6yi4tdg
Refactoring base test class and autopilot helpers. The idea is to reduce the tests/base and autopilot.py files length.

First step is implemented. For that different methods were move mainly to autopilot helper and this helper was split in different files.

The second part which is pushed and within it all the methods to launch and close apps are moved to the helpers.

Approved by PS Jenkins bot, Richard Huddie.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from enum import IntEnum
24
24
 
 
25
from ubuntu_system_tests.helpers import autopilot
25
26
from ubuntu_system_tests.helpers.dbus_observer import DBusObserver
26
27
from ubuntu_system_tests.helpers import processes
27
28
from ubuntu_system_tests.helpers.threads import StoppingThread
29
30
APP = 'mediaplayer-app'
30
31
 
31
32
 
 
33
def get_media_player_proxy():
 
34
    """
 
35
    Return media player app proxy object from existing process.
 
36
 
 
37
    :return: Proxy object for media player application.
 
38
 
 
39
    """
 
40
    from ubuntu_system_tests.helpers.mediaplayer._cpo import MainWindow
 
41
    proxy = autopilot.get_proxy_object_for_existing_app(APP)
 
42
    return MainWindow(proxy)
 
43
 
 
44
 
 
45
def is_mediaplayer_running():
 
46
    """ Indicate if the mediaplayer is running """
 
47
    return processes.is_process_running(APP)
 
48
 
 
49
 
32
50
class PlaybackStatus(IntEnum):
33
51
    """Media player playback states."""
34
52
    Null = 0
72
90
            self.result.set()
73
91
 
74
92
 
75
 
def is_mediaplayer_running():
76
 
    """ Indicate if the mediaplayer is running """
77
 
    return processes.is_process_running(APP)
78
 
 
79
 
 
80
93
def play_video(src_video):
81
94
    """ Play the src video in the media player """
82
95
    processes.start_application(APP, src_video)