1# Copyright 2013 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 5from telemetry.core import exceptions 6from telemetry.core.backends.chrome import inspector_backend_list 7from telemetry.core.backends.chrome import oobe 8 9 10class MiscWebContentsBackend(inspector_backend_list.InspectorBackendList): 11 """A dynamic sequence of web contents not related to tabs and extensions. 12 13 Provides acccess to chrome://oobe/login page. 14 """ 15 16 def __init__(self, browser_backend): 17 super(MiscWebContentsBackend, self).__init__( 18 browser_backend, backend_wrapper=oobe.Oobe) 19 20 @property 21 def oobe_exists(self): 22 """Lightweight property to determine if the oobe webui is visible.""" 23 try: 24 return bool(len(self)) 25 except (exceptions.BrowserGoneException, 26 exceptions.BrowserConnectionGoneException, 27 exceptions.TabCrashException): 28 return False 29 30 def GetOobe(self): 31 if not len(self): 32 return None 33 return self[0] 34 35 def ShouldIncludeContext(self, context): 36 return context.get('url').startswith('chrome://oobe') 37