OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
5 from telemetry import story | 5 from telemetry import story |
6 | 6 |
7 | 7 |
8 class DummyPage(page_module.Page): | 8 class DummyPage(page_module.Page): |
9 | 9 |
10 def __init__(self, page_set): | 10 def __init__(self, page_set): |
11 super(DummyPage, self).__init__( | 11 super(DummyPage, self).__init__( |
12 url='file://dummy_page.html', | 12 url='file://dummy_page.html', |
13 page_set=page_set) | 13 page_set=page_set) |
14 | 14 |
15 def PerformPageInteractions(self, action_runner): | 15 def RunPageInteractions(self, action_runner): |
16 assert action_runner.EvaluateJavaScript('1 + window.__dummy_value') == 2 | 16 assert action_runner.EvaluateJavaScript('1 + window.__dummy_value') == 2 |
17 | 17 |
18 | 18 |
| 19 class BrokenDummyPage(page_module.Page): |
| 20 |
| 21 def __init__(self, page_set): |
| 22 super(BrokenDummyPage, self).__init__( |
| 23 url='file://dummy_page.html', |
| 24 name='Broken dummy page', |
| 25 page_set=page_set) |
| 26 |
| 27 def RunPageInteractions(self, action_runner): |
| 28 # The call below should raise an AssertionError |
| 29 assert action_runner.EvaluateJavaScript('1 + window.__dummy_value') == 3 |
| 30 |
| 31 |
19 class DummyStorySet(story.StorySet): | 32 class DummyStorySet(story.StorySet): |
20 | 33 |
21 def __init__(self): | 34 def __init__(self): |
22 super(DummyStorySet, self).__init__() | 35 super(DummyStorySet, self).__init__() |
23 self.AddStory(DummyPage(self)) | 36 self.AddStory(DummyPage(self)) |
OLD | NEW |