| 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
|
| similarity index 53%
|
| copy from chrome/test/kasko/kasko_integration_test.py
|
| copy to chrome/test/kasko/py/kasko/integration_test.py
|
| index e88a3f1c98420a3440facf2e8155efa39ea48ba5..f2531c362c6a9610a00b1250cf45d513c6255109 100755
|
| --- a/chrome/test/kasko/kasko_integration_test.py
|
| +++ b/chrome/test/kasko/py/kasko/integration_test.py
|
| @@ -1,44 +1,42 @@
|
| #!/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
|
| + 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.
|
| +
|
| + This test raises an exception on error.
|
| +
|
| + Args:
|
| + options The options used to modify the test behavior. Call
|
| + kasko.config.ParseCommandLine() to generate them.
|
| + url The URL that the browser will be navigated to in order to
|
| + cause a crash.
|
| + timeout The time, in seconds, in which the crash is expected to
|
| + be processed.
|
| + expected_keys A dictionary containing the keys that are expected
|
| + to be present in the crash keys of the report. The value is an
|
| + optional string to give an indication of what is the probable
|
| + cause of the missing key.
|
| + """
|
|
|
| # Generate a temporary directory for use in the tests.
|
| with kasko.util.ScopedTempDir() as temp_dir:
|
| @@ -71,19 +69,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)
|
|
|