
from telemetry.page import page as page
from telemetry.page import page_set as page_set


archive_data_file_path = 'data/service_worker.json'


class ServiceWorkerPageSet(page_set.PageSet):
  """Page set of applications using ServiceWorker"""

  def __init__(self):
    super(ServiceWorkerPageSet, self).__init__(
        archive_data_file=archive_data_file_path,
        bucket=page_set.PARTNER_BUCKET)

    # Why: the first application using ServiceWorker
    # 1st time: registration
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        make_javascript_deterministic=False))
    # 2st time: 1st onfetch with caching
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        make_javascript_deterministic=False))
    # 3rd time: 2nd onfetch from cache
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        make_javascript_deterministic=False))


from telemetry.page import page as page
from telemetry.page import page_set as page_set


archive_data_file_path = 'data/service_worker.json'


class ServiceWorkerPageSet(page_set.PageSet):
  """Page set of applications using ServiceWorker"""

  def __init__(self):
    super(ServiceWorkerPageSet, self).__init__(
        archive_data_file=archive_data_file_path,
        bucket=page_set.PARTNER_BUCKET)

    # Why: the first application using ServiceWorker
    # 1st time: registration
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        name='first_load', make_javascript_deterministic=False))
    # 2st time: 1st onfetch with caching
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        name='second_load', make_javascript_deterministic=False))
    # 3rd time: 2nd onfetch from cache
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        name='third_load', make_javascript_deterministic=False))

Add name attribute to each Page in ServiceWorkerPageSet
Telemetry: Add name attribute to each Page in ServiceWorkerPageSet

ServiceWorkerPerfTest loads the same page three times, but these should
have different characteristics because ServiceWorker works differently.
This patch gives each page load a name so we can track them separately.

BUG=
TEST=tools/perf/run_benchmark service_worker.service_worker

Review URL: https://codereview.chromium.org/1086813003

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#325802}

  
  from telemetry.page import page as page
  from telemetry.page import page_set as page_set
  
  
  archive_data_file_path = 'data/service_worker.json'
  
  
  class ServiceWorkerPageSet(page_set.PageSet):
    """Page set of applications using ServiceWorker"""
  
    def __init__(self):
      super(ServiceWorkerPageSet, self).__init__(
          archive_data_file=archive_data_file_path,
          bucket=page_set.PARTNER_BUCKET)
  
      # Why: the first application using ServiceWorker
      # 1st time: registration
      self.AddUserStory(page.Page(
          'https://jakearchibald.github.io/trained-to-thrill/', self,
-         make_javascript_deterministic=False))
+         name='first_load', make_javascript_deterministic=False))
      # 2st time: 1st onfetch with caching
      self.AddUserStory(page.Page(
          'https://jakearchibald.github.io/trained-to-thrill/', self,
-         make_javascript_deterministic=False))
+         name='second_load', make_javascript_deterministic=False))
      # 3rd time: 2nd onfetch from cache
      self.AddUserStory(page.Page(
          'https://jakearchibald.github.io/trained-to-thrill/', self,
-         make_javascript_deterministic=False))
+         name='third_load', make_javascript_deterministic=False))
  
Add name attribute to each Page in ServiceWorkerPageSet
## Code Before:

from telemetry.page import page as page
from telemetry.page import page_set as page_set


archive_data_file_path = 'data/service_worker.json'


class ServiceWorkerPageSet(page_set.PageSet):
  """Page set of applications using ServiceWorker"""

  def __init__(self):
    super(ServiceWorkerPageSet, self).__init__(
        archive_data_file=archive_data_file_path,
        bucket=page_set.PARTNER_BUCKET)

    # Why: the first application using ServiceWorker
    # 1st time: registration
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        make_javascript_deterministic=False))
    # 2st time: 1st onfetch with caching
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        make_javascript_deterministic=False))
    # 3rd time: 2nd onfetch from cache
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        make_javascript_deterministic=False))

## Instruction:
Add name attribute to each Page in ServiceWorkerPageSet
## Code After:

from telemetry.page import page as page
from telemetry.page import page_set as page_set


archive_data_file_path = 'data/service_worker.json'


class ServiceWorkerPageSet(page_set.PageSet):
  """Page set of applications using ServiceWorker"""

  def __init__(self):
    super(ServiceWorkerPageSet, self).__init__(
        archive_data_file=archive_data_file_path,
        bucket=page_set.PARTNER_BUCKET)

    # Why: the first application using ServiceWorker
    # 1st time: registration
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        name='first_load', make_javascript_deterministic=False))
    # 2st time: 1st onfetch with caching
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        name='second_load', make_javascript_deterministic=False))
    # 3rd time: 2nd onfetch from cache
    self.AddUserStory(page.Page(
        'https://jakearchibald.github.io/trained-to-thrill/', self,
        name='third_load', make_javascript_deterministic=False))
