Commit d9ff72b6 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Add support for generating a test report from layout_tests.

These tests passed on the WPT fyi bot but weren't tested in the
layout tests because the testdriver-vendor.js didn't have plumbing
for the non chromedriver path.

Since our waterfall generally runs this path it is wise to add this
support to this code path.

BUG=626703

Change-Id: I9f0c91198146535a2d5cdb71baa29d463820ddd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2129017Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755077}
parent 5ddde732
......@@ -6,11 +6,12 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_TEST_REPORT_BODY_H_
#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/frame/report_body.h"
namespace blink {
class TestReportBody : public ReportBody {
class CORE_EXPORT TestReportBody : public ReportBody {
DEFINE_WRAPPERTYPEINFO();
public:
......
......@@ -86,7 +86,10 @@
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/performance_monitor.h"
#include "third_party/blink/renderer/core/frame/remote_dom_window.h"
#include "third_party/blink/renderer/core/frame/report.h"
#include "third_party/blink/renderer/core/frame/reporting_context.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/test_report_body.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/geometry/dom_point.h"
#include "third_party/blink/renderer/core/geometry/dom_rect.h"
......@@ -3532,4 +3535,14 @@ bool Internals::overlayScrollbarsEnabled() const {
return ScrollbarThemeSettings::OverlayScrollbarsEnabled();
}
void Internals::generateTestReport(const String& message) {
// Construct the test report.
TestReportBody* body = MakeGarbageCollected<TestReportBody>(message);
Report* report =
MakeGarbageCollected<Report>("test", document_->Url().GetString(), body);
// Send the test report to any ReportingObservers.
ReportingContext::From(document_->ExecutingWindow())->QueueReport(report);
}
} // namespace blink
......@@ -599,6 +599,8 @@ class Internals final : public ScriptWrappable {
void useMockOverlayScrollbars();
bool overlayScrollbarsEnabled() const;
void generateTestReport(const String& message);
private:
Document* ContextDocument() const;
Vector<String> IconURLs(Document*, int icon_types_mask) const;
......
......@@ -432,4 +432,7 @@
void useMockOverlayScrollbars();
readonly attribute boolean overlayScrollbarsEnabled;
// Request generation of a Reporting report.
void generateTestReport(DOMString message);
};
......@@ -3374,11 +3374,6 @@ crbug.com/626703 external/wpt/html/semantics/forms/the-fieldset-element/accessib
crbug.com/626703 virtual/webrtc-wpt-plan-b/external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html [ Timeout ]
crbug.com/626703 external/wpt/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html [ Timeout ]
crbug.com/626703 external/wpt/webrtc/RTCPeerConnection-remote-track-mute.https.html [ Timeout ]
crbug.com/626703 external/wpt/reporting/disconnect.html [ Timeout ]
crbug.com/626703 external/wpt/reporting/generateTestReport.html [ Timeout ]
crbug.com/626703 external/wpt/reporting/bufferSize.html [ Timeout ]
crbug.com/626703 external/wpt/reporting/order.html [ Timeout ]
crbug.com/626703 external/wpt/reporting/nestedReport.html [ Timeout ]
crbug.com/626703 virtual/not-site-per-process/external/wpt/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_access_details.sub.html [ Skip ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-007v.html [ Failure ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/system-cyclic-invalid.html [ Pass Failure Timeout ]
......
This is a testharness.js-based test.
FAIL TestDriver generate_test_report method assert_unreached: generate_test_report failed Reached unreachable code
Harness: the test ran to completion.
......@@ -29,6 +29,7 @@
observer.observe();
// This should result in a "test" type report being generated and observed.
test_driver.generate_test_report("Test message.");
test_driver.generate_test_report("Test message.")
.catch(test.unreached_func('generate test report failed'));
}, "Generate Test Report");
</script>
......@@ -136,6 +136,17 @@
});
};
window.test_driver_internal.generate_test_report = function(message) {
return new Promise(function(resolve, reject) {
if (internals) {
internals.generateTestReport(message);
resolve();
} else {
reject(new Error("window.internals not enabled."));
}
});
};
window.test_driver_internal.action_sequence = function(actions) {
if (window.top !== window) {
return Promise.reject(new Error("can only send keys in top-level window"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment