Chromium Code Reviews| Index: chrome/test/functional/media/pyauto_media.py |
| diff --git a/chrome/test/functional/media/pyauto_media.py b/chrome/test/functional/media/pyauto_media.py |
| old mode 100755 |
| new mode 100644 |
| index 88b062a9b795592d1c21655b93e8195468d45922..7caae3446065dfd83459adad433e779bd23086b3 |
| --- a/chrome/test/functional/media/pyauto_media.py |
| +++ b/chrome/test/functional/media/pyauto_media.py |
| @@ -1,24 +1,20 @@ |
| -#!/usr/bin/env python |
| # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -"""Setup for PyAuto media tests. |
| +"""PyAuto media test base. Handles PyAuto initialization and path setup. |
|
Nirnimesh
2011/12/06 22:15:05
Please leave 2 spaces after every period.
DaleCurtis
2011/12/06 23:42:54
Done.
|
| -Use the following in your scripts to run them standalone: |
| +Required to ensure each media test can load the appropriate libraries. Each test |
| +must include this snippet: |
| -# This should be at the top |
| -import pyauto_media |
| + # This should be at the top |
| + import pyauto_media |
| -if __name__ == '__main__': |
| - pyauto_media.Main() |
| + <test code> |
| -This script looks similar to pyauto_functional.py. However, unlike |
| -pyauto_functional, this script can NOT be used as an executable to |
| -fire off other media scripts since media tests require additional |
| -parameters to be set in the form of environment variables (unless you |
| -want these variables to be defaults, which is generally not a good |
| -idea). |
| + # This should be at the bottom. |
| + if __name__ == '__main__': |
| + pyauto_media.Main() |
| """ |
| import os |
| @@ -29,27 +25,34 @@ from media_test_env_names import MediaTestEnvNames |
| def _SetupPaths(): |
| - """Setting path to find pyauto_functional.py.""" |
| + """Add paths required for loading PyAuto and other utilities to sys.path.""" |
| media_dir = os.path.abspath(os.path.dirname(__file__)) |
| sys.path.append(media_dir) |
| sys.path.append(os.path.normpath(os.path.join(media_dir, os.pardir))) |
| + |
| + # Add psutil library path. TODO(dalecurtis): This should only be added for |
| + # tests which use psutil. |
| sys.path.append(os.path.normpath(os.path.join( |
| media_dir, os.pardir, os.pardir, os.pardir, os.pardir, |
| 'third_party', 'psutil'))) |
| - # Setting PYTHONPATH for reference build. |
| + |
| + # Setting PYTHONPATH for reference build. TODO(dalecurtis): Don't use env |
| + # variables, each test can process a command line before passing off control |
| + # to PyAuto. |
| if os.getenv(MediaTestEnvNames.REFERENCE_BUILD_ENV_NAME): |
| reference_build_dir = os.getenv( |
| MediaTestEnvNames.REFERENCE_BUILD_DIR_ENV_NAME, |
| - # TODO(imasaki@): Change the following default value. |
| + # TODO(imasaki): Change the following default value. |
| # Default directory is just for testing so the correct directory |
| # must be set in the build script. |
| os.path.join(tempfile.gettempdir(), 'chrome-media-test')) |
| sys.path.insert(0, reference_build_dir) |
| + |
| _SetupPaths() |
| + |
| import pyauto_functional |
| -import pyauto |
| class Main(pyauto_functional.Main): |
|
Nirnimesh
2011/12/06 22:15:05
This class is a no-op. It can be replaced with:
M
DaleCurtis
2011/12/06 23:42:54
Done.
|
| @@ -57,7 +60,3 @@ class Main(pyauto_functional.Main): |
| def __init__(self): |
| pyauto_functional.Main.__init__(self) |
| - |
| - |
| -if __name__ == '__main__': |
| - Main() |