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

Unified Diff: telemetry/telemetry/internal/story_runner_unittest.py

Issue 2777673003: Revert of Track telemetry benchmark cycle time (Closed)
Patch Set: Created 3 years, 9 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 | « telemetry/telemetry/internal/story_runner.py ('k') | telemetry/telemetry/testing/fakes/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/internal/story_runner_unittest.py
diff --git a/telemetry/telemetry/internal/story_runner_unittest.py b/telemetry/telemetry/internal/story_runner_unittest.py
index 822092f611d7e69093c65d0cd35c090409d44460..44523ba48abb358485fab1cc44991aecbd2abc5b 100644
--- a/telemetry/telemetry/internal/story_runner_unittest.py
+++ b/telemetry/telemetry/internal/story_runner_unittest.py
@@ -2,13 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import json
import math
import os
-import shutil
import StringIO
import sys
-import tempfile
import unittest
from py_utils import cloud_storage # pylint: disable=import-error
@@ -25,7 +22,6 @@
from telemetry.page import page as page_module
from telemetry.page import legacy_page_test
from telemetry import story as story_module
-from telemetry.testing import fakes
from telemetry.testing import options_for_unittests
from telemetry.testing import system_stub
import mock
@@ -44,6 +40,7 @@
# pylint: disable=too-many-lines
+
class FakePlatform(object):
def CanMonitorThermalThrottling(self):
return False
@@ -56,6 +53,7 @@
def GetDeviceTypeName(self):
return "GetDeviceTypeName"
+
class TestSharedState(story_module.SharedState):
@@ -152,16 +150,6 @@
story_set.AddStory(DummyLocalStory(story_state,
name='story%d' % i))
return story_set
-
-class FakeBenchmark(benchmark.Benchmark):
- @classmethod
- def Name(cls):
- return 'fake'
-
- test = DummyTest
-
- def page_set(self):
- return story_module.StorySet()
def _GetOptionForUnittest():
@@ -1048,36 +1036,3 @@
mock.call.state.DidRunStory(root_mock.results),
mock.call.test.DidRunStory(root_mock.state.platform)
])
-
- def testRunBenchmarkTimeDuration(self):
- fake_benchmark = FakeBenchmark()
- options = fakes.CreateBrowserFinderOptions()
- options.upload_results = None
- options.suppress_gtest_report = False
- options.results_label = None
- options.use_live_sites = False
- options.max_failures = 100
- options.pageset_repeat = 1
- options.output_formats = ['chartjson']
-
- with mock.patch('telemetry.internal.story_runner.time.time') as time_patch:
- # 3, because telemetry code asks for the time at some point
- time_patch.side_effect = [1, 0, 61]
- tmp_path = tempfile.mkdtemp()
-
- try:
- options.output_dir = tmp_path
- story_runner.RunBenchmark(fake_benchmark, options)
- with open(os.path.join(tmp_path, 'results-chart.json')) as f:
- data = json.load(f)
-
- self.assertEqual(len(data['charts']), 1)
- charts = data['charts']
- self.assertIn('BenchmarkDuration', charts)
- duration = charts['BenchmarkDuration']
- self.assertIn("summary", duration)
- summary = duration['summary']
- duration = summary['value']
- self.assertAlmostEqual(duration, 1)
- finally:
- shutil.rmtree(tmp_path)
« no previous file with comments | « telemetry/telemetry/internal/story_runner.py ('k') | telemetry/telemetry/testing/fakes/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698