| 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 os | 5 import os |
| 6 import unittest | 6 import unittest |
| 7 | 7 |
| 8 PERF_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 8 PERF_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 9 from telemetry.unittest_util import system_stub | 9 from telemetry.unittest_util import system_stub |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 self.cloud_storage.INTERNAL_BUCKET, 'preset_internal_file.wpr')) | 78 self.cloud_storage.INTERNAL_BUCKET, 'preset_internal_file.wpr')) |
| 79 | 79 |
| 80 def testExistsNonEmptyCloudStorage(self): | 80 def testExistsNonEmptyCloudStorage(self): |
| 81 # Test non-empty remote files dictionary. | 81 # Test non-empty remote files dictionary. |
| 82 self.cloud_storage.SetRemotePathsForTesting(self.remote_paths) | 82 self.cloud_storage.SetRemotePathsForTesting(self.remote_paths) |
| 83 self.assertTrue(self.cloud_storage.Exists(self.cloud_storage.PUBLIC_BUCKET, | 83 self.assertTrue(self.cloud_storage.Exists(self.cloud_storage.PUBLIC_BUCKET, |
| 84 'preset_public_file.wpr')) | 84 'preset_public_file.wpr')) |
| 85 self.assertTrue(self.cloud_storage.Exists(self.cloud_storage.PARTNER_BUCKET, | 85 self.assertTrue(self.cloud_storage.Exists(self.cloud_storage.PARTNER_BUCKET, |
| 86 'preset_partner_file.wpr')) | 86 'preset_partner_file.wpr')) |
| 87 self.assertTrue(self.cloud_storage.Exists( | 87 self.assertTrue(self.cloud_storage.Exists( |
| 88 self.cloud_storage.INTERNAL_BUCKET,'preset_internal_file.wpr')) | 88 self.cloud_storage.INTERNAL_BUCKET, 'preset_internal_file.wpr')) |
| 89 self.assertFalse(self.cloud_storage.Exists(self.cloud_storage.PUBLIC_BUCKET, | 89 self.assertFalse(self.cloud_storage.Exists(self.cloud_storage.PUBLIC_BUCKET, |
| 90 'fake_file')) | 90 'fake_file')) |
| 91 self.assertFalse(self.cloud_storage.Exists( | 91 self.assertFalse(self.cloud_storage.Exists( |
| 92 self.cloud_storage.PARTNER_BUCKET,'fake_file')) | 92 self.cloud_storage.PARTNER_BUCKET, 'fake_file')) |
| 93 self.assertFalse(self.cloud_storage.Exists( | 93 self.assertFalse(self.cloud_storage.Exists( |
| 94 self.cloud_storage.INTERNAL_BUCKET, 'fake_file')) | 94 self.cloud_storage.INTERNAL_BUCKET, 'fake_file')) |
| 95 # Reset state. | 95 # Reset state. |
| 96 self.cloud_storage.SetRemotePathsForTesting() | 96 self.cloud_storage.SetRemotePathsForTesting() |
| 97 | 97 |
| 98 def testNonEmptyInsertAndExistsPublic(self): | 98 def testNonEmptyInsertAndExistsPublic(self): |
| 99 # Test non-empty remote files dictionary. | 99 # Test non-empty remote files dictionary. |
| 100 self.cloud_storage.SetRemotePathsForTesting(self.remote_paths) | 100 self.cloud_storage.SetRemotePathsForTesting(self.remote_paths) |
| 101 self.assertFalse(self.cloud_storage.Exists(self.cloud_storage.PUBLIC_BUCKET, | 101 self.assertFalse(self.cloud_storage.Exists(self.cloud_storage.PUBLIC_BUCKET, |
| 102 'success.wpr')) | 102 'success.wpr')) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 self.cloud_storage.INTERNAL_BUCKET) | 209 self.cloud_storage.INTERNAL_BUCKET) |
| 210 self.assertRaises( | 210 self.assertRaises( |
| 211 self.cloud_storage.CredentialsError, self.cloud_storage.Exists, | 211 self.cloud_storage.CredentialsError, self.cloud_storage.Exists, |
| 212 self.cloud_storage.INTERNAL_BUCKET, 'preset_internal_file.wpr') | 212 self.cloud_storage.INTERNAL_BUCKET, 'preset_internal_file.wpr') |
| 213 self.assertRaises( | 213 self.assertRaises( |
| 214 self.cloud_storage.CredentialsError, self.cloud_storage.Insert, | 214 self.cloud_storage.CredentialsError, self.cloud_storage.Insert, |
| 215 self.cloud_storage.INTERNAL_BUCKET, 'success.wpr', | 215 self.cloud_storage.INTERNAL_BUCKET, 'success.wpr', |
| 216 '/path/to/success.wpr') | 216 '/path/to/success.wpr') |
| 217 # Reset state. | 217 # Reset state. |
| 218 self.cloud_storage.SetRemotePathsForTesting() | 218 self.cloud_storage.SetRemotePathsForTesting() |
| OLD | NEW |