| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 logging | 5 import logging |
| 6 | 6 |
| 7 from page_sets.login_helpers import dropbox_login | 7 from page_sets.login_helpers import dropbox_login |
| 8 from page_sets.login_helpers import google_login | 8 from page_sets.login_helpers import google_login |
| 9 | 9 |
| 10 from telemetry import story | 10 from telemetry import story |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 class _LoadCase(page_module.Page): | 287 class _LoadCase(page_module.Page): |
| 288 """Generic System Health user story that loads a page and measures memory.""" | 288 """Generic System Health user story that loads a page and measures memory.""" |
| 289 | 289 |
| 290 def __init__(self, story_set, group, url, page_spec): | 290 def __init__(self, story_set, group, url, page_spec): |
| 291 # For example, the name of the story for the |page_spec| with name | 291 # For example, the name of the story for the |page_spec| with name |
| 292 # 'example' from the 'sample' URL |group| will be 'load:sample:example'. | 292 # 'example' from the 'sample' URL |group| will be 'load:sample:example'. |
| 293 name = 'load:%s:%s' % (group, page_spec.name) | 293 name = 'load:%s:%s' % (group, page_spec.name) |
| 294 super(_LoadCase, self).__init__( | 294 super(_LoadCase, self).__init__( |
| 295 page_set=story_set, name=name, url=url, | 295 page_set=story_set, name=name, url=url, |
| 296 credentials_path='data/credentials.json', | 296 credentials_path='../data/credentials.json', |
| 297 grouping_keys={'case': 'load', 'group': group}) | 297 grouping_keys={'case': 'load', 'group': group}) |
| 298 self._page_spec = page_spec | 298 self._page_spec = page_spec |
| 299 | 299 |
| 300 @property | 300 @property |
| 301 def platform(self): | 301 def platform(self): |
| 302 return self.story_set.PLATFORM | 302 return self.story_set.PLATFORM |
| 303 | 303 |
| 304 def _TakeMemoryMeasurement(self, action_runner): | 304 def _TakeMemoryMeasurement(self, action_runner): |
| 305 # TODO(petrcermak): This method is essentially the same as | 305 # TODO(petrcermak): This method is essentially the same as |
| 306 # MemoryHealthPage._TakeMemoryMeasurement() in memory_health_story.py. | 306 # MemoryHealthPage._TakeMemoryMeasurement() in memory_health_story.py. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 328 | 328 |
| 329 class _MemorySystemHealthStorySet(story.StorySet): | 329 class _MemorySystemHealthStorySet(story.StorySet): |
| 330 """User stories for the System Health Plan. | 330 """User stories for the System Health Plan. |
| 331 | 331 |
| 332 See https://goo.gl/Jek2NL. | 332 See https://goo.gl/Jek2NL. |
| 333 """ | 333 """ |
| 334 PLATFORM = NotImplemented | 334 PLATFORM = NotImplemented |
| 335 | 335 |
| 336 def __init__(self): | 336 def __init__(self): |
| 337 super(_MemorySystemHealthStorySet, self).__init__( | 337 super(_MemorySystemHealthStorySet, self).__init__( |
| 338 archive_data_file='data/memory_system_health_%s.json' % self.PLATFORM, | 338 archive_data_file=('../data/memory_system_health_%s.json' % |
| 339 self.PLATFORM), |
| 339 cloud_storage_bucket=story.PARTNER_BUCKET) | 340 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 340 | 341 |
| 341 for group_name, page_specs in _SINGLE_PAGE_SPECS.iteritems(): | 342 for group_name, page_specs in _SINGLE_PAGE_SPECS.iteritems(): |
| 342 for page_spec in page_specs: | 343 for page_spec in page_specs: |
| 343 url = page_spec.url | 344 url = page_spec.url |
| 344 if isinstance(url, dict): | 345 if isinstance(url, dict): |
| 345 url = url.get(self.PLATFORM) | 346 url = url.get(self.PLATFORM) |
| 346 if url is None: | 347 if url is None: |
| 347 continue # URL not supported on the platform. | 348 continue # URL not supported on the platform. |
| 348 self.AddStory(_LoadCase(self, group_name, url, page_spec)) | 349 self.AddStory(_LoadCase(self, group_name, url, page_spec)) |
| 349 | 350 |
| 350 | 351 |
| 351 class DesktopMemorySystemHealthStorySet(_MemorySystemHealthStorySet): | 352 class DesktopMemorySystemHealthStorySet(_MemorySystemHealthStorySet): |
| 352 """Desktop user stories for Chrome Memory System Health Plan.""" | 353 """Desktop user stories for Chrome Memory System Health Plan.""" |
| 353 PLATFORM = 'desktop' | 354 PLATFORM = 'desktop' |
| 354 | 355 |
| 355 | 356 |
| 356 class MobileMemorySystemHealthStorySet(_MemorySystemHealthStorySet): | 357 class MobileMemorySystemHealthStorySet(_MemorySystemHealthStorySet): |
| 357 """Mobile user stories for Chrome Memory System Health Plan.""" | 358 """Mobile user stories for Chrome Memory System Health Plan.""" |
| 358 PLATFORM = 'mobile' | 359 PLATFORM = 'mobile' |
| OLD | NEW |