| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import os | 4 import os |
| 5 import StringIO | 5 import StringIO |
| 6 import unittest | 6 import unittest |
| 7 | 7 |
| 8 import mock | 8 import mock |
| 9 | 9 |
| 10 from telemetry import story | 10 from telemetry import story |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 'story_set,page,name,value,units,run_index', | 72 'story_set,page,name,value,units,run_index', |
| 73 'story_set,http://www.foo.com/,foo,3,seconds,0', | 73 'story_set,http://www.foo.com/,foo,3,seconds,0', |
| 74 '']) | 74 '']) |
| 75 | 75 |
| 76 self.assertEqual(expected, self.Format()) | 76 self.assertEqual(expected, self.Format()) |
| 77 | 77 |
| 78 @mock.patch('py_utils.cloud_storage.Insert') | 78 @mock.patch('py_utils.cloud_storage.Insert') |
| 79 def testMultiplePagesAndValues(self, cs_insert_mock): | 79 def testMultiplePagesAndValues(self, cs_insert_mock): |
| 80 cs_insert_mock.return_value = 'https://cloud_storage_url/foo' | 80 cs_insert_mock.return_value = 'https://cloud_storage_url/foo' |
| 81 trace_value = trace.TraceValue( | 81 trace_value = trace.TraceValue( |
| 82 None, trace_data.CreateTraceDataFromRawData('{"traceEvents": []}'), | 82 None, trace_data.CreateTraceDataFromRawData('{"traceEvents": []}')) |
| 83 remote_path='rp', upload_bucket='foo', | 83 trace_value.UploadToCloud(bucket='foo') |
| 84 cloud_url='https://cloud_storage_url/foo') | |
| 85 trace_value.UploadToCloud() | |
| 86 self.SimulateBenchmarkRun([ | 84 self.SimulateBenchmarkRun([ |
| 87 (self._story_set[0], [ | 85 (self._story_set[0], [ |
| 88 scalar.ScalarValue( | 86 scalar.ScalarValue( |
| 89 None, 'foo', 'seconds', 4, | 87 None, 'foo', 'seconds', 4, |
| 90 improvement_direction=improvement_direction.DOWN)]), | 88 improvement_direction=improvement_direction.DOWN)]), |
| 91 (self._story_set[1], [ | 89 (self._story_set[1], [ |
| 92 scalar.ScalarValue( | 90 scalar.ScalarValue( |
| 93 None, 'foo', 'seconds', 3.4, | 91 None, 'foo', 'seconds', 3.4, |
| 94 improvement_direction=improvement_direction.DOWN), | 92 improvement_direction=improvement_direction.DOWN), |
| 95 trace_value, | 93 trace_value, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 120 None, 'foo', 'seconds', 3, | 118 None, 'foo', 'seconds', 3, |
| 121 improvement_direction=improvement_direction.DOWN), | 119 improvement_direction=improvement_direction.DOWN), |
| 122 scalar.ScalarValue( | 120 scalar.ScalarValue( |
| 123 None, 'bar', 'tons', 5, | 121 None, 'bar', 'tons', 5, |
| 124 improvement_direction=improvement_direction.DOWN)])]) | 122 improvement_direction=improvement_direction.DOWN)])]) |
| 125 output = self.Format().split(self._LINE_SEPARATOR) | 123 output = self.Format().split(self._LINE_SEPARATOR) |
| 126 | 124 |
| 127 self.assertTrue(output[0].endswith(',trace_tag_0,trace_tag_1')) | 125 self.assertTrue(output[0].endswith(',trace_tag_0,trace_tag_1')) |
| 128 for line in output[1:-1]: | 126 for line in output[1:-1]: |
| 129 self.assertTrue(line.endswith(',date,option')) | 127 self.assertTrue(line.endswith(',date,option')) |
| OLD | NEW |