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

Side by Side Diff: build/android/pylib/host_driven/test_case.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: Several minor changes to variable names / comments Created 7 years, 5 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
(Empty)
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
3 # found in the LICENSE file.
4
5 """Base class for host-driven tests.
6
7 This test case is intended to serve as the base class for any host-driven
8 tests. It is similar to the Python unitttest module in that test cases
9 inherit from this class and add methods which will be run as tests.
10
11 When a HostDrivenTestCase object is instantiated, its purpose is to run only one
12 of its tests. The test runner gives it the name of the test the instance will
frankf 2013/07/25 01:24:21 "one of its tests" -> one test method in the deriv
gkanwar1 2013/07/25 21:15:41 Done.
13 run. The test runner calls SetUp with the device ID which the test will run
frankf 2013/07/25 01:24:21 test -> test method everywhere
gkanwar1 2013/07/25 21:15:41 Done.
14 against. The runner runs the test method itself, collecting the result, and
frankf 2013/07/25 01:24:21 runner -> test runner
gkanwar1 2013/07/25 21:15:41 Done.
15 calls TearDown.
16 """
17
18 import logging
19
20 from pylib import android_commands
21
22
23 class HostDrivenTestCase(object):
24 """Base class for host-driven tests."""
25
26 def __init__(self, test_name):
27 # test_name must match one of the test methods defined on a subclass which
28 # inherits from this class.
29 self.test_name = test_name
30 class_name = self.__class__.__name__
31 self.qualified_name = class_name + '.' + self.test_name
32
33 def SetUp(self, device, shard_index, build_type, push_deps,
34 cleanup_test_files):
35 self.device_id = device
36 self.shard_index = shard_index
37 self.build_type = build_type
38 self.adb = android_commands.AndroidCommands(self.device_id)
39 self.push_deps = push_deps
40 self.cleanup_test_files = cleanup_test_files
41
42 def TearDown(self):
43 pass
44
45 def GetOutDir(self):
46 return os.path.join(os.environ['CHROME_SRC'], 'out',
47 self.build_type)
48
49 def Run(self):
50 logging.info('Running host-driven test: %s', self.test_name)
51 return getattr(self, self.test_name)()
frankf 2013/07/25 01:24:21 Explain what this runnable is
gkanwar1 2013/07/25 21:15:41 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698