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

Unified Diff: chrome/test/kasko/py/kasko/integration_test.py

Issue 1543803005: Added an integration test for kasko hang reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments #1 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/kasko/py/kasko/integration_test.py
diff --git a/chrome/test/kasko/kasko_integration_test.py b/chrome/test/kasko/py/kasko/integration_test.py
old mode 100755
new mode 100644
similarity index 53%
copy from chrome/test/kasko/kasko_integration_test.py
copy to chrome/test/kasko/py/kasko/integration_test.py
index e88a3f1c98420a3440facf2e8155efa39ea48ba5..ed5bcf1d4b6a20f82a1aa0d6fad3549fac3215d2
--- a/chrome/test/kasko/kasko_integration_test.py
+++ b/chrome/test/kasko/py/kasko/integration_test.py
@@ -1,44 +1,30 @@
#!/usr/bin/env python
-# Copyright 2015 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""A Windows-only end-to-end integration test for Kasko, Chrome and Crashpad.
-
-This test ensures that the interface between Kasko and Chrome and Crashpad works
-as expected. The test causes Kasko to set certain crash keys and invoke a crash
-report, which is in turn delivered to a locally hosted test crash server. If the
-crash report is received intact with the expected crash keys then all is well.
-
-Note that this test only works against non-component Release and Official builds
-of Chrome with Chrome branding, and attempting to use it with anything else will
-most likely lead to constant failures.
-
-Typical usage (assuming in root 'src' directory):
-
-- generate project files with the following GYP variables:
- syzyasan=1 win_z7=0 chromium_win_pch=0
-- build the release Chrome binaries:
- ninja -C out\Release chrome.exe
-- run the test:
- python chrome/test/kasko/kasko_integration_test.py
-"""
+"""Integration test for Kasko."""
import logging
import os
-import sys
+import optparse
-# Bring in the Kasko module.
-KASKO_DIR = os.path.join(os.path.dirname(__file__), 'py')
-sys.path.append(KASKO_DIR)
import kasko
_LOGGER = logging.getLogger(os.path.basename(__file__))
-def Main():
- options = kasko.config.ParseCommandLine()
+def RunTest(options, url, timeout, expected_keys):
+ """Runs an integration test for Kasko crash reports.
+
+ Launches both test server and a Chrome instance and then navigates
chrisha 2016/01/21 18:17:41 Indent -3.
Patrick Monette 2016/01/21 19:54:02 Done.
+ to the test |url|. The visited |url| is expected to generate a
+ Kasko report within the |timeout| allowed. The report is finally
+ verified against expected crash keys.
chrisha 2016/01/21 18:17:41 Worth describing the arguments. Standard format is
Patrick Monette 2016/01/21 19:54:02 Done.
+
+ This test raises an exception on error.
+ """
# Generate a temporary directory for use in the tests.
with kasko.util.ScopedTempDir() as temp_dir:
@@ -71,19 +57,13 @@ def Main():
options.chrome, user_data_dir)
with kasko.util.ScopedStartStop(chrome):
_LOGGER.info('Navigating to Kasko debug URL')
- chrome.navigate_to('chrome://kasko/send-report')
+ chrome.navigate_to(url)
_LOGGER.info('Waiting for Kasko report')
- if not server.wait_for_report(10):
+ if not server.wait_for_report(timeout):
raise Exception('No Kasko report received.')
+ # Verify a few crash keys.
report = server.crash(0)
kasko.report.LogCrashKeys(report)
- kasko.report.ValidateCrashReport(report,
- {'kasko-set-crash-key-value-impl': 'SetCrashKeyValueImpl'})
-
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(Main())
+ kasko.report.ValidateCrashReport(report, expected_keys)

Powered by Google App Engine
This is Rietveld 408576698