Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: tools/telemetry/telemetry/core/profile_types.py

Issue 23604005: [Telemetry] Implement dirty profile generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@generate_profile
Patch Set: Rebase against trunk Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/profile_types.py
diff --git a/tools/telemetry/telemetry/core/profile_types.py b/tools/telemetry/telemetry/core/profile_types.py
index 6ea4ee3465ab071654ff48bd6780758b12f16097..cb5a3ec4d261cbc1cfe389a3edac30cc87ddc3aa 100644
--- a/tools/telemetry/telemetry/core/profile_types.py
+++ b/tools/telemetry/telemetry/core/profile_types.py
@@ -4,69 +4,30 @@
import os
-from telemetry.core import discover
-from telemetry.core import profile_creator
from telemetry.core import util
-BASE_PROFILE_TYPES = ['clean', 'default']
-PROFILE_CREATORS = {}
+BASE_PROFILE_TYPES = ['clean', 'default']
PROFILE_TYPE_MAPPING = {
'typical_user': 'chrome/test/data/extensions/profiles/content_scripts1',
'power_user': 'chrome/test/data/extensions/profiles/extension_webrequest',
}
-def _DiscoverCreateableProfiles(profile_creators_dir, base_dir):
- """Returns a dictionary of all the profile creators we can use to create
- a Chrome profile for testing located in |profile_creators_dir|.
- The returned value consists of 'class_name' -> 'test class' dictionary where
- class_name is the name of the class with the _creator suffix removed e.g.
- 'small_profile_creator will be 'small_profile'.
- """
- profile_creators_unfiltered = discover.DiscoverClasses(
- profile_creators_dir, base_dir, profile_creator.ProfileCreator)
-
- # Remove '_creator' suffix from keys.
- profile_creators = {}
- for test_name, test_class in profile_creators_unfiltered.iteritems():
- assert test_name.endswith('_creator')
- test_name = test_name[:-len('_creator')]
- profile_creators[test_name] = test_class
-
- return profile_creators
-
-def ClearProfieCreatorsForTests():
- """Clears the discovered profile creator objects. Used for unit tests."""
- PROFILE_CREATORS.clear()
-
-def FindProfileCreators(profile_creators_dir, base_dir):
- """Discover all the ProfileCreator objects in |profile_creators_dir|."""
- assert not PROFILE_CREATORS # It's illegal to call this function twice.
- PROFILE_CREATORS.update(_DiscoverCreateableProfiles(
- profile_creators_dir, base_dir))
-
def GetProfileTypes():
"""Returns a list of all command line options that can be specified for
profile type."""
- return (BASE_PROFILE_TYPES + PROFILE_TYPE_MAPPING.keys() +
- PROFILE_CREATORS.keys())
+ return BASE_PROFILE_TYPES + PROFILE_TYPE_MAPPING.keys()
def GetProfileDir(profile_type):
"""Given a |profile_type| (as returned by GetProfileTypes()), return the
- directory to use for that profile or None if the profile needs to be generated
- or doesn't need a profile directory (e.g. using the browser default profile).
+ directory to use for that profile or None if the profile doesn't need a
+ profile directory (e.g. using the browser default profile).
"""
- if (profile_type in BASE_PROFILE_TYPES or
- profile_type in PROFILE_CREATORS):
+ if (profile_type in BASE_PROFILE_TYPES):
return None
path = os.path.join(
util.GetChromiumSrcDir(), *PROFILE_TYPE_MAPPING[profile_type].split('/'))
assert os.path.exists(path)
return path
-
-def GetProfileCreator(profile_type):
- """Returns the profile creator object corresponding to the |profile_type|
- string."""
- return PROFILE_CREATORS.get(profile_type)

Powered by Google App Engine
This is Rietveld 408576698