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

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

Issue 625123002: Make credential_path a page attribute instead of page_set attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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
Index: tools/telemetry/telemetry/page/__init__.py
diff --git a/tools/telemetry/telemetry/page/__init__.py b/tools/telemetry/telemetry/page/__init__.py
index 2435080a8460799d523cf35cc7ce8ecfade86dd5..d05be7ab440555cd63fef68e8435e0b7ce4499a0 100644
--- a/tools/telemetry/telemetry/page/__init__.py
+++ b/tools/telemetry/telemetry/page/__init__.py
@@ -2,15 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import inspect
+import logging
import os
import urlparse
from telemetry import user_story
+from telemetry.core import util
class Page(user_story.UserStory):
-
- def __init__(self, url, page_set=None, base_dir=None, name=''):
+ def __init__(self, url, page_set=None, base_dir=None, name='',
+ credentials_path=None):
super(Page, self).__init__(name)
self._url = url
self._page_set = page_set
@@ -20,7 +22,13 @@ class Page(user_story.UserStory):
base_dir = os.path.dirname(inspect.getfile(self.__class__))
self._base_dir = base_dir
self._name = name
-
+ if credentials_path:
+ self._credentials_path = (
+ util.GetAbsPathIfExist(credentials_path, base_dir))
+ if not self._credentials_path:
+ logging.error('Invalid credentials path: %s' % credentials_path)
dtu 2014/10/06 21:30:22 We need to do _UpdateCredentials before we do this
nednguyen 2014/10/07 20:11:09 Done. But how does cloud_storage take care of rela
+ else:
+ self._credentials_path = None
# These attributes can be set dynamically by the page.
self.synthetic_delays = dict()
@@ -30,6 +38,10 @@ class Page(user_story.UserStory):
self.script_to_evaluate_on_commit = None
self._SchemeErrorCheck()
+ @property
+ def credentials_path(self):
+ return self._credentials_path
+
def _SchemeErrorCheck(self):
if not self._scheme:
raise ValueError('Must prepend the URL with scheme (e.g. file://)')
@@ -141,6 +153,10 @@ class Page(user_story.UserStory):
self._base_dir, parsed_url.netloc + parsed_url.path))
@property
+ def base_dir(self):
+ return self._base_dir
+
+ @property
def file_path_url(self):
"""Returns the file path, including the params, query, and fragment."""
assert self.is_file

Powered by Google App Engine
This is Rietveld 408576698