summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 01:04:19 +0000
committernirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 01:04:19 +0000
commiteed87d91fdc5878e877361a2b99926aa820e33ba (patch)
treeaf3abfe6a1fd09374e7830a5afc1a7fae43aab38
parentc1e7064d462adadf1e18e1584d38f5cbce693b7c (diff)
downloadchromium_src-eed87d91fdc5878e877361a2b99926aa820e33ba.zip
chromium_src-eed87d91fdc5878e877361a2b99926aa820e33ba.tar.gz
chromium_src-eed87d91fdc5878e877361a2b99926aa820e33ba.tar.bz2
Enable crash reporting with PyAuto on ChromeOS
For chromebot (for in general for other tests), I'd like crash reporting to be turned on. R=dtu@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/6813032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80877 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/test/pyautolib/pyauto.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index b868fde..3c6194c 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -25,6 +25,7 @@ to unittest.py
python pyauto.py test_script
"""
+import hashlib
import logging
import optparse
import os
@@ -155,6 +156,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
if self.IsChromeOS(): # Enable testing interface on ChromeOS
if self.get_clear_profile():
self.CleanupBrowserProfileOnChromeOS()
+ self.EnableCrashReportingOnChromeOS()
if not named_channel_id:
named_channel_id = self.EnableChromeTestingOnChromeOS()
if named_channel_id:
@@ -195,6 +197,26 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
assert len(automation_channel_path), 'Could not enable testing interface'
return automation_channel_path
+ @staticmethod
+ def EnableCrashReportingOnChromeOS():
+ """Enables crash reporting on ChromeOS.
+
+ Writes the "/home/chronos/Consent To Send Stats" file with a 32-char
+ readable string. See comment in session_manager_setup.sh which does this
+ too.
+
+ Note that crash reporting will work only if breakpad is built in, ie in a
+ 'Google Chrome' build (not Chromium).
+ """
+ consent_file = '/home/chronos/Consent To Send Stats'
+ def _HasValidConsentFile():
+ return os.path.isfile(consent_file) and len(open(consent_file).read())
+ if not _HasValidConsentFile():
+ client_id = hashlib.md5('abcdefgh').hexdigest()
+ logging.debug('Using CLIENT_ID=%s' % client_id)
+ open(consent_file, 'w').write(client_id)
+ assert _HasValidConsentFile(), 'Could not create %s' % consent_file
+
def ExtraChromeFlagsOnChromeOS(self):
"""Return a list of extra chrome flags to use with chrome for testing.