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

Side by Side Diff: tools/telemetry/telemetry/internal/actions/action_runner_unittest.py

Issue 1428733002: Update telemetry tests to be agnostic to ScrollTopLeftInterop mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/internal/actions/scroll.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import unittest 4 import unittest
5 5
6 from telemetry.core import exceptions 6 from telemetry.core import exceptions
7 from telemetry import decorators 7 from telemetry import decorators
8 from telemetry.internal.actions import page_action 8 from telemetry.internal.actions import page_action
9 from telemetry.page import action_runner as action_runner_module 9 from telemetry.page import action_runner as action_runner_module
10 from telemetry.testing import tab_test_case 10 from telemetry.testing import tab_test_case
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 self.assertTrue(action_runner.EvaluateJavaScript( 222 self.assertTrue(action_runner.EvaluateJavaScript(
223 'document.querySelector("#left-right").scrollLeft') > 75) 223 'document.querySelector("#left-right").scrollLeft') > 75)
224 action_runner.ScrollElement( 224 action_runner.ScrollElement(
225 selector='#top-bottom', direction='down', top_start_ratio=0.9) 225 selector='#top-bottom', direction='down', top_start_ratio=0.9)
226 self.assertTrue(action_runner.EvaluateJavaScript( 226 self.assertTrue(action_runner.EvaluateJavaScript(
227 'document.querySelector("#top-bottom").scrollTop') > 75) 227 'document.querySelector("#top-bottom").scrollTop') > 75)
228 228
229 action_runner.ScrollPage(direction='right', left_start_ratio=0.9, 229 action_runner.ScrollPage(direction='right', left_start_ratio=0.9,
230 distance=100) 230 distance=100)
231 self.assertTrue(action_runner.EvaluateJavaScript( 231 self.assertTrue(action_runner.EvaluateJavaScript(
232 'document.body.scrollLeft') > 75) 232 'document.scrollingElement.scrollLeft') > 75)
233 233
234 @decorators.Disabled('android', # crbug.com/437065. 234 @decorators.Disabled('android', # crbug.com/437065.
235 'chromeos') # crbug.com/483212. 235 'chromeos') # crbug.com/483212.
236 def testSwipe(self): 236 def testSwipe(self):
237 if not page_action.IsGestureSourceTypeSupported( 237 if not page_action.IsGestureSourceTypeSupported(
238 self._tab, 'touch'): 238 self._tab, 'touch'):
239 return 239 return
240 240
241 self.Navigate('page_with_swipeables.html') 241 self.Navigate('page_with_swipeables.html')
242 action_runner = action_runner_module.ActionRunner(self._tab, 242 action_runner = action_runner_module.ActionRunner(self._tab,
243 skip_waits=True) 243 skip_waits=True)
244 244
245 action_runner.SwipeElement( 245 action_runner.SwipeElement(
246 selector='#left-right', direction='left', left_start_ratio=0.9) 246 selector='#left-right', direction='left', left_start_ratio=0.9)
247 self.assertTrue(action_runner.EvaluateJavaScript( 247 self.assertTrue(action_runner.EvaluateJavaScript(
248 'document.querySelector("#left-right").scrollLeft') > 75) 248 'document.querySelector("#left-right").scrollLeft') > 75)
249 action_runner.SwipeElement( 249 action_runner.SwipeElement(
250 selector='#top-bottom', direction='up', top_start_ratio=0.9) 250 selector='#top-bottom', direction='up', top_start_ratio=0.9)
251 self.assertTrue(action_runner.EvaluateJavaScript( 251 self.assertTrue(action_runner.EvaluateJavaScript(
252 'document.querySelector("#top-bottom").scrollTop') > 75) 252 'document.querySelector("#top-bottom").scrollTop') > 75)
253 253
254 action_runner.SwipePage(direction='left', left_start_ratio=0.9) 254 action_runner.SwipePage(direction='left', left_start_ratio=0.9)
255 self.assertTrue(action_runner.EvaluateJavaScript( 255 self.assertTrue(action_runner.EvaluateJavaScript(
256 'document.body.scrollLeft') > 75) 256 'document.scrollingElement.scrollLeft') > 75)
257 257
258 258
259 class InteractionTest(unittest.TestCase): 259 class InteractionTest(unittest.TestCase):
260 260
261 def setUp(self): 261 def setUp(self):
262 self.mock_action_runner = mock.Mock(action_runner_module.ActionRunner) 262 self.mock_action_runner = mock.Mock(action_runner_module.ActionRunner)
263 263
264 def testIssuingInteractionRecordCommand(self): 264 def testIssuingInteractionRecordCommand(self):
265 with action_runner_module.Interaction( 265 with action_runner_module.Interaction(
266 self.mock_action_runner, label='ABC', flags=[]): 266 self.mock_action_runner, label='ABC', flags=[]):
(...skipping 11 matching lines...) Expand all
278 with self.assertRaises(FooException): 278 with self.assertRaises(FooException):
279 with action_runner_module.Interaction( 279 with action_runner_module.Interaction(
280 self.mock_action_runner, label='ABC', flags=[]): 280 self.mock_action_runner, label='ABC', flags=[]):
281 raise FooException() 281 raise FooException()
282 282
283 # Test that the end console.timeEnd(...) isn't called because exception was 283 # Test that the end console.timeEnd(...) isn't called because exception was
284 # raised. 284 # raised.
285 expected_calls = [ 285 expected_calls = [
286 mock.call.ExecuteJavaScript('console.time("Interaction.ABC");')] 286 mock.call.ExecuteJavaScript('console.time("Interaction.ABC");')]
287 self.assertEqual(expected_calls, self.mock_action_runner.mock_calls) 287 self.assertEqual(expected_calls, self.mock_action_runner.mock_calls)
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/telemetry/internal/actions/scroll.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698