| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 | 4 |
| 5 import collections | 5 import collections |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 PERF_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 10 PERF_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 11 sys.path.insert(0, os.path.join(os.path.dirname(PERF_ROOT), 'telemetry')) | 11 sys.path.insert(0, os.path.join(os.path.dirname(PERF_ROOT), 'telemetry')) |
| 12 from telemetry.unittest import DisabledTestOnCrOS |
| 12 from telemetry.unittest import system_stub | 13 from telemetry.unittest import system_stub |
| 13 | 14 |
| 14 sys.path.insert(0, PERF_ROOT) | 15 sys.path.insert(0, PERF_ROOT) |
| 15 from page_sets import PRESUBMIT | 16 from page_sets import PRESUBMIT |
| 16 | 17 |
| 17 | 18 |
| 18 class AffectedFileStub(object): | 19 class AffectedFileStub(object): |
| 19 def __init__(self, absolute_local_path): | 20 def __init__(self, absolute_local_path): |
| 20 self._absolute_local_path = absolute_local_path | 21 self._absolute_local_path = absolute_local_path |
| 21 | 22 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 def testInvalidHash(self): | 115 def testInvalidHash(self): |
| 115 results = self._CheckUpload(['/path/to/invalid_hash.wpr.sha1']) | 116 results = self._CheckUpload(['/path/to/invalid_hash.wpr.sha1']) |
| 116 self.assertResultCount(results, 1, 0) | 117 self.assertResultCount(results, 1, 0) |
| 117 self.assertTrue('valid SHA-1 hash' in str(results[0]), msg=results[0]) | 118 self.assertTrue('valid SHA-1 hash' in str(results[0]), msg=results[0]) |
| 118 | 119 |
| 119 def testMissingFile(self): | 120 def testMissingFile(self): |
| 120 results = self._CheckUpload(['/path/to/missing.wpr.sha1']) | 121 results = self._CheckUpload(['/path/to/missing.wpr.sha1']) |
| 121 self.assertResultCount(results, 1, 0) | 122 self.assertResultCount(results, 1, 0) |
| 122 self.assertTrue('not found' in str(results[0]), msg=results[0]) | 123 self.assertTrue('not found' in str(results[0]), msg=results[0]) |
| 123 | 124 |
| 125 @DisabledTestOnCrOS |
| 124 def testSkip(self): | 126 def testSkip(self): |
| 125 results = self._CheckUpload(['/path/to/skip.wpr.sha1']) | 127 results = self._CheckUpload(['/path/to/skip.wpr.sha1']) |
| 126 self.assertResultCount(results, 0, 0) | 128 self.assertResultCount(results, 0, 0) |
| 127 | 129 |
| 130 @DisabledTestOnCrOS |
| 128 def testSuccess(self): | 131 def testSuccess(self): |
| 129 results = self._CheckUpload(['/path/to/success.wpr.sha1']) | 132 results = self._CheckUpload(['/path/to/success.wpr.sha1']) |
| 130 self.assertResultCount(results, 0, 1) | 133 self.assertResultCount(results, 0, 1) |
| 131 self.assertTrue('Uploaded' in str(results[0]), msg=results[0]) | 134 self.assertTrue('Uploaded' in str(results[0]), msg=results[0]) |
| 132 | 135 |
| 133 def testWrongHash(self): | 136 def testWrongHash(self): |
| 134 results = self._CheckUpload(['/path/to/wrong_hash.wpr.sha1']) | 137 results = self._CheckUpload(['/path/to/wrong_hash.wpr.sha1']) |
| 135 self.assertTrue('does not match' in str(results[0]), msg=results[0]) | 138 self.assertTrue('does not match' in str(results[0]), msg=results[0]) |
| 136 | 139 |
| 137 | 140 |
| 138 if __name__ == '__main__': | 141 if __name__ == '__main__': |
| 139 unittest.main() | 142 unittest.main() |
| OLD | NEW |