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

Side by Side Diff: build/android/pylib/base/test_collection.py

Issue 788753002: [Android] Implement gtest and local in platform mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix findbugs + move log parsing up to GtestTestInstance Created 6 years 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 2013 The Chromium Authors. All rights reserved. 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 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 import threading 5 import threading
6 6
7 class TestCollection(object): 7 class TestCollection(object):
8 """A threadsafe collection of tests. 8 """A threadsafe collection of tests.
9 9
10 Args: 10 Args:
(...skipping 26 matching lines...) Expand all
37 # Check which of the two conditions triggered the signal. 37 # Check which of the two conditions triggered the signal.
38 if self._tests_in_progress == 0: 38 if self._tests_in_progress == 0:
39 return None 39 return None
40 try: 40 try:
41 return self._tests.pop(0) 41 return self._tests.pop(0)
42 except IndexError: 42 except IndexError:
43 # Another thread beat us to the available test, wait again. 43 # Another thread beat us to the available test, wait again.
44 self._item_available_or_all_done.clear() 44 self._item_available_or_all_done.clear()
45 45
46 def add(self, test): 46 def add(self, test):
47 """Add an test to the collection. 47 """Add a test to the collection.
48 48
49 Args: 49 Args:
50 test: A test to add. 50 test: A test to add.
51 """ 51 """
52 with self._lock: 52 with self._lock:
53 self._tests.append(test) 53 self._tests.append(test)
54 self._item_available_or_all_done.set() 54 self._item_available_or_all_done.set()
55 self._tests_in_progress += 1 55 self._tests_in_progress += 1
56 56
57 def test_completed(self): 57 def test_completed(self):
(...skipping 13 matching lines...) Expand all
71 yield r 71 yield r
72 72
73 def __len__(self): 73 def __len__(self):
74 """Return the number of tests currently in the collection.""" 74 """Return the number of tests currently in the collection."""
75 return len(self._tests) 75 return len(self._tests)
76 76
77 def test_names(self): 77 def test_names(self):
78 """Return a list of the names of the tests currently in the collection.""" 78 """Return a list of the names of the tests currently in the collection."""
79 with self._lock: 79 with self._lock:
80 return list(t.test for t in self._tests) 80 return list(t.test for t in self._tests)
OLDNEW
« no previous file with comments | « build/android/pylib/base/environment_factory.py ('k') | build/android/pylib/base/test_instance_factory.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698