OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from telemetry import decorators | 5 from telemetry import decorators |
6 from telemetry.core import exceptions | 6 from telemetry.core import exceptions |
7 from telemetry.core import util | 7 from telemetry.core import util |
8 from telemetry.core.platform import tracing_category_filter | 8 from telemetry.core.platform import tracing_category_filter |
9 from telemetry.core.platform import tracing_options | 9 from telemetry.core.platform import tracing_options |
10 from telemetry.page.actions import action_runner as action_runner_module | 10 from telemetry.page.actions import action_runner as action_runner_module |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 1, len(records), | 44 1, len(records), |
45 'Failed to issue the interaction record on the tracing timeline.' | 45 'Failed to issue the interaction record on the tracing timeline.' |
46 ' Trace data:\n%s' % repr(trace_data._raw_data)) | 46 ' Trace data:\n%s' % repr(trace_data._raw_data)) |
47 self.assertEqual('InteractionName', records[0].label) | 47 self.assertEqual('InteractionName', records[0].label) |
48 for attribute_name in interaction_kwargs: | 48 for attribute_name in interaction_kwargs: |
49 self.assertTrue(getattr(records[0], attribute_name)) | 49 self.assertTrue(getattr(records[0], attribute_name)) |
50 | 50 |
51 # Test disabled for android: crbug.com/437057 | 51 # Test disabled for android: crbug.com/437057 |
52 @decorators.Disabled('android', 'chromeos') | 52 @decorators.Disabled('android', 'chromeos') |
53 def testIssuingMultipleMeasurementInteractionRecords(self): | 53 def testIssuingMultipleMeasurementInteractionRecords(self): |
54 self.VerifyIssuingInteractionRecords(is_fast=True) | |
55 self.VerifyIssuingInteractionRecords(is_responsive=True) | 54 self.VerifyIssuingInteractionRecords(is_responsive=True) |
56 self.VerifyIssuingInteractionRecords(is_smooth=True) | 55 self.VerifyIssuingInteractionRecords(is_smooth=True) |
57 self.VerifyIssuingInteractionRecords(is_fast=True, is_smooth=True) | 56 self.VerifyIssuingInteractionRecords(is_responsive=True, is_smooth=True) |
58 | 57 |
59 | 58 |
60 class ActionRunnerTest(tab_test_case.TabTestCase): | 59 class ActionRunnerTest(tab_test_case.TabTestCase): |
61 def testExecuteJavaScript(self): | 60 def testExecuteJavaScript(self): |
62 action_runner = action_runner_module.ActionRunner(self._tab, | 61 action_runner = action_runner_module.ActionRunner(self._tab, |
63 skip_waits=True) | 62 skip_waits=True) |
64 self.Navigate('blank.html') | 63 self.Navigate('blank.html') |
65 action_runner.ExecuteJavaScript('var testing = 42;') | 64 action_runner.ExecuteJavaScript('var testing = 42;') |
66 self.assertEqual(42, self._tab.EvaluateJavaScript('testing')) | 65 self.assertEqual(42, self._tab.EvaluateJavaScript('testing')) |
67 | 66 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 self.assertTrue(action_runner.EvaluateJavaScript( | 244 self.assertTrue(action_runner.EvaluateJavaScript( |
246 'document.querySelector("#left-right").scrollLeft') > 75) | 245 'document.querySelector("#left-right").scrollLeft') > 75) |
247 action_runner.SwipeElement( | 246 action_runner.SwipeElement( |
248 selector='#top-bottom', direction='up', top_start_ratio=0.9) | 247 selector='#top-bottom', direction='up', top_start_ratio=0.9) |
249 self.assertTrue(action_runner.EvaluateJavaScript( | 248 self.assertTrue(action_runner.EvaluateJavaScript( |
250 'document.querySelector("#top-bottom").scrollTop') > 75) | 249 'document.querySelector("#top-bottom").scrollTop') > 75) |
251 | 250 |
252 action_runner.SwipePage(direction='left', left_start_ratio=0.9) | 251 action_runner.SwipePage(direction='left', left_start_ratio=0.9) |
253 self.assertTrue(action_runner.EvaluateJavaScript( | 252 self.assertTrue(action_runner.EvaluateJavaScript( |
254 'document.body.scrollLeft') > 75) | 253 'document.body.scrollLeft') > 75) |
OLD | NEW |