Home | History | Annotate | Download | only in backends
      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
      3 # found in the LICENSE file.
      4 import unittest
      5 
      6 from telemetry.internal.backends import browser_backend
      7 from telemetry.testing import options_for_unittests
      8 import mock
      9 
     10 
     11 class BrowserBackendLogsUploadingUnittest(unittest.TestCase):
     12   def testUploadingToCLoudStorage(self):
     13     # pylint: disable=abstract-method
     14     class FakeBrowserBackend(browser_backend.BrowserBackend):
     15       @property
     16       def supports_uploading_logs(self):
     17         return True
     18 
     19       @property
     20       def log_file_path(self):
     21         return '/foo/bar'
     22 
     23     options = options_for_unittests.GetCopy()
     24     options.browser_options.enable_logging = True
     25     options.browser_options.logs_cloud_bucket = 'ABC'
     26     options.browser_options.logs_cloud_remote_path = 'def'
     27 
     28     b = FakeBrowserBackend(None, False, options.browser_options, None)
     29     with mock.patch('catapult_base.cloud_storage.Insert') as mock_insert:
     30       b.UploadLogsToCloudStorage()
     31       mock_insert.assert_called_with(
     32         bucket='ABC', remote_path='def', local_path='/foo/bar')
     33