| Index: tools/telemetry/telemetry/core/backends/chrome/inspector_backend_list.py
|
| diff --git a/tools/telemetry/telemetry/core/backends/chrome/inspector_backend_list.py b/tools/telemetry/telemetry/core/backends/chrome/inspector_backend_list.py
|
| index 2f7385ee197d89bb8cb0692afaa8472b00933932..66547b005fef3cc3aec2adbab8244a996d1ad1c1 100644
|
| --- a/tools/telemetry/telemetry/core/backends/chrome/inspector_backend_list.py
|
| +++ b/tools/telemetry/telemetry/core/backends/chrome/inspector_backend_list.py
|
| @@ -42,6 +42,8 @@
|
| """Override this method to control which contexts are included."""
|
| return True
|
|
|
| + #TODO(nednguyen): Remove this method and turn inspector_backend_list API to
|
| + # dictionary-like API (crbug.com/398467)
|
| def __getitem__(self, index):
|
| self._Update()
|
| if index >= len(self._inspectable_contexts_dict.keys()):
|
| @@ -51,6 +53,12 @@
|
| "keys": self._inspectable_contexts_dict.keys()
|
| }))
|
| context_id = self._inspectable_contexts_dict.keys()[index]
|
| + return self.GetBackendFromContextId(context_id)
|
| +
|
| + def GetBackendFromContextId(self, context_id):
|
| + self._Update()
|
| + if context_id not in self._inspectable_contexts_dict:
|
| + raise KeyError('Cannot find a context with id=%s' % context_id)
|
| if context_id not in self._inspector_backend_dict:
|
| backend = inspector_backend.InspectorBackend(
|
| self._browser_backend,
|
|
|