options_for_unittests.py revision 46d4c2bc3267f3f028f39e7e311b0f89aba2e4fd
1# Copyright 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"""This module provides the global variable options_for_unittests.
6
7This is set to a BrowserOptions object by the test harness, or None
8if unit tests are not running.
9
10This allows multiple unit tests to use a specific
11browser, in face of multiple options."""
12_options = None
13_browser_type = None
14def Set(options, browser_type):
15  global _options
16  global _browser_type
17
18  _options = options
19  _browser_type = browser_type
20
21def GetCopy():
22  if not _options:
23    return None
24
25  return _options.Copy()
26
27def AreSet():
28  if _options:
29    return True
30  return False
31
32def GetBrowserType():
33  return _browser_type
34