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

Side by Side Diff: build/android/pylib/host_driven/tests_annotations.py

Issue 19537004: [Android] Converts host driven tests to common test_dispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sharding_refactoring
Patch Set: Converts --official-build into a boolean flag 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Annotations for python-driven tests.""" 5 """Annotations for host-driven tests."""
6 6
7 import os 7 import os
8 8
9 9
10 class AnnotatedFunctions(object): 10 class AnnotatedFunctions(object):
11 """A container for annotated methods.""" 11 """A container for annotated methods."""
12 _ANNOTATED = {} 12 _ANNOTATED = {}
13 13
14 @staticmethod 14 @staticmethod
15 def _AddFunction(annotation, function): 15 def _AddFunction(annotation, function):
16 """Adds an annotated to function to our container. 16 """Adds an annotated function to our container.
17 17
18 Args: 18 Args:
19 annotation: the annotation string. 19 annotation: the annotation string.
20 function: the function. 20 function: the function.
21 Returns: 21 Returns:
22 The function passed in. 22 The function passed in.
23 """ 23 """
24 module_name = os.path.splitext(os.path.basename( 24 module_name = os.path.splitext(os.path.basename(
25 function.__globals__['__file__']))[0] 25 function.__globals__['__file__']))[0]
26 qualified_function_name = '.'.join([module_name, function.func_name]) 26 qualified_function_name = '.'.join([module_name, function.func_name])
(...skipping 22 matching lines...) Expand all
49 Args: 49 Args:
50 qualified_function_name: the qualified function name. 50 qualified_function_name: the qualified function name.
51 Returns: 51 Returns:
52 List of all annotations for this function. 52 List of all annotations for this function.
53 """ 53 """
54 return [annotation 54 return [annotation
55 for annotation, tests in AnnotatedFunctions._ANNOTATED.iteritems() 55 for annotation, tests in AnnotatedFunctions._ANNOTATED.iteritems()
56 if qualified_function_name in tests] 56 if qualified_function_name in tests]
57 57
58 58
59 # The following functions are annotations used for the python driven tests. 59 # The following functions are annotations used for the host-driven tests.
60 def Smoke(function): 60 def Smoke(function):
61 return AnnotatedFunctions._AddFunction('Smoke', function) 61 return AnnotatedFunctions._AddFunction('Smoke', function)
62 62
63 63
64 def SmallTest(function): 64 def SmallTest(function):
65 return AnnotatedFunctions._AddFunction('SmallTest', function) 65 return AnnotatedFunctions._AddFunction('SmallTest', function)
66 66
67 67
68 def MediumTest(function): 68 def MediumTest(function):
69 return AnnotatedFunctions._AddFunction('MediumTest', function) 69 return AnnotatedFunctions._AddFunction('MediumTest', function)
(...skipping 14 matching lines...) Expand all
84 def DisabledTest(function): 84 def DisabledTest(function):
85 return AnnotatedFunctions._AddFunction('DisabledTest', function) 85 return AnnotatedFunctions._AddFunction('DisabledTest', function)
86 86
87 87
88 def Feature(feature_list): 88 def Feature(feature_list):
89 def _AddFeatures(function): 89 def _AddFeatures(function):
90 for feature in feature_list: 90 for feature in feature_list:
91 AnnotatedFunctions._AddFunction('Feature' + feature, function) 91 AnnotatedFunctions._AddFunction('Feature' + feature, function)
92 return AnnotatedFunctions._AddFunction('Feature', function) 92 return AnnotatedFunctions._AddFunction('Feature', function)
93 return _AddFeatures 93 return _AddFeatures
OLDNEW
« no previous file with comments | « build/android/pylib/host_driven/test_runner.py ('k') | build/android/pylib/instrumentation/test_jar.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698