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

Side by Side Diff: breakpad.py

Issue 8121001: Add a unit test to breakpad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix for python 2.6 Created 9 years, 2 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
« no previous file with comments | « no previous file | tests/breakpad_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 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 """Breakpad for Python. 5 """Breakpad for Python.
6 6
7 Sends a notification when a process stops on an exception. 7 Sends a notification when a process stops on an exception.
8 8
9 It is only enabled when all these conditions are met: 9 It is only enabled when all these conditions are met:
10 1. hostname finishes with '.google.com' or 'chromium.org' 10 1. hostname finishes with '.google.com' or 'chromium.org'
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 params = { 82 params = {
83 'args': sys.argv, 83 'args': sys.argv,
84 'stack': stack[0:4096], 84 'stack': stack[0:4096],
85 'user': getpass.getuser(), 85 'user': getpass.getuser(),
86 'exception': FormatException(last_tb), 86 'exception': FormatException(last_tb),
87 'host': _HOST_NAME, 87 'host': _HOST_NAME,
88 'cwd': os.getcwd(), 88 'cwd': os.getcwd(),
89 'version': sys.version, 89 'version': sys.version,
90 } 90 }
91 # pylint: disable=W0702 91 # pylint: disable=W0702
92 print('\n'.join(' %s: %s' % (k, v[0:maxlen]) 92 print('\n'.join(' %s: %s' % (k, params[k][0:maxlen])
93 for k, v in params.iteritems())) 93 for k in sorted(params)))
94 print(post(url, params)) 94 print(post(url, params))
95 except IOError: 95 except IOError:
96 print('There was a failure while trying to send the stack trace. Too bad.') 96 print('There was a failure while trying to send the stack trace. Too bad.')
97 97
98 98
99 def SendProfiling(url=None): 99 def SendProfiling(url=None):
100 try: 100 try:
101 if not url: 101 if not url:
102 url = DEFAULT_URL + '/profiling' 102 url = DEFAULT_URL + '/profiling'
103 params = { 103 params = {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 # Skip unit tests and we don't want anything from non-googler. 136 # Skip unit tests and we don't want anything from non-googler.
137 if (not 'test' in getattr(sys.modules['__main__'], '__file__', '') and 137 if (not 'test' in getattr(sys.modules['__main__'], '__file__', '') and
138 not 'NO_BREAKPAD' in os.environ and 138 not 'NO_BREAKPAD' in os.environ and
139 (_HOST_NAME.endswith('.google.com') or 139 (_HOST_NAME.endswith('.google.com') or
140 _HOST_NAME.endswith('.chromium.org'))): 140 _HOST_NAME.endswith('.chromium.org'))):
141 Register() 141 Register()
142 142
143 # Uncomment this line if you want to test it out. 143 # Uncomment this line if you want to test it out.
144 #Register() 144 #Register()
OLDNEW
« no previous file with comments | « no previous file | tests/breakpad_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698