OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 os | 5 import os |
6 import tempfile | 6 import tempfile |
7 import unittest | 7 import unittest |
8 | 8 |
9 from telemetry.internal.backends import browser_backend | 9 from telemetry.internal.backends import browser_backend |
10 from telemetry.testing import options_for_unittests | 10 from telemetry.testing import options_for_unittests |
(...skipping 12 matching lines...) Expand all Loading... |
23 class FakeBrowserBackend(browser_backend.BrowserBackend): | 23 class FakeBrowserBackend(browser_backend.BrowserBackend): |
24 @property | 24 @property |
25 def supports_uploading_logs(self): | 25 def supports_uploading_logs(self): |
26 return True | 26 return True |
27 | 27 |
28 @property | 28 @property |
29 def log_file_path(self): | 29 def log_file_path(self): |
30 return temp_file_name | 30 return temp_file_name |
31 | 31 |
32 options = options_for_unittests.GetCopy() | 32 options = options_for_unittests.GetCopy() |
33 options.browser_options.enable_logging = True | 33 options.browser_options.logging_verbosity = ( |
| 34 options.browser_options.VERBOSE_LOGGING) |
34 options.browser_options.logs_cloud_bucket = 'ABC' | 35 options.browser_options.logs_cloud_bucket = 'ABC' |
35 options.browser_options.logs_cloud_remote_path = 'def' | 36 options.browser_options.logs_cloud_remote_path = 'def' |
36 | 37 |
37 b = FakeBrowserBackend(None, False, options.browser_options, None) | 38 b = FakeBrowserBackend(None, False, options.browser_options, None) |
38 self.assertEquals(b.GetLogFileContents(), 'This is a\ntest log file.\n') | 39 self.assertEquals(b.GetLogFileContents(), 'This is a\ntest log file.\n') |
39 with mock.patch('catapult_base.cloud_storage.Insert') as mock_insert: | 40 with mock.patch('catapult_base.cloud_storage.Insert') as mock_insert: |
40 b.UploadLogsToCloudStorage() | 41 b.UploadLogsToCloudStorage() |
41 mock_insert.assert_called_with( | 42 mock_insert.assert_called_with( |
42 bucket='ABC', remote_path='def', local_path=temp_file_name) | 43 bucket='ABC', remote_path='def', local_path=temp_file_name) |
43 finally: | 44 finally: |
44 os.remove(temp_file_name) | 45 os.remove(temp_file_name) |
OLD | NEW |