Commit 36872577 authored by Paul Meyer's avatar Paul Meyer Committed by Commit Bot

Provide |id| field in intervention reports.

Bug: 936104
Change-Id: I07733cb7197ef5992d418a38d967544a7ee2b9d2
Tbr: avi@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1491796
Commit-Queue: Paul Meyer <paulmeyer@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657758}
parent 961ddc20
......@@ -558,6 +558,7 @@ IN_PROC_BROWSER_TEST_F(PreviewsReportingBrowserTest,
[
{
"body": {
"id": "LitePageServed",
"message": "Modified page load behavior on the page because )text"
R"text(the page was expected to take a long amount of time to load. )text"
R"text(https://www.chromestatus.com/feature/5148050062311424"
......
......@@ -36,11 +36,13 @@ class ReportingServiceProxyImpl : public blink::mojom::ReportingServiceProxy {
// blink::mojom::ReportingServiceProxy:
void QueueInterventionReport(const GURL& url,
const std::string& id,
const std::string& message,
const base::Optional<std::string>& source_file,
int line_number,
int column_number) override {
auto body = std::make_unique<base::DictionaryValue>();
body->SetString("id", id);
body->SetString("message", message);
if (source_file)
body->SetString("sourceFile", *source_file);
......
......@@ -12,6 +12,7 @@ interface ReportingServiceProxy {
//
// (See //third_party/blink/renderer/core/frame/intervention_report_body.h.)
QueueInterventionReport(url.mojom.Url url,
string id,
string message,
string? source_file,
int32 line_number,
......
......@@ -175,7 +175,8 @@ void ReportingContext::SendToReportingAPI(Report* report,
const InterventionReportBody* body =
static_cast<InterventionReportBody*>(report->body());
GetReportingService()->QueueInterventionReport(
url, body->message(), body->sourceFile(), line_number, column_number);
url, body->id(), body->message(), body->sourceFile(), line_number,
column_number);
}
}
......
......@@ -34,8 +34,8 @@ class MockReportingServiceProxy {
this.resetPromise();
}
async queueInterventionReport(url, message, sourceFile, lineNumber, columnNumber) {
this.resolve([url, message, sourceFile, lineNumber, columnNumber]);
async queueInterventionReport(url, id, message, sourceFile, lineNumber, columnNumber) {
this.resolve([url, id, message, sourceFile, lineNumber, columnNumber]);
this.resetPromise();
}
}
......@@ -71,8 +71,9 @@ promise_test(async () => {
// Ensure the intervention report is generated and routed to the reporting
// mojo interface.
let [url, message, sourceFile, lineNumber, columnNumber] = await promise;
let [url, id, message, sourceFile, lineNumber, columnNumber] = await promise;
assert_true(url.url.endsWith("reporting-observer/reporting-api.html"));
assert_equals(typeof id, "string");
assert_equals(typeof message, "string");
assert_true(sourceFile.endsWith("reporting-observer/resources/intervention.js"));
assert_equals(typeof lineNumber, "number");
......
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