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

Side by Side Diff: tools/android/loading/tracing_driver.py

Issue 1606903002: tools/android/loading: Archive tracks in LoadingTrace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 11 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
(Empty)
1 #! /usr/bin/python
2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Drive TracingConnection"""
7
8 import argparse
9 import json
10 import logging
11 import os.path
12 import sys
13
14 _SRC_DIR = os.path.abspath(os.path.join(
15 os.path.dirname(__file__), '..', '..', '..'))
16
17 sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'catapult', 'devil'))
18 from devil.android import device_utils
19
20 sys.path.append(os.path.join(_SRC_DIR, 'build', 'android'))
21 import device_setup
22 import page_track
23 import tracing
24
25
26 def main():
27 logging.basicConfig(level=logging.INFO)
28 parser = argparse.ArgumentParser()
29 parser.add_argument('--url', required=True)
30 parser.add_argument('--output', required=True)
31 args = parser.parse_args()
32 url = args.url
33 if not url.startswith('http'):
34 url = 'http://' + url
35 device = device_utils.DeviceUtils.HealthyDevices()[0]
36 with file(args.output, 'w') as output, \
37 file(args.output + '.page', 'w') as page_output, \
38 device_setup.DeviceConnection(device) as connection:
39 track = tracing.TracingTrack(connection, fetch_stream=False)
40 page = page_track.PageTrack(connection)
41 connection.SetUpMonitoring()
42 connection.SendAndIgnoreResponse('Page.navigate', {'url': url})
43 connection.StartMonitoring()
44 json.dump(page.GetEvents(), page_output, sort_keys=True, indent=2)
45 json.dump(track.GetEvents(), output, sort_keys=True, indent=2)
46
47
48 if __name__ == '__main__':
49 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698