OLD | NEW |
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 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 csv | 5 import csv |
6 import inspect | 6 import inspect |
7 import os | 7 import os |
8 | 8 |
9 from telemetry.page import page as page_module | 9 from telemetry.page import page as page_module |
10 from telemetry.page import page_set_archive_info | 10 from telemetry.page import page_set_archive_info |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 def AddPageWithDefaultRunNavigate(self, page_url): | 69 def AddPageWithDefaultRunNavigate(self, page_url): |
70 """ Add a simple page with url equals to page_url that contains only default | 70 """ Add a simple page with url equals to page_url that contains only default |
71 RunNavigateSteps. | 71 RunNavigateSteps. |
72 """ | 72 """ |
73 self.AddUserStory(page_module.Page( | 73 self.AddUserStory(page_module.Page( |
74 page_url, self, self.base_dir)) | 74 page_url, self, self.base_dir)) |
75 | 75 |
76 @staticmethod | 76 @staticmethod |
77 def _IsValidPrivacyBucket(bucket_name): | 77 def _IsValidPrivacyBucket(bucket_name): |
78 if not bucket_name: | 78 return bucket_name in (None, PUBLIC_BUCKET, PARTNER_BUCKET, INTERNAL_BUCKET) |
79 return True | |
80 if (bucket_name in [PUBLIC_BUCKET, PARTNER_BUCKET, INTERNAL_BUCKET]): | |
81 return True | |
82 return False | |
83 | 79 |
84 @property | 80 @property |
85 def base_dir(self): | 81 def base_dir(self): |
86 if os.path.isfile(self.file_path): | 82 if os.path.isfile(self.file_path): |
87 return os.path.dirname(self.file_path) | 83 return os.path.dirname(self.file_path) |
88 else: | 84 else: |
89 return self.file_path | 85 return self.file_path |
90 | 86 |
91 @property | 87 @property |
92 def wpr_archive_info(self): # pylint: disable=E0202 | 88 def wpr_archive_info(self): # pylint: disable=E0202 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 self.AddPage(page_set_dict[csv_row[url_index]]) | 128 self.AddPage(page_set_dict[csv_row[url_index]]) |
133 else: | 129 else: |
134 raise Exception('Unusable results_file.') | 130 raise Exception('Unusable results_file.') |
135 | 131 |
136 return user_stories | 132 return user_stories |
137 | 133 |
138 def WprFilePathForPage(self, page): | 134 def WprFilePathForPage(self, page): |
139 if not self.wpr_archive_info: | 135 if not self.wpr_archive_info: |
140 return None | 136 return None |
141 return self.wpr_archive_info.WprFilePathForPage(page) | 137 return self.wpr_archive_info.WprFilePathForPage(page) |
OLD | NEW |