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

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

Issue 324503002: Add optional cloud bucket permission property to page and page_set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: last nit for Tony Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/page_set_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/page_set.py
diff --git a/tools/telemetry/telemetry/page/page_set.py b/tools/telemetry/telemetry/page/page_set.py
index 234e7b1a8e29655934c755707c93162c7c1aaed9..d2966ffa2932c08b78b526c80d9664478debc7e2 100644
--- a/tools/telemetry/telemetry/page/page_set.py
+++ b/tools/telemetry/telemetry/page/page_set.py
@@ -7,9 +7,16 @@ import inspect
import os
from telemetry.core import util
+from telemetry.page import cloud_storage
from telemetry.page import page as page_module
from telemetry.page import page_set_archive_info
+
+PUBLIC_BUCKET = cloud_storage.PUBLIC_BUCKET
+PARTNER_BUCKET = cloud_storage.PARTNER_BUCKET
+INTERNAL_BUCKET = cloud_storage.INTERNAL_BUCKET
+
+
class PageSetError(Exception):
pass
@@ -18,7 +25,7 @@ class PageSet(object):
def __init__(self, file_path=None, archive_data_file='',
credentials_path=None, user_agent_type=None,
make_javascript_deterministic=True, startup_url='',
- serving_dirs=None):
+ serving_dirs=None, bucket=None):
# The default value of file_path is location of the file that define this
# page set instance's class.
if file_path is None:
@@ -44,6 +51,10 @@ class PageSet(object):
self.serving_dirs.add(os.path.realpath(sd))
else:
self.serving_dirs.add(os.path.realpath(os.path.join(self.base_dir, sd)))
+ if self._IsValidPrivacyBucket(bucket):
+ self._bucket = bucket
+ else:
+ raise ValueError("Pageset privacy bucket %s is invalid" % bucket)
@classmethod
def Name(cls):
@@ -99,6 +110,14 @@ pages in %s must be in the form of def Run<...>(self, action_runner):"""
% file_path)
return page_set
+ @staticmethod
+ def _IsValidPrivacyBucket(bucket_name):
+ if not bucket_name:
+ return True
+ if (bucket_name in [PUBLIC_BUCKET, PARTNER_BUCKET, INTERNAL_BUCKET]):
+ return True
+ return False
+
@property
def base_dir(self):
if os.path.isfile(self.file_path):
@@ -115,6 +134,10 @@ pages in %s must be in the form of def Run<...>(self, action_runner):"""
os.path.join(self.base_dir, self.archive_data_file)))
return self._wpr_archive_info
+ @property
+ def bucket(self):
+ return self._bucket
+
@wpr_archive_info.setter
def wpr_archive_info(self, value): # pylint: disable=E0202
self._wpr_archive_info = value
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/page_set_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698