chromium/content/test/data/attribution_reporting/interop/event_report_window.json

{
  "description": "Event-level report not created if report window has passed",
  "input": {
    "registrations": [
      {
        "timestamp": "0",
        "registration_request": {
          "context_origin": "https://source.test",
          "Attribution-Reporting-Eligible": "navigation-source"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-source",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": "https://destination.test",
                "source_event_id": "123",
                // Clamped to one hour (3600 seconds). Trailing zero included
                // to demonstrate validity.
                "event_report_window": 3590.0,
                "aggregation_keys": {
                  "a": "0x1"
                }
              }
            }
          }
        ]
      },
      {
        "timestamp": "1000",
        "registration_request": {
          "context_origin": "https://source.test",
          "Attribution-Reporting-Eligible": "event-source"
        },
        "responses": [
          {
            "url": "https://reporter2.test/register-source",
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": "https://destination.test",
                "source_event_id": "456",
                // Not rounded.
                "event_report_window": "88400"
              }
            }
          }
        ]
      },
      {
        "timestamp": "2000",
        "registration_request": {
          "context_origin": "https://source.test",
          "Attribution-Reporting-Eligible": "event-source"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-source",
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": "https://destination2.test",
                "source_event_id": "789",
                // Rounded to one day (86400 seconds).
                "expiry": "87400",
                // Default to expiry after rounding (86400 seconds).
                "event_report_window": "88400"
              }
            }
          }
        ]
      },
      // Should result in an event-level report and an aggregatable report
      // as the event report window was clamped to one hour.
      {
        // 3,599,000 ms = 1 hour - 1 second < clamped event_report_window value
        "timestamp": "3599000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "1"
                  }
                ],
                "aggregatable_trigger_data": [
                  {
                    "source_keys": ["a"],
                    "key_piece": "0x10"
                  }
                ],
                "aggregatable_values": {
                  "a": 123
                }
              }
            }
          }
        ]
      },
      // Should result in an aggregatable report, but not event-level report as
      // event report window has passed (event report window is an exclusive
      // bound).
      {
        // 3,600,000 ms = 1 hour = clamped event_report_window value
        "timestamp": "3600000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "debug_reporting": true,
                "event_trigger_data": [
                  {
                    "trigger_data": "2"
                  }
                ],
                "aggregatable_trigger_data": [
                  {
                    "source_keys": ["a"],
                    "key_piece": "0x20"
                  }
                ],
                "aggregatable_values": {
                  "a": 456
                }
              }
            }
          }
        ]
      },
      // Should result in an event-level report and report time was based on
      // event report window.
      {
        // We use a timestamp that is before the end of the clamped timestamp.
        // The report would be created even if the event_report_window would not
        // be clamped. However, we can assert that it was by ensuring that the
        // report's report_time is based on the clamped event_report_window.
        // clamped: 86,402 s = 2 s + 86,400 s
        // 86,401,000 ms = clamped - 1 s

        "timestamp": "86401000",
        "registration_request": {
          "context_origin": "https://destination2.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "4"
                  }
                ]
              }
            }
          }
        ]
      },
      // Should result in an event-level report as the event report window was
      // not rounded.
      {
        // 88,400,000 ms = 88,400 s (source 456 non-rounded event_report
        // window).
        "timestamp": "88400000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter2.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "3"
                  }
                ]
              }
            }
          }
        ]
      }
    ]
  },
  "output": {
    "reports": [
      {
        "payload": {
          "attribution_destination": "https://destination.test",
          "randomized_trigger_rate": 0.0001372,
          // 3600 s = 3600 s (clamped event_report_window) delay
          "scheduled_report_time": "3600",
          "source_event_id": "123",
          "source_type": "navigation",
          "trigger_data": "1"
        },
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
        "report_time": "3600000"
      },
      {
        "payload": [
          {
            "body": {
              "attribution_destination": "https://destination.test",
              "source_event_id": "123",
              "source_site": "https://source.test"
            },
            "type": "trigger-event-report-window-passed"
          }
        ],
        "report_time": "3600000",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
      },
      {
        "payload": {
          "aggregation_coordinator_origin": "https://coordinator.test",
          "histograms": [
            {
              "id": "0",
              "key": "0x11",
              "value": 123
            }
          ],
          "shared_info": {
            "api": "attribution-reporting",
            "attribution_destination": "https://destination.test",
            "reporting_origin": "https://reporter.test",
            "scheduled_report_time": "7199",
            "version": "1.0"
          }
        },
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution",
        "report_time": "7199000"
      },
      {
        "payload": {
          "aggregation_coordinator_origin": "https://coordinator.test",
          "histograms": [
            {
              "id": "0",
              "key": "0x21",
              "value": 456
            }
          ],
          "shared_info": {
            "api": "attribution-reporting",
            "attribution_destination": "https://destination.test",
            "reporting_origin": "https://reporter.test",
            "scheduled_report_time": "7200",
            "version": "1.0"
          }
        },
        "report_time": "7200000",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
      },
      {
        "payload": {
          "attribution_destination": "https://destination2.test",
          "randomized_trigger_rate": 0.0000025,
          // 86,r02 s = 2 s (source timestamp) + 86,400 s (clamped
          // event_report_window)
          "scheduled_report_time": "86402",
          "source_event_id": "789",
          "source_type": "event",
          "trigger_data": "0"
        },
        "report_time": "86402000",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
      },
      {
        "payload": {
          "attribution_destination": "https://destination.test",
          "randomized_trigger_rate": 0.0000025,
          // 88,401 s = 1 s (source timestamp) + 88,400 s (event_report_window)
          "scheduled_report_time": "88401",
          "source_event_id": "456",
          "source_type": "event",
          "trigger_data": "1"
        },
        "report_time": "88401000",
        "report_url": "https://reporter2.test/.well-known/attribution-reporting/report-event-attribution"
      }
    ]
  }
}