Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: telemetry/telemetry/internal/backends/browser_backend_unittest.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698