| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2016 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 |
| 5 import logging |
| 6 |
| 7 from core import perf_benchmark |
| 8 from telemetry import story |
| 9 from telemetry.page import page |
| 10 |
| 11 |
| 12 class TestTapStory(page.Page): |
| 13 |
| 14 def __init__(self, story_set): |
| 15 super(TestTapStory, self).__init__(url='file://test_tap/test_tap.html', |
| 16 page_set=story_set) |
| 17 |
| 18 def _PrintState(self, action_runner, label): |
| 19 logging.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> BEGIN %s ' |
| 20 '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<', label) |
| 21 triggered_handlers = action_runner.EvaluateJavaScript('triggeredHandlers') |
| 22 logging.info('Triggered handlers: %s', triggered_handlers) |
| 23 action_runner.tab.browser.DumpStateUponFailure() |
| 24 logging.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END %s ' |
| 25 '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<', label) |
| 26 |
| 27 |
| 28 def RunPageInteractions(self, action_runner): |
| 29 logging.getLogger().setLevel(logging.INFO) |
| 30 |
| 31 action_runner.WaitForJavaScriptCondition('handlersInitialized') |
| 32 self._PrintState(action_runner, 'start') |
| 33 |
| 34 action_runner.TapElement('#test') |
| 35 self._PrintState(action_runner, 'immediately after tap') |
| 36 action_runner.Wait(5) |
| 37 self._PrintState(action_runner, '5 seconds after tap') |
| 38 |
| 39 action_runner.ClickElement('#test') |
| 40 self._PrintState(action_runner, 'immediately after click') |
| 41 action_runner.Wait(5) |
| 42 self._PrintState(action_runner, '5 seconds after click') |
| 43 |
| 44 raise Exception('Intentional exception to dump browser state') |
| 45 |
| 46 |
| 47 class TestTapStorySet(story.StorySet): |
| 48 |
| 49 def __init__(self): |
| 50 super(TestTapStorySet, self).__init__() |
| 51 self.AddStory(TestTapStory(self)) |
| 52 |
| 53 |
| 54 class TestTapBenchmark(perf_benchmark.PerfBenchmark): |
| 55 |
| 56 page_set = TestTapStorySet |
| 57 |
| 58 def SetExtraBrowserOptions(self, options): |
| 59 options.logging_verbosity = 'non-verbose' |
| 60 |
| 61 @classmethod |
| 62 def Name(cls): |
| 63 return 'test_tap' |
| OLD | NEW |