mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
Automatic update from web-platform-tests Adding toJSON to report and report_body - declare BuildJSONValue in report_body as virtual - make all sub-class implement override implementation add toJSON to report_body, making it serializable - Includes 4 different reports - and parent class LocationReportBody Bug: 917945 Change-Id: I2ef281aad171ec6a477ae562fab3257847ee4f41 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895957 Reviewed-by: David Bokan <[email protected]> Reviewed-by: Jason Chase <[email protected]> Commit-Queue: Rodney Ding <[email protected]> Cr-Commit-Position: refs/heads/master@{#714244} -- wpt-commits: 6a36ba1f133162f4f33424baa73e2e710a59f5cf wpt-pr: 20100
35 lines
1.5 KiB
HTML
35 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8" />
|
|
<title>Reporting: Generate Test Report</title>
|
|
<link rel="author" title="Paul Meyer" href="[email protected]">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<script>
|
|
// Test that the "generate_test_report" API works.
|
|
async_test(function(test) {
|
|
var observer = new ReportingObserver(function(reports) {
|
|
test.step(function() {
|
|
assert_equals(reports.length, 1);
|
|
// Ensure that the contents of the report are valid.
|
|
assert_equals(reports[0].type, "test");
|
|
assert_true(reports[0].url.endsWith("reporting/generateTestReport.html"));
|
|
assert_equals(reports[0].body.message, "Test message.");
|
|
// Ensure that the toJSON() call of the report are valid.
|
|
const reportJSON = reports[0].toJSON();
|
|
assert_equals(reports[0].type, reportJSON.type);
|
|
assert_equals(reports[0].url, reportJSON.url);
|
|
assert_equals(reports[0].body.message, reportJSON.body.message);
|
|
// Ensure that report can be successfully JSON serialized.
|
|
assert_equals(JSON.stringify(reports[0]), JSON.stringify(reportJSON));
|
|
});
|
|
test.done();
|
|
});
|
|
observer.observe();
|
|
|
|
// This should result in a "test" type report being generated and observed.
|
|
test_driver.generate_test_report("Test message.");
|
|
}, "Generate Test Report");
|
|
</script>
|