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

Side by Side Diff: tools/telemetry/telemetry/extension_dict.py

Issue 12294002: Revert 182991 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 extension_to_load 5 from telemetry import extension_to_load
6 6
7 class ExtensionDict(object): 7 class ExtensionDict(object):
8 """Dictionary of ExtensionPage instances, with extension_id as key""" 8 """Dictionary of ExtensionPage instances, with extension_id as key"""
9 9
10 def __init__(self, extension_dict_backend): 10 def __init__(self, extension_dict_backend):
11 self._extension_dict_backend = extension_dict_backend 11 self._extension_dict_backend = extension_dict_backend
12 12
13 def __getitem__(self, load_extension): 13 def __getitem__(self, load_extension):
14 """Given an ExtensionToLoad instance, returns the corresponding 14 """Given an ExtensionToLoad instance, returns the corresponding
15 ExtensionPage instance.""" 15 ExtensionPage instance."""
16 if not isinstance(load_extension, extension_to_load.ExtensionToLoad): 16 if not isinstance(load_extension, extension_to_load.ExtensionToLoad):
17 raise Exception("Input param must be of type ExtensionToLoad") 17 raise Exception("Input param must be of type ExtensionToLoad")
18 return self._extension_dict_backend.__getitem__( 18 return self._extension_dict_backend.__getitem__(
19 load_extension.extension_id) 19 load_extension.extension_id)
20 20
21 def __contains__(self, load_extension): 21 def __contains__(self, load_extension):
22 """Checks if this ExtensionToLoad instance has been loaded""" 22 """Checks if this ExtensionToLoad instance has been loaded"""
23 if not isinstance(load_extension, extension_to_load.ExtensionToLoad): 23 if not isinstance(load_extension, extension_to_load.ExtensionToLoad):
24 raise Exception("Input param must be of type ExtensionToLoad") 24 raise Exception("Input param must be of type ExtensionToLoad")
25 return self._extension_dict_backend.__contains__( 25 return self._extension_dict_backend.__contains__(
26 load_extension.extension_id) 26 load_extension.extension_id)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/discover.py ('k') | tools/telemetry/telemetry/extension_dict_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698