Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2012 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 class InteractionNotSupported(Exception): | |
| 5 pass | |
| 6 | |
| 7 class InteractionFailed(Exception): | |
| 8 pass | |
| 9 | |
| 10 class Interaction(object): | |
| 11 """Represents an interaction that a user might try to perform to a page.""" | |
| 12 | |
| 13 def CustomizeBrowserOptions(self, options): | |
| 14 """Override to add test-specific options to the BrowserOptions object""" | |
| 15 pass | |
| 16 | |
| 17 def SupportedForPage(self, page, tab): | |
| 18 raise NotImplementedError() | |
| 19 | |
| 20 def PerformInteraction(self, page, tab, test): | |
| 21 raise NotImplementedError() | |
| 22 | |
| 23 def CleanUp(self, page, tab): | |
| 24 raise NotImplementedError() | |
| 25 | |
| 26 _interaction_classes = {} | |
|
tonyg
2012/11/02 18:57:34
nit: line break after this
| |
| 27 def GetAllClasses(): | |
| 28 return list(_interaction_classes.values()) | |
| 29 | |
| 30 def FindClassWithName(name): | |
| 31 return _interaction_classes.get(name) | |
| 32 | |
| 33 def RegisterClass(name, interaction_class): | |
| 34 assert name not in _interaction_classes | |
| 35 _interaction_classes[name] = interaction_class | |
| OLD | NEW |