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

Side by Side Diff: scripts/slave/recipe_modules/platform/api.py

Issue 23889036: Refactor the way that TestApi works so that it is actually useful. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: rebase Created 7 years, 3 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 | Annotate | Revision Log
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 sys 5 import sys
6 import platform 6 import platform
7 7
8 from slave import recipe_api 8 from slave import recipe_api
9 9
10 10
(...skipping 25 matching lines...) Expand all
36 def __init__(self, **kwargs): 36 def __init__(self, **kwargs):
37 super(PlatformApi, self).__init__(**kwargs) 37 super(PlatformApi, self).__init__(**kwargs)
38 self._name = norm_plat(sys.platform) 38 self._name = norm_plat(sys.platform)
39 39
40 # Sometimes machine() lies, sometimes process() lies, so take their max. 40 # Sometimes machine() lies, sometimes process() lies, so take their max.
41 machine_bits = norm_bits(platform.machine()) 41 machine_bits = norm_bits(platform.machine())
42 processor_bits = norm_bits(platform.processor()) 42 processor_bits = norm_bits(platform.processor())
43 self._bits = max(machine_bits, processor_bits) 43 self._bits = max(machine_bits, processor_bits)
44 self._arch = 'intel' 44 self._arch = 'intel'
45 45
46 if self._mock is not None: 46 if self._test_data.enabled:
47 # Default to linux/64, unless test case says otherwise. 47 # Default to linux/64, unless test case says otherwise.
48 self._name = norm_plat(self._mock.get('name', 'linux')) 48 self._name = norm_plat(self._test_data.get('name', 'linux'))
49 self._bits = norm_bits(self._mock.get('bits', 64)) 49 self._bits = norm_bits(self._test_data.get('bits', 64))
50 50
51 @property 51 @property
52 def is_win(self): 52 def is_win(self):
53 return self.name == 'win' 53 return self.name == 'win'
54 54
55 @property 55 @property
56 def is_mac(self): 56 def is_mac(self):
57 return self.name == 'mac' 57 return self.name == 'mac'
58 58
59 @property 59 @property
60 def is_linux(self): 60 def is_linux(self):
61 return self.name == 'linux' 61 return self.name == 'linux'
62 62
63 @property 63 @property
64 def name(self): 64 def name(self):
65 return self._name 65 return self._name
66 66
67 @property 67 @property
68 def bits(self): 68 def bits(self):
69 return self._bits 69 return self._bits
70 70
71 @property 71 @property
72 def arch(self): 72 def arch(self):
73 return self._arch 73 return self._arch
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698