OLD | NEW |
| (Empty) |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 from telemetry.core.backends.chrome import tracing_backend | |
5 from telemetry.core.timeline import model | |
6 from telemetry.page.actions import action_runner as action_runner_module | |
7 from telemetry.unittest import tab_test_case | |
8 from telemetry.web_perf import timeline_interaction_record as tir_module | |
9 | |
10 | |
11 class ActionRunnerTest(tab_test_case.TabTestCase): | |
12 def testIssuingInteractionRecord(self): | |
13 self.Navigate('blank.html') | |
14 action_runner = action_runner_module.ActionRunner(None, self._tab) | |
15 self._browser.StartTracing(tracing_backend.MINIMAL_TRACE_CATEGORIES) | |
16 action_runner.BeginInteraction('TestInteraction', [tir_module.IS_SMOOTH]) | |
17 action_runner.EndInteraction('TestInteraction', [tir_module.IS_SMOOTH]) | |
18 trace_data = self._browser.StopTracing() | |
19 timeline_model = model.TimelineModel(trace_data) | |
20 | |
21 records = [] | |
22 renderer_thread = timeline_model.GetRendererThreadFromTab(self._tab) | |
23 for event in renderer_thread.async_slices: | |
24 if not tir_module.IsTimelineInteractionRecord(event.name): | |
25 continue | |
26 records.append(tir_module.TimelineInteractionRecord.FromEvent(event)) | |
27 self.assertEqual(1, len(records), | |
28 'Fail to issue the interaction record on tracing timeline.' | |
29 ' Trace data:\n%s' % repr(trace_data.EventData())) | |
30 self.assertEqual('TestInteraction', records[0].logical_name) | |
31 self.assertTrue(records[0].is_smooth) | |
OLD | NEW |