Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged | 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 dir_name = '/tmp/layout-test-results' + '_' + str(x) | 171 dir_name = '/tmp/layout-test-results' + '_' + str(x) |
| 172 self._make_fake_test_result(port.host, dir_name) | 172 self._make_fake_test_result(port.host, dir_name) |
| 173 manager = get_manager() | 173 manager = get_manager() |
| 174 manager._limit_archived_results_count() | 174 manager._limit_archived_results_count() |
| 175 deleted_dir_count = 0 | 175 deleted_dir_count = 0 |
| 176 for x in range(1, 31): | 176 for x in range(1, 31): |
| 177 dir_name = '/tmp/layout-test-results' + '_' + str(x) | 177 dir_name = '/tmp/layout-test-results' + '_' + str(x) |
| 178 if not port.host.filesystem.exists(dir_name): | 178 if not port.host.filesystem.exists(dir_name): |
| 179 deleted_dir_count = deleted_dir_count + 1 | 179 deleted_dir_count = deleted_dir_count + 1 |
| 180 self.assertEqual(deleted_dir_count, 5) | 180 self.assertEqual(deleted_dir_count, 5) |
| 181 | |
|
qyearsley
2017/02/28 18:54:45
As a convention, when explicitly testing protected
jeffcarp
2017/02/28 21:57:39
That sounds good. I'm testing the private method i
| |
| 182 def test_ensure_manifest_copies_new_manifest(self): | |
| 183 host = MockHost() | |
| 184 port = host.port_factory.get('test-mac-mac10.10') | |
|
qyearsley
2017/02/28 18:54:45
If the test is not asserting anything that's port-
jeffcarp
2017/02/28 21:57:39
Done
| |
| 185 | |
| 186 self.assertFalse(port.host.filesystem.exists('/mock-checkout/third_party /WebKit/LayoutTests/external/wpt/MANIFEST.json')) | |
| 187 manager = Manager(port, options=optparse.Values({'max_locked_shards': 1} ), printer=FakePrinter()) | |
| 188 manager._ensure_manifest() # pylint: disable=protected-access | |
| 189 self.assertTrue(port.host.filesystem.exists('/mock-checkout/third_party/ WebKit/LayoutTests/external/wpt/MANIFEST.json')) | |
| 190 self.assertEqual(port.host.executive.calls, [ | |
|
foolip
2017/02/28 04:49:17
I don't understand this assert, leaving it to qyea
qyearsley
2017/02/28 18:54:45
This is asserting that one subprocess was invoked,
| |
| 191 ['python', | |
| 192 '/mock-checkout/third_party/WebKit/Tools/Scripts/webkitpy/thirdpart y/wpt/wpt/manifest', | |
| 193 '--work', '--tests-root', '/mock-checkout/third_party/WebKit/Layout Tests/external/wpt']]) | |
|
qyearsley
2017/02/28 18:54:45
Nit: Optionally, you could also format this as som
jeffcarp
2017/02/28 21:57:39
Done
| |
| 194 | |
| 195 def test_ensure_manifest_updates_manifest_if_it_exists(self): | |
| 196 host = MockHost() | |
| 197 port = host.port_factory.get('test-mac-mac10.10') | |
| 198 manifest_path = '/mock-checkout/third_party/WebKit/LayoutTests/external/ wpt/MANIFEST.json' | |
| 199 | |
| 200 host.filesystem.write_binary_file(manifest_path, '{}') | |
| 201 self.assertTrue(port.host.filesystem.exists(manifest_path)) | |
| 202 | |
| 203 manager = Manager(port, options=optparse.Values({'max_locked_shards': 1} ), printer=FakePrinter()) | |
| 204 manager._ensure_manifest() # pylint: disable=protected-access | |
| 205 self.assertTrue(port.host.filesystem.exists(manifest_path)) | |
| 206 self.assertEqual(port.host.executive.calls, [ | |
| 207 ['python', | |
| 208 '/mock-checkout/third_party/WebKit/Tools/Scripts/webkitpy/thirdpart y/wpt/wpt/manifest', | |
| 209 '--work', '--tests-root', '/mock-checkout/third_party/WebKit/Layout Tests/external/wpt']]) | |
| OLD | NEW |