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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py

Issue 1839193004: Run auto-formatter (autopep8) on webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 8 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 platform = platform_str 43 platform = platform_str
44 if windows_version_tuple: 44 if windows_version_tuple:
45 getwindowsversion = lambda x: windows_version_tuple 45 getwindowsversion = lambda x: windows_version_tuple
46 46
47 return FakeSysModule() 47 return FakeSysModule()
48 48
49 49
50 def fake_platform(mac_version_string='10.6.3', release_string='bar', linux_versi on='trusty'): 50 def fake_platform(mac_version_string='10.6.3', release_string='bar', linux_versi on='trusty'):
51 51
52 class FakePlatformModule(object): 52 class FakePlatformModule(object):
53
53 def mac_ver(self): 54 def mac_ver(self):
54 return tuple([mac_version_string, tuple(['', '', '']), 'i386']) 55 return tuple([mac_version_string, tuple(['', '', '']), 'i386'])
55 56
56 def linux_distribution(self): 57 def linux_distribution(self):
57 return tuple([None, None, linux_version]) 58 return tuple([None, None, linux_version])
58 59
59 def platform(self): 60 def platform(self):
60 return 'foo' 61 return 'foo'
61 62
62 def release(self): 63 def release(self):
63 return release_string 64 return release_string
64 65
65 return FakePlatformModule() 66 return FakePlatformModule()
66 67
67 68
68 def fake_executive(output=None): 69 def fake_executive(output=None):
69 if output: 70 if output:
70 return MockExecutive2(output=output) 71 return MockExecutive2(output=output)
71 return MockExecutive2(exception=SystemError) 72 return MockExecutive2(exception=SystemError)
72 73
73 74
74 class TestPlatformInfo(unittest.TestCase): 75 class TestPlatformInfo(unittest.TestCase):
76
75 def make_info(self, sys_module=None, platform_module=None, filesystem_module =None, executive=None): 77 def make_info(self, sys_module=None, platform_module=None, filesystem_module =None, executive=None):
76 return PlatformInfo(sys_module or fake_sys(), platform_module or fake_pl atform(), filesystem_module or MockFileSystem(), executive or fake_executive()) 78 return PlatformInfo(sys_module or fake_sys(), platform_module or fake_pl atform(), filesystem_module or MockFileSystem(), executive or fake_executive())
77 79
78 def test_real_code(self): 80 def test_real_code(self):
79 # This test makes sure the real (unmocked) code actually works. 81 # This test makes sure the real (unmocked) code actually works.
80 info = PlatformInfo(sys, platform, FileSystem(), Executive()) 82 info = PlatformInfo(sys, platform, FileSystem(), Executive())
81 self.assertNotEquals(info.os_name, '') 83 self.assertNotEquals(info.os_name, '')
82 self.assertNotEquals(info.os_version, '') 84 self.assertNotEquals(info.os_version, '')
83 self.assertNotEquals(info.display_name(), '') 85 self.assertNotEquals(info.display_name(), '')
84 self.assertTrue(info.is_mac() or info.is_win() or info.is_linux() or inf o.is_freebsd()) 86 self.assertTrue(info.is_mac() or info.is_win() or info.is_linux() or inf o.is_freebsd())
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 self.assertEqual(info.total_bytes_memory(), 1234) 208 self.assertEqual(info.total_bytes_memory(), 1234)
207 209
208 info = self.make_info(fake_sys('win32', tuple([6, 1, 7600]))) 210 info = self.make_info(fake_sys('win32', tuple([6, 1, 7600])))
209 self.assertIsNone(info.total_bytes_memory()) 211 self.assertIsNone(info.total_bytes_memory())
210 212
211 info = self.make_info(fake_sys('linux2')) 213 info = self.make_info(fake_sys('linux2'))
212 self.assertIsNone(info.total_bytes_memory()) 214 self.assertIsNone(info.total_bytes_memory())
213 215
214 info = self.make_info(fake_sys('freebsd9')) 216 info = self.make_info(fake_sys('freebsd9'))
215 self.assertIsNone(info.total_bytes_memory()) 217 self.assertIsNone(info.total_bytes_memory())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698