from telemetry import test

from perf_tools import page_cycler


class NetsimTop25(test.Test):
  """Measures load time of the top 25 sites under simulated cable network."""
  test = page_cycler.PageCycler
  test.clear_cache_before_each_run = True
  page_set = 'tools/perf/page_sets/top_25.json'
  options = {
    'extra_wpr_args': [
      '--shaping_type=proxy',
      '--net=cable'
      ],
    'pageset_repeat': '5',
    }

from telemetry import test

from perf_tools import page_cycler


class NetsimTop25(test.Test):
  """Measures load time of the top 25 sites under simulated cable network."""
  test = page_cycler.PageCycler
  page_set = 'tools/perf/page_sets/top_25.json'
  options = {
    'extra_wpr_args': [
      '--shaping_type=proxy',
      '--net=cable'
      ],
    'pageset_repeat': '5',
    }

  def __init__(self):
    super(NetsimTop25, self).__init__()
    self.test.clear_cache_before_each_run = True

Fix bug which caused page cyclers to always clear cache before load.
[Telemetry] Fix bug which caused page cyclers to always clear cache before load.

Previously, the cache clearing bit would apply when the netsim benchmark was
imported. This fixes it so that it only applies when it is used.

BUG=256492
NOTRY=True
TBR=dtu@chromium.org

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

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@209708 0039d316-1c4b-4281-b951-d872f2087c98

  from telemetry import test
  
  from perf_tools import page_cycler
  
  
  class NetsimTop25(test.Test):
    """Measures load time of the top 25 sites under simulated cable network."""
    test = page_cycler.PageCycler
-   test.clear_cache_before_each_run = True
    page_set = 'tools/perf/page_sets/top_25.json'
    options = {
      'extra_wpr_args': [
        '--shaping_type=proxy',
        '--net=cable'
        ],
      'pageset_repeat': '5',
      }
  
+   def __init__(self):
+     super(NetsimTop25, self).__init__()
+     self.test.clear_cache_before_each_run = True
+ 
Fix bug which caused page cyclers to always clear cache before load.
## Code Before:
from telemetry import test

from perf_tools import page_cycler


class NetsimTop25(test.Test):
  """Measures load time of the top 25 sites under simulated cable network."""
  test = page_cycler.PageCycler
  test.clear_cache_before_each_run = True
  page_set = 'tools/perf/page_sets/top_25.json'
  options = {
    'extra_wpr_args': [
      '--shaping_type=proxy',
      '--net=cable'
      ],
    'pageset_repeat': '5',
    }

## Instruction:
Fix bug which caused page cyclers to always clear cache before load.
## Code After:
from telemetry import test

from perf_tools import page_cycler


class NetsimTop25(test.Test):
  """Measures load time of the top 25 sites under simulated cable network."""
  test = page_cycler.PageCycler
  page_set = 'tools/perf/page_sets/top_25.json'
  options = {
    'extra_wpr_args': [
      '--shaping_type=proxy',
      '--net=cable'
      ],
    'pageset_repeat': '5',
    }

  def __init__(self):
    super(NetsimTop25, self).__init__()
    self.test.clear_cache_before_each_run = True
