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

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

Issue 337603005: Rename telemetry.test.Test to telemetry.benchmark.Benchmark. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
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 4
5 from telemetry import test 5 from telemetry import benchmark
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.backends.chrome import tracing_backend 8 from telemetry.core.backends.chrome import tracing_backend
9 from telemetry.timeline import model 9 from telemetry.timeline import model
10 from telemetry.page.actions import gesture_action 10 from telemetry.page.actions import gesture_action
11 from telemetry.page.actions import action_runner as action_runner_module 11 from telemetry.page.actions import action_runner as action_runner_module
12 # pylint: disable=W0401,W0614 12 # pylint: disable=W0401,W0614
13 from telemetry.page.actions.all_page_actions import * 13 from telemetry.page.actions.all_page_actions import *
14 from telemetry.unittest import tab_test_case 14 from telemetry.unittest import tab_test_case
15 from telemetry.web_perf import timeline_interaction_record as tir_module 15 from telemetry.web_perf import timeline_interaction_record as tir_module
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 action_runner.ExecuteJavaScript('valueSettableByTest = 3;') 152 action_runner.ExecuteJavaScript('valueSettableByTest = 3;')
153 action_runner.ClickElement( 153 action_runner.ClickElement(
154 element_function='document.body.firstElementChild;') 154 element_function='document.body.firstElementChild;')
155 self.assertEqual(3, action_runner.EvaluateJavaScript('valueToTest')) 155 self.assertEqual(3, action_runner.EvaluateJavaScript('valueToTest'))
156 156
157 def WillFail(): 157 def WillFail():
158 action_runner.ClickElement('#notfound') 158 action_runner.ClickElement('#notfound')
159 self.assertRaises(exceptions.EvaluateException, WillFail) 159 self.assertRaises(exceptions.EvaluateException, WillFail)
160 160
161 @test.Disabled('debug') 161 @benchmark.Disabled('debug')
162 def testTapElement(self): 162 def testTapElement(self):
163 self.Navigate('page_with_clickables.html') 163 self.Navigate('page_with_clickables.html')
164 action_runner = action_runner_module.ActionRunner(self._tab) 164 action_runner = action_runner_module.ActionRunner(self._tab)
165 165
166 action_runner.ExecuteJavaScript('valueSettableByTest = 1;') 166 action_runner.ExecuteJavaScript('valueSettableByTest = 1;')
167 action_runner.TapElement('#test') 167 action_runner.TapElement('#test')
168 self.assertEqual(1, action_runner.EvaluateJavaScript('valueToTest')) 168 self.assertEqual(1, action_runner.EvaluateJavaScript('valueToTest'))
169 169
170 action_runner.ExecuteJavaScript('valueSettableByTest = 2;') 170 action_runner.ExecuteJavaScript('valueSettableByTest = 2;')
171 action_runner.TapElement(text='Click/tap me') 171 action_runner.TapElement(text='Click/tap me')
(...skipping 21 matching lines...) Expand all
193 self.assertTrue(action_runner.EvaluateJavaScript( 193 self.assertTrue(action_runner.EvaluateJavaScript(
194 'document.querySelector("#left-right").scrollLeft') > 75) 194 'document.querySelector("#left-right").scrollLeft') > 75)
195 action_runner.SwipeElement( 195 action_runner.SwipeElement(
196 selector='#top-bottom', direction='up', top_start_ratio=0.9) 196 selector='#top-bottom', direction='up', top_start_ratio=0.9)
197 self.assertTrue(action_runner.EvaluateJavaScript( 197 self.assertTrue(action_runner.EvaluateJavaScript(
198 'document.querySelector("#top-bottom").scrollTop') > 75) 198 'document.querySelector("#top-bottom").scrollTop') > 75)
199 199
200 action_runner.SwipePage(direction='left', left_start_ratio=0.9) 200 action_runner.SwipePage(direction='left', left_start_ratio=0.9)
201 self.assertTrue(action_runner.EvaluateJavaScript( 201 self.assertTrue(action_runner.EvaluateJavaScript(
202 'document.body.scrollLeft') > 75) 202 'document.body.scrollLeft') > 75)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698