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

Side by Side Diff: telemetry/telemetry/internal/backends/chrome/ios_browser_backend.py

Issue 2904193002: [Telemetry] Reduce a websocket connection between telemetry & devtool browser target (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import contextlib 5 import contextlib
6 import json 6 import json
7 import logging 7 import logging
8 import re 8 import re
9 import urllib2 9 import urllib2
10 10
11 from telemetry.internal.backends.chrome import chrome_browser_backend 11 from telemetry.internal.backends.chrome import chrome_browser_backend
12 from telemetry.internal.backends.chrome import system_info_backend
13 12
14 import py_utils 13 import py_utils
15 14
16 15
17 class IosBrowserBackend(chrome_browser_backend.ChromeBrowserBackend): 16 class IosBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
18 _DEBUGGER_URL_BUILDER = 'ws://localhost:%i/devtools/page/%i' 17 _DEBUGGER_URL_BUILDER = 'ws://localhost:%i/devtools/page/%i'
19 _DEBUGGER_URL_REGEX = r'ws://localhost:(\d+)/devtools/page/(\d+)' 18 _DEBUGGER_URL_REGEX = r'ws://localhost:(\d+)/devtools/page/(\d+)'
20 _DEVICE_LIST_URL = 'http://localhost:9221/json' 19 _DEVICE_LIST_URL = 'http://localhost:9221/json'
21 20
22 def __init__(self, ios_platform_backend, browser_options): 21 def __init__(self, ios_platform_backend, browser_options):
23 browser_options.output_profile_path = '.' 22 browser_options.output_profile_path = '.'
24 super(IosBrowserBackend, self).__init__( 23 super(IosBrowserBackend, self).__init__(
25 ios_platform_backend, 24 ios_platform_backend,
26 supports_tab_control=False, 25 supports_tab_control=False,
27 supports_extensions=False, 26 supports_extensions=False,
28 browser_options=browser_options) 27 browser_options=browser_options)
29 self._webviews = [] 28 self._webviews = []
30 self._port = None 29 self._port = None
31 self._page = None 30 self._page = None
32 self._system_info_backend = None
33 self.UpdateRunningBrowsersInfo() 31 self.UpdateRunningBrowsersInfo()
34 32
35 def UpdateRunningBrowsersInfo(self): 33 def UpdateRunningBrowsersInfo(self):
36 """ Refresh to match current state of the running browser. 34 """ Refresh to match current state of the running browser.
37 """ 35 """
38 device_urls = self.GetDeviceUrls() 36 device_urls = self.GetDeviceUrls()
39 urls = self.GetWebSocketDebuggerUrls(device_urls) 37 urls = self.GetWebSocketDebuggerUrls(device_urls)
40 for url in urls: 38 for url in urls:
41 m = re.match(self._DEBUGGER_URL_REGEX, url) 39 m = re.match(self._DEBUGGER_URL_REGEX, url)
42 if m: 40 if m:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return [] 94 return []
97 95
98 # Find all running UIWebViews. 96 # Find all running UIWebViews.
99 debug_urls = [] 97 debug_urls = []
100 for j in data: 98 for j in data:
101 debug_urls.append(j['webSocketDebuggerUrl']) 99 debug_urls.append(j['webSocketDebuggerUrl'])
102 100
103 return debug_urls 101 return debug_urls
104 102
105 def GetSystemInfo(self): 103 def GetSystemInfo(self):
106 if self._system_info_backend is None: 104 return None
107 self._system_info_backend = system_info_backend.SystemInfoBackend(
108 self._port, self._page)
109 return self._system_info_backend.GetSystemInfo()
110 105
111 def IsBrowserRunning(self): 106 def IsBrowserRunning(self):
112 return bool(self._webviews) 107 return bool(self._webviews)
113 108
114 #TODO(baxley): The following were stubbed out to get the sunspider benchmark 109 #TODO(baxley): The following were stubbed out to get the sunspider benchmark
115 # running. These should be implemented. 110 # running. These should be implemented.
116 @property 111 @property
117 def browser_directory(self): 112 def browser_directory(self):
118 logging.warn('Not implemented') 113 logging.warn('Not implemented')
119 return None 114 return None
(...skipping 28 matching lines...) Expand all
148 return None 143 return None
149 144
150 def GetAllMinidumpPaths(self): 145 def GetAllMinidumpPaths(self):
151 return None 146 return None
152 147
153 def GetAllUnsymbolizedMinidumpPaths(self): 148 def GetAllUnsymbolizedMinidumpPaths(self):
154 return None 149 return None
155 150
156 def SymbolizeMinidump(self, minidump_path): 151 def SymbolizeMinidump(self, minidump_path):
157 return None 152 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698