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

Unified Diff: tools/telemetry/telemetry/page/page_set_archive_info.py

Issue 779383002: Move WPR-related attributes to UserStorySet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/page/page_set_archive_info.py
diff --git a/tools/telemetry/telemetry/page/page_set_archive_info.py b/tools/telemetry/telemetry/page/page_set_archive_info.py
index 78b4692c56e48d48b7db01676f2b20a103ff4799..eb07998a16e07ed1a9fc6ee0afc932c11a20d4f5 100644
--- a/tools/telemetry/telemetry/page/page_set_archive_info.py
+++ b/tools/telemetry/telemetry/page/page_set_archive_info.py
@@ -9,11 +9,24 @@ import re
import shutil
import tempfile
+from telemetry import page as page_module
from telemetry.util import cloud_storage
+def AssertValidCloudStorageBucket(bucket):
+ is_valid = bucket in (None,
+ cloud_storage.PUBLIC_BUCKET,
+ cloud_storage.PARTNER_BUCKET,
+ cloud_storage.INTERNAL_BUCKET)
+ if not is_valid:
+ raise ValueError("Cloud storage privacy bucket %s is invalid" % bucket)
+
+
+# TODO(chrishenry): Rename this (and module) to wpr_archive_info.WprArchiveInfo
+# and move to telemetry.user_story or telemetry.wpr or telemetry.core.
class PageSetArchiveInfo(object):
def __init__(self, file_path, data, bucket, ignore_archive=False):
+ AssertValidCloudStorageBucket(bucket)
self._file_path = file_path
self._base_dir = os.path.dirname(file_path)
self._bucket = bucket
@@ -63,14 +76,14 @@ class PageSetArchiveInfo(object):
return cls(file_path, {'archives': {}}, bucket,
ignore_archive=ignore_archive)
- def WprFilePathForPage(self, page):
+ def WprFilePathForUserStory(self, story):
if self.temp_target_wpr_file_path:
return self.temp_target_wpr_file_path
- wpr_file = self._page_name_to_wpr_file.get(page.display_name, None)
- if wpr_file is None:
+ wpr_file = self._page_name_to_wpr_file.get(story.display_name, None)
+ if wpr_file is None and isinstance(story, page_module.Page):
# Some old page sets always use the URL to identify a page rather than the
# display_name, so try to look for that.
- wpr_file = self._page_name_to_wpr_file.get(page.url, None)
+ wpr_file = self._page_name_to_wpr_file.get(story.url, None)
if wpr_file:
return self._WprFileNameToPath(wpr_file)
return None
« no previous file with comments | « tools/telemetry/telemetry/page/page_set.py ('k') | tools/telemetry/telemetry/page/page_set_archive_info_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698