OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Setup for PyAuto media tests. | 7 """Setup for PyAuto media tests. |
8 | 8 |
9 Use the following in your scripts to run them standalone: | 9 Use the following in your scripts to run them standalone: |
10 | 10 |
11 # This should be at the top | 11 # This should be at the top |
12 import pyauto_media | 12 import pyauto_media |
13 | 13 |
14 if __name__ == '__main__': | 14 if __name__ == '__main__': |
15 pyauto_media.Main() | 15 pyauto_media.Main() |
16 | 16 |
17 This script looks similar to pyauto_functional.py. However, unlike | 17 This script looks similar to pyauto_functional.py. However, unlike |
18 pyauto_functional, this script can NOT be used as an executable to | 18 pyauto_functional, this script can NOT be used as an executable to |
19 fire off other media scripts since media tests require additional | 19 fire off other media scripts since media tests require additional |
20 parameters to be set in the form of environment variables (unless you | 20 parameters to be set in the form of environment variables (unless you |
21 want these variables to be defaults, which is generally not a good | 21 want these variables to be defaults, which is generally not a good |
22 idea). | 22 idea). |
23 """ | 23 """ |
24 | 24 |
25 import os | 25 import os |
26 import sys | 26 import sys |
27 import tempfile | |
28 | |
29 from media_test_env_names import MediaTestEnvNames | |
27 | 30 |
28 | 31 |
29 def _SetupPaths(): | 32 def _SetupPaths(): |
30 """Setting path to find pyauto_functional.py.""" | 33 """Setting path to find pyauto_functional.py.""" |
31 media_dir = os.path.abspath(os.path.dirname(__file__)) | 34 media_dir = os.path.abspath(os.path.dirname(__file__)) |
32 sys.path.append(media_dir) | 35 sys.path.append(media_dir) |
33 sys.path.append(os.path.normpath(os.path.join(media_dir, os.pardir))) | 36 sys.path.append(os.path.normpath(os.path.join(media_dir, os.pardir))) |
34 sys.path.append(os.path.normpath(os.path.join( | 37 sys.path.append(os.path.normpath(os.path.join( |
35 media_dir, os.pardir, os.pardir, os.pardir, os.pardir, | 38 media_dir, os.pardir, os.pardir, os.pardir, os.pardir, |
36 'third_party', 'psutil'))) | 39 'third_party', 'psutil'))) |
40 # Setting PYTHONPATH for reference build. | |
41 if os.getenv(MediaTestEnvNames.REFERENCE_BUILD_ENV_NAME): | |
42 reference_build_dir = os.getenv( | |
43 MediaTestEnvNames.REFERENCE_BUILD_DIR_ENV_NAME, | |
44 # Default dir is just for testing so this dir must | |
45 # be set in the build script. | |
46 os.path.join(tempfile.gettempdir(), 'chrome-linux')) | |
Nirnimesh
2011/05/23 17:52:44
why hardcode to chrome-linux?
imasaki1
2011/05/23 18:58:47
This is just test directory, it will be change lat
Nirnimesh
2011/05/23 20:13:11
Even if it's experimental or temporary, it seems l
imasaki1
2011/05/23 20:26:23
Done.
| |
47 sys.path.insert(0, reference_build_dir) | |
37 | 48 |
38 _SetupPaths() | 49 _SetupPaths() |
39 | 50 |
40 import pyauto_functional | 51 import pyauto_functional |
41 import pyauto | 52 import pyauto |
42 | 53 |
43 | 54 |
44 class Main(pyauto_functional.Main): | 55 class Main(pyauto_functional.Main): |
45 """Main program for running PyAuto media tests.""" | 56 """Main program for running PyAuto media tests.""" |
46 | 57 |
47 def __init__(self): | 58 def __init__(self): |
48 pyauto_functional.Main.__init__(self) | 59 pyauto_functional.Main.__init__(self) |
49 | 60 |
50 | 61 |
51 if __name__ == '__main__': | 62 if __name__ == '__main__': |
52 Main() | 63 Main() |
OLD | NEW |