summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authornednguyen <nednguyen@google.com>2015-08-31 15:05:59 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-31 22:06:41 +0000
commitd629281b0d88da8c13a49769b9f8c129698998f8 (patch)
treec0790e51cddf3929b3e63fcfd21aa65279725a2d /content
parentd4f1feb7c65bb7a4406b6183664da081795cb2db (diff)
downloadchromium_src-d629281b0d88da8c13a49769b9f8c129698998f8.zip
chromium_src-d629281b0d88da8c13a49769b9f8c129698998f8.tar.gz
chromium_src-d629281b0d88da8c13a49769b9f8c129698998f8.tar.bz2
[Telemetry] Always collect garbage on between telemetry page runs [Regressionable change]
*Perf sherrif: this change may regress the metrics but it's supposed to make the graphs more stable. BUG=495022 Review URL: https://codereview.chromium.org/1313693006 Cr-Commit-Position: refs/heads/master@{#346485}
Diffstat (limited to 'content')
-rw-r--r--content/test/gpu/gpu_tests/gpu_test_base.py3
-rw-r--r--content/test/gpu/gpu_tests/gpu_test_base_unittest.py28
2 files changed, 30 insertions, 1 deletions
diff --git a/content/test/gpu/gpu_tests/gpu_test_base.py b/content/test/gpu/gpu_tests/gpu_test_base.py
index e956707..1fa74dc 100644
--- a/content/test/gpu/gpu_tests/gpu_test_base.py
+++ b/content/test/gpu/gpu_tests/gpu_test_base.py
@@ -200,6 +200,9 @@ class PageBase(page_module.Page):
url=url, page_set=page_set, base_dir=base_dir, name=name,
shared_page_state_class=shared_page_state_class,
make_javascript_deterministic=make_javascript_deterministic)
+ # Disable automatic garbage collection to reduce the test's cycle time.
+ self._collect_garbage_before_run = False
+
# TODO(kbr): this is fragile -- if someone changes the
# shared_page_state_class to something that doesn't handle skip
# expectations, then they'll hit the exception in
diff --git a/content/test/gpu/gpu_tests/gpu_test_base_unittest.py b/content/test/gpu/gpu_tests/gpu_test_base_unittest.py
index 5fb39e2..ae81623 100644
--- a/content/test/gpu/gpu_tests/gpu_test_base_unittest.py
+++ b/content/test/gpu/gpu_tests/gpu_test_base_unittest.py
@@ -11,7 +11,6 @@ from telemetry.core import util
from telemetry.story import story_set as story_set_module
from telemetry.testing import fakes
-util.AddDirToPythonPath(util.GetTelemetryDir(), 'third_party', 'mock')
import mock # pylint: disable=import-error
import gpu_test_base
@@ -161,6 +160,18 @@ class PageWhichFailsNTimes(FakePage):
self._times_to_fail = self._times_to_fail - 1
raise Exception('Deliberate exception')
+class PageRunExecutionTest(unittest.TestCase):
+ def testNoGarbageCollectionCalls(self):
+ mock_shared_state = mock.Mock()
+ p = gpu_test_base.PageBase('file://foo.html')
+ p.Run(mock_shared_state)
+ expected = [mock.call.page_test.WillNavigateToPage(
+ p, mock_shared_state.current_tab),
+ mock.call.page_test.RunNavigateSteps(
+ p, mock_shared_state.current_tab),
+ mock.call.page_test.DidNavigateToPage(
+ p, mock_shared_state.current_tab)]
+ self.assertEquals(mock_shared_state.mock_calls, expected)
class PageExecutionTest(unittest.TestCase):
def setupTest(self, manager_mock=None):
@@ -181,6 +192,21 @@ class PageExecutionTest(unittest.TestCase):
test = testclass(manager_mock=manager_mock)
return test, finder_options
+ # Test page.Run() method is called by telemetry framework before
+ # ValidateAndMeasurePageInner.
+ def testPageRunMethodIsCalledBeforeValidateAndMeasurePage(self):
+ manager = mock.Mock()
+ test, finder_options = self.setupTest(manager)
+ page = FakePage(test, 'page1')
+ page.Run = manager.Run
+ test.AddFakePage(page)
+ self.assertEqual(test.Run(finder_options), 0,
+ 'Test should run with no errors')
+ expected = [mock.call.Run(mock.ANY),
+ mock.call.validator.ValidateAndMeasurePageInner(
+ page, mock.ANY, mock.ANY)]
+ self.assertEquals(manager.mock_calls, expected)
+
def testPassingPage(self):
manager = mock.Mock()
test, finder_options = self.setupTest(manager_mock=manager)