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

Side by Side Diff: tools/android/loading/trace_test/webserver_test.py

Issue 2047463002: Set tracing categories explicitly in Clovis and Sandwich (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 #! /usr/bin/python 1 #! /usr/bin/python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """An integration test for tracing. 6 """An integration test for tracing.
7 7
8 This is not run as part of unittests and is executed directly. In normal 8 This is not run as part of unittests and is executed directly. In normal
9 operation it can be run with no arguments (or perhaps --no_sandbox depending on 9 operation it can be run with no arguments (or perhaps --no_sandbox depending on
10 how you have chrome set up). When debugging or adding tests, setting 10 how you have chrome set up). When debugging or adding tests, setting
(...skipping 23 matching lines...) Expand all
34 import json 34 import json
35 import os 35 import os
36 import shutil 36 import shutil
37 import subprocess 37 import subprocess
38 import sys 38 import sys
39 import tempfile 39 import tempfile
40 import urlparse 40 import urlparse
41 41
42 sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) 42 sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
43 43
44 import clovis_constants
44 import controller 45 import controller
45 import loading_trace 46 import loading_trace
46 import options 47 import options
47 48
48 49
49 OPTIONS = options.OPTIONS 50 OPTIONS = options.OPTIONS
50 WEBSERVER = os.path.join(os.path.dirname(__file__), 'test_server.py') 51 WEBSERVER = os.path.join(os.path.dirname(__file__), 'test_server.py')
51 TESTDIR = os.path.join(os.path.dirname(__file__), 'tests') 52 TESTDIR = os.path.join(os.path.dirname(__file__), 'tests')
52 RESULTDIR = os.path.join(os.path.dirname(__file__), 'results') 53 RESULTDIR = os.path.join(os.path.dirname(__file__), 'results')
53 54
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 True if the test passed and false otherwise. Status is printed to stdout. 228 True if the test passed and false otherwise. Status is printed to stdout.
228 """ 229 """
229 url = 'http://%s/%s' % (webserver.Address(), test_page) 230 url = 'http://%s/%s' % (webserver.Address(), test_page)
230 sys.stdout.write('Testing %s...' % url) 231 sys.stdout.write('Testing %s...' % url)
231 chrome_controller = controller.LocalChromeController() 232 chrome_controller = controller.LocalChromeController()
232 233
233 with chrome_controller.Open() as connection: 234 with chrome_controller.Open() as connection:
234 connection.ClearCache() 235 connection.ClearCache()
235 observed_seq = InitiatorSequence( 236 observed_seq = InitiatorSequence(
236 loading_trace.LoadingTrace.RecordUrlNavigation( 237 loading_trace.LoadingTrace.RecordUrlNavigation(
237 url, connection, chrome_controller.ChromeMetadata())) 238 url, connection, chrome_controller.ChromeMetadata(),
239 categories=clovis_constants.DEFAULT_CATEGORIES))
238 if observed_seq == expected: 240 if observed_seq == expected:
239 sys.stdout.write(' ok\n') 241 sys.stdout.write(' ok\n')
240 return True 242 return True
241 else: 243 else:
242 sys.stdout.write(' FAILED!\n') 244 sys.stdout.write(' FAILED!\n')
243 if OPTIONS.failed_trace_dir: 245 if OPTIONS.failed_trace_dir:
244 outname = os.path.join(OPTIONS.failed_trace_dir, 246 outname = os.path.join(OPTIONS.failed_trace_dir,
245 test_page + '.observed_result') 247 test_page + '.observed_result')
246 with file(outname, 'w') as output: 248 with file(outname, 'w') as output:
247 observed_seq.DumpToFile(output) 249 observed_seq.DumpToFile(output)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 print 'all tests passed' 282 print 'all tests passed'
281 283
282 284
283 if __name__ == '__main__': 285 if __name__ == '__main__':
284 OPTIONS.ParseArgs(sys.argv[1:], 286 OPTIONS.ParseArgs(sys.argv[1:],
285 description='Run webserver integration test', 287 description='Run webserver integration test',
286 extra=[('--failed_trace_dir', ''), 288 extra=[('--failed_trace_dir', ''),
287 ('--noisy', False), 289 ('--noisy', False),
288 ('--test_filter', None)]) 290 ('--test_filter', None)])
289 RunAllTests() 291 RunAllTests()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698