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

Side by Side Diff: Tools/Scripts/webkitpy/common/system/platforminfo_mock.py

Issue 1201873002: Move LayoutTest Linux distribution detection to PlatformInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove crusty comment Created 5 years, 6 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) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 10 matching lines...) Expand all
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 29
30 class MockPlatformInfo(object): 30 class MockPlatformInfo(object):
31 def __init__(self, os_name='mac', os_version='snowleopard', is_highdpi=False ): 31 def __init__(self, os_name='mac', os_version='snowleopard', linux_distributi on=None, is_highdpi=False):
32 self.os_name = os_name 32 self.os_name = os_name
33 self.os_version = os_version 33 self.os_version = os_version
34 self._linux_distribution = linux_distribution
34 self._is_highdpi = is_highdpi 35 self._is_highdpi = is_highdpi
35 36
36 def is_mac(self): 37 def is_mac(self):
37 return self.os_name == 'mac' 38 return self.os_name == 'mac'
38 39
39 def is_linux(self): 40 def is_linux(self):
40 return self.os_name == 'linux' 41 return self.os_name == 'linux'
41 42
42 def is_win(self): 43 def is_win(self):
43 return self.os_name == 'win' 44 return self.os_name == 'win'
44 45
45 def is_highdpi(self): 46 def is_highdpi(self):
46 return self._is_highdpi 47 return self._is_highdpi
47 48
48 def is_cygwin(self): 49 def is_cygwin(self):
49 return self.os_name == 'cygwin' 50 return self.os_name == 'cygwin'
50 51
51 def is_freebsd(self): 52 def is_freebsd(self):
52 return self.os_name == 'freebsd' 53 return self.os_name == 'freebsd'
53 54
54 def display_name(self): 55 def display_name(self):
55 return "MockPlatform 1.0" 56 return "MockPlatform 1.0"
56 57
58 def linux_distribution(self):
59 return self._linux_distribution if self.is_linux() else None
60
57 def total_bytes_memory(self): 61 def total_bytes_memory(self):
58 return 3 * 1024 * 1024 * 1024 # 3GB is a reasonable amount of ram to mo ck. 62 return 3 * 1024 * 1024 * 1024 # 3GB is a reasonable amount of ram to mo ck.
59 63
60 def terminal_width(self): 64 def terminal_width(self):
61 return 80 65 return 80
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/common/system/platforminfo.py ('k') | Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698