aboutsummaryrefslogtreecommitdiff
path: root/catapult/telemetry/telemetry/testing/options_for_unittests.py
blob: 1c47fbfef732fe271a24cdb151acef2779e5603d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright 2012 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.

"""This module provides the global variable options_for_unittests.

This is set to a BrowserOptions object by the test harness, or None
if unit tests are not running.

This allows multiple unit tests to use a specific
browser, in face of multiple options."""


_options = []


def Push(options):
  _options.append(options)


def Pop():
  return _options.pop()


def GetCopy():
  if not AreSet():
    return None
  return _options[-1].Copy()


def AreSet():
  return bool(_options)