Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / test / functional / media / pyauto_media.py
1 # Copyright (c) 2012 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
5 """PyAuto media test base.  Handles PyAuto initialization and path setup.
6
7 Required to ensure each media test can load the appropriate libraries.  Each
8 test must include this snippet:
9
10     # This should be at the top
11     import pyauto_media
12
13     <test code>
14
15     # This should be at the bottom.
16     if __name__ == '__main__':
17       pyauto_media.Main()
18 """
19
20 import os
21 import sys
22
23
24 def _SetupPaths():
25   """Add paths required for loading PyAuto and other utilities to sys.path."""
26   media_dir = os.path.abspath(os.path.dirname(__file__))
27   sys.path.append(media_dir)
28   sys.path.append(os.path.normpath(os.path.join(media_dir, os.pardir)))
29
30   # Add psutil library path.
31   # TODO(dalecurtis): This should only be added for tests which use psutil.
32   sys.path.append(os.path.normpath(os.path.join(
33       media_dir, os.pardir, os.pardir, os.pardir, os.pardir,
34       'third_party', 'psutil')))
35
36
37 _SetupPaths()
38
39
40 import pyauto_functional
41 Main = pyauto_functional.Main