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

Unified Diff: tools/telemetry/telemetry/page/actions/action_runner_unittest.py

Issue 299443017: Add unittests for action_runner.BeginInteraction and action_runner.EndInteraction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/actions/action_runner_unittest.py
diff --git a/tools/telemetry/telemetry/page/actions/action_runner_unittest.py b/tools/telemetry/telemetry/page/actions/action_runner_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..71980709cf86ca6a46682af504864617b216f1a3
--- /dev/null
+++ b/tools/telemetry/telemetry/page/actions/action_runner_unittest.py
@@ -0,0 +1,34 @@
+# Copyright (c) 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+from telemetry.core.backends.chrome import tracing_backend
+from telemetry.core.timeline import model
+from telemetry.page.actions import action_runner as action_runner_module
+# pylint: disable=W0401,W0614
+from telemetry.page.actions.all_page_actions import *
+from telemetry.unittest import tab_test_case
+from telemetry.web_perf import timeline_interaction_record as tir_module
+
+
+class ActionRunnerTest(tab_test_case.TabTestCase):
+ def testIssuingInteractionRecord(self):
+ action_runner = action_runner_module.ActionRunner(self._tab)
+ self.Navigate('interaction_enabled_page.html')
+ action_runner.RunAction(WaitAction({'seconds': 1}))
+ self._browser.StartTracing(tracing_backend.DEFAULT_TRACE_CATEGORIES)
+ action_runner.BeginInteraction('TestInteraction', [tir_module.IS_SMOOTH])
+ action_runner.EndInteraction('TestInteraction', [tir_module.IS_SMOOTH])
+ trace_data = self._browser.StopTracing()
+ timeline_model = model.TimelineModel(trace_data)
+
+ records = []
+ renderer_thread = timeline_model.GetRendererThreadFromTab(self._tab)
+ for event in renderer_thread.async_slices:
+ if not tir_module.IsTimelineInteractionRecord(event.name):
+ continue
+ records.append(tir_module.TimelineInteractionRecord.FromEvent(event))
+ self.assertEqual(1, len(records),
+ 'Fail to issue the interaction record on tracing timeline.'
+ ' Trace data:\n%s' % repr(trace_data.EventData()))
+ self.assertEqual('TestInteraction', records[0].logical_name)
+ self.assertTrue(records[0].is_smooth)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698