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

Unified Diff: tools/telemetry/telemetry/unittest_util/page_set_smoke_test.py

Issue 1198823004: Update perf page_set to use story_set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « tools/telemetry/telemetry/page/__init__.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/unittest_util/page_set_smoke_test.py
diff --git a/tools/telemetry/telemetry/unittest_util/page_set_smoke_test.py b/tools/telemetry/telemetry/unittest_util/page_set_smoke_test.py
index 03489e7d9b288fe68e358aaf9eced847e8ca0444..90eedd65d4706cbe5777e9efc04cf628f9b3784e 100644
--- a/tools/telemetry/telemetry/unittest_util/page_set_smoke_test.py
+++ b/tools/telemetry/telemetry/unittest_util/page_set_smoke_test.py
@@ -6,9 +6,9 @@ import logging
import os
import unittest
+from telemetry import story
from telemetry.core import browser_credentials
from telemetry.core import discover
-from telemetry.page import page_set as page_set_module
from telemetry.wpr import archive_info
@@ -19,71 +19,61 @@ class PageSetSmokeTest(unittest.TestCase):
# message.
self.longMessage = True
- def CheckArchive(self, page_set):
- """Verify that all URLs of pages in page_set have an associated archive. """
+ def CheckArchive(self, story_set):
+ """Verify that all URLs of pages in story_set have an associated archive. """
# TODO: Eventually these should be fatal.
- if not page_set.archive_data_file:
- logging.warning('Skipping %s: no archive data file', page_set.file_path)
+ if not story_set.archive_data_file:
+ logging.warning('Skipping %s: no archive data file', story_set.file_path)
return
- logging.info('Testing %s', page_set.file_path)
+ logging.info('Testing %s', story_set.file_path)
- archive_data_file_path = os.path.join(page_set.base_dir,
- page_set.archive_data_file)
+ archive_data_file_path = os.path.join(story_set.base_dir,
+ story_set.archive_data_file)
self.assertTrue(os.path.exists(archive_data_file_path),
msg='Archive data file not found for %s' %
- page_set.file_path)
+ story_set.file_path)
wpr_archive_info = archive_info.WprArchiveInfo.FromFile(
- archive_data_file_path, page_set.bucket)
- for page in page_set.pages:
+ archive_data_file_path, story_set.bucket)
+ for page in story_set.user_stories:
if not page.url.startswith('http'):
continue
self.assertTrue(wpr_archive_info.WprFilePathForUserStory(page),
msg='No archive found for %s in %s' % (
- page.url, page_set.archive_data_file))
+ page.url, story_set.archive_data_file))
- def CheckCredentials(self, page_set):
- """Verify that all pages in page_set use proper credentials"""
- for page in page_set.pages:
+ def CheckCredentials(self, story_set):
+ """Verify that all pages in story_set use proper credentials"""
+ for page in story_set.user_stories:
credentials = browser_credentials.BrowserCredentials()
if page.credentials_path:
credentials.credentials_path = (
os.path.join(page.base_dir, page.credentials_path))
fail_message = ('page %s of %s has invalid credentials %s' %
- (page.url, page_set.file_path, page.credentials))
+ (page.url, story_set.file_path, page.credentials))
if page.credentials:
try:
self.assertTrue(credentials.CanLogin(page.credentials), fail_message)
except browser_credentials.CredentialsError:
self.fail(fail_message)
- def CheckAttributes(self, page_set):
- """Verify that page_set and its page's base attributes have the right types.
+ def CheckAttributes(self, story_set):
+ """Verify that story_set and its page's base attributes have the right types.
"""
- self.CheckAttributesOfPageSetBasicAttributes(page_set)
- for page in page_set.pages:
+ self.CheckAttributesOfPageSetBasicAttributes(story_set)
+ for page in story_set.user_stories:
self.CheckAttributesOfPageBasicAttributes(page)
- def CheckAttributesOfPageSetBasicAttributes(self, page_set):
- if page_set.base_dir is not None:
+ def CheckAttributesOfPageSetBasicAttributes(self, story_set):
+ if story_set.base_dir is not None:
self.assertTrue(
- isinstance(page_set.base_dir, str),
- msg='page_set %\'s base_dir must have type string')
-
- self.assertIsNone(
- page_set.user_agent_type,
- msg='page_set %s has non None user_agent_type. '
- 'The user_agent_type field is deprecated (crbug.com/439512)' % page_set)
+ isinstance(story_set.base_dir, str),
+ msg='story_set %\'s base_dir must have type string')
self.assertTrue(
- isinstance(page_set.archive_data_file, str),
- msg='page_set\'s archive_data_file path must have type string')
-
- if page_set.user_agent_type is not None:
- self.assertTrue(
- isinstance(page_set.user_agent_type, str),
- msg='page_set\'s user_agent_type must have type string')
+ isinstance(story_set.archive_data_file, str),
+ msg='story_set\'s archive_data_file path must have type string')
def CheckAttributesOfPageBasicAttributes(self, page):
self.assertTrue(not hasattr(page, 'disabled'))
@@ -93,9 +83,9 @@ class PageSetSmokeTest(unittest.TestCase):
isinstance(page.url, basestring),
msg='page %s \'s url must have type string' % page.display_name)
self.assertTrue(
- isinstance(page.page_set, page_set_module.PageSet),
- msg='page %s \'s page_set must be an instance of '
- 'telemetry.page.page_set.PageSet' % page.display_name)
+ isinstance(page.story_set, story.StorySet),
+ msg='page %s \'s story_set must be an instance of '
+ 'telemetry.page.story_set.user_storieset' % page.display_name)
self.assertTrue(
isinstance(page.name, str),
msg='page %s \'s name field must have type string' % page.display_name)
@@ -116,18 +106,18 @@ class PageSetSmokeTest(unittest.TestCase):
msg='label %s in page %s \'s labels must have type string'
% (str(l), page.display_name))
- def CheckSharedStates(self, page_set):
- if not page_set.allow_mixed_story_states:
+ def CheckSharedStates(self, story_set):
+ if not story_set.allow_mixed_story_states:
shared_state_class = (
- page_set.user_stories[0].shared_state_class)
- for p in page_set:
+ story_set.user_stories[0].shared_state_class)
+ for p in story_set:
self.assertIs(
shared_state_class,
p.shared_state_class,
msg='page %s\'s shared_state_class field is different '
'from other pages\'s shared_state_class whereas '
'page set %s disallow having mixed states' %
- (p, page_set))
+ (p, story_set))
def RunSmokeTest(self, page_sets_dir, top_level_dir):
"""Run smoke test on all page sets in page_sets_dir.
@@ -138,12 +128,12 @@ class PageSetSmokeTest(unittest.TestCase):
# We can't test page sets that aren't directly constructable since we
# don't know what arguments to put for the constructor.
page_sets = discover.DiscoverClasses(page_sets_dir, top_level_dir,
- page_set_module.PageSet,
+ story.StorySet,
directly_constructable=True).values()
for page_set_class in page_sets:
- page_set = page_set_class()
- logging.info('Testing %s', page_set.file_path)
- self.CheckArchive(page_set)
- self.CheckCredentials(page_set)
- self.CheckAttributes(page_set)
- self.CheckSharedStates(page_set)
+ story_set = page_set_class()
+ logging.info('Testing %s', story_set.file_path)
+ self.CheckArchive(story_set)
+ self.CheckCredentials(story_set)
+ self.CheckAttributes(story_set)
+ self.CheckSharedStates(story_set)
« no previous file with comments | « tools/telemetry/telemetry/page/__init__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698