| OLD | NEW |
| 1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 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 13 matching lines...) Expand all Loading... |
| 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 """Unit tests for run_perf_tests.""" | 29 """Unit tests for run_perf_tests.""" |
| 30 | 30 |
| 31 import StringIO | 31 import StringIO |
| 32 import json | 32 import json |
| 33 import re | 33 import re |
| 34 import unittest2 as unittest | 34 from webkitpy.thirdparty import unittest2 as unittest |
| 35 | 35 |
| 36 from webkitpy.common.host_mock import MockHost | 36 from webkitpy.common.host_mock import MockHost |
| 37 from webkitpy.common.system.outputcapture import OutputCapture | 37 from webkitpy.common.system.outputcapture import OutputCapture |
| 38 from webkitpy.layout_tests.port.test import TestPort | 38 from webkitpy.layout_tests.port.test import TestPort |
| 39 from webkitpy.performance_tests.perftest import DEFAULT_TEST_RUNNER_COUNT | 39 from webkitpy.performance_tests.perftest import DEFAULT_TEST_RUNNER_COUNT |
| 40 from webkitpy.performance_tests.perftestsrunner import PerfTestsRunner | 40 from webkitpy.performance_tests.perftestsrunner import PerfTestsRunner |
| 41 | 41 |
| 42 | 42 |
| 43 class MainTest(unittest.TestCase): | 43 class MainTest(unittest.TestCase): |
| 44 def create_runner(self, args=[]): | 44 def create_runner(self, args=[]): |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 self.assertEqual(MockFileUploader.called, ['FileUploader', 'upload_singl
e_text_file']) | 222 self.assertEqual(MockFileUploader.called, ['FileUploader', 'upload_singl
e_text_file']) |
| 223 | 223 |
| 224 MockFileUploader.reset() | 224 MockFileUploader.reset() |
| 225 MockFileUploader.upload_single_text_file_return_value = StringIO.StringI
O('{"status": "SomethingHasFailed", "failureStored": false}') | 225 MockFileUploader.upload_single_text_file_return_value = StringIO.StringI
O('{"status": "SomethingHasFailed", "failureStored": false}') |
| 226 output = OutputCapture() | 226 output = OutputCapture() |
| 227 output.capture_output() | 227 output.capture_output() |
| 228 self.assertFalse(runner._upload_json('some.host', 'some.json', '/some/pa
th', MockFileUploader)) | 228 self.assertFalse(runner._upload_json('some.host', 'some.json', '/some/pa
th', MockFileUploader)) |
| 229 _, _, logs = output.restore_output() | 229 _, _, logs = output.restore_output() |
| 230 serialized_json = json.dumps({'status': 'SomethingHasFailed', 'failureSt
ored': False}, indent=4) | 230 serialized_json = json.dumps({'status': 'SomethingHasFailed', 'failureSt
ored': False}, indent=4) |
| 231 self.assertEqual(logs, 'Uploaded JSON to https://some.host/some/path but
got an error:\n%s\n' % serialized_json) | 231 self.assertEqual(logs, 'Uploaded JSON to https://some.host/some/path but
got an error:\n%s\n' % serialized_json) |
| OLD | NEW |