Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / core / profile_types.py
1 # Copyright 2013 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 import os
6
7 from telemetry.core import util
8
9 BASE_PROFILE_TYPES = ['clean', 'default']
10
11 PROFILE_TYPE_MAPPING = {
12   'typical_user': 'chrome/test/data/extensions/profiles/content_scripts1',
13   'power_user': 'chrome/test/data/extensions/profiles/extension_webrequest',
14 }
15
16 def GetProfileTypes():
17   """Returns a list of all command line options that can be specified for
18   profile type."""
19   return BASE_PROFILE_TYPES + PROFILE_TYPE_MAPPING.keys()
20
21 def GetProfileDir(profile_type):
22   """Given a |profile_type| (as returned by GetProfileTypes()), return the
23   directory to use for that profile or None if the profile doesn't need a
24   profile directory (e.g. using the browser default profile).
25   """
26   if profile_type in BASE_PROFILE_TYPES:
27     return None
28
29   path = os.path.join(
30       util.GetChromiumSrcDir(), *PROFILE_TYPE_MAPPING[profile_type].split('/'))
31
32   assert os.path.exists(path)
33   return path