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

{
  "description": "Aggregatable 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.
                "aggregatable_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",
                // Not rounded.
                "aggregatable_report_window": "88400",
                "aggregation_keys": {
                  "b": "0x2"
                }
              }
            }
          }
        ]
      },
      {
        "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",
                // Rounded to one day (86400 seconds).
                "expiry": "87400",
                // Default to expiry after rounding (86400 seconds).
                "aggregatable_report_window": "88400",
                "aggregation_keys": {
                  "c": "0x3"
                }
              }
            }
          }
        ]
      },
      // Should result in an event-level report and an aggregatable report
      // as the aggregatable report window was clamped to one hour.
      {
        // 3,599,999 ms = 1 hour - 1 ms offset to avoid falling outside the
        // window
        "timestamp": "3599999",
        "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 event-level report, but not aggregatable report as
      // aggregatable report window has passed.
      {
        // 3,600,000 ms = 1 hour
        "timestamp": "3600000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "2"
                  }
                ],
                "aggregatable_trigger_data": [
                  {
                    "source_keys": ["a"],
                    "key_piece": "0x20"
                  }
                ],
                "aggregatable_values": {
                  "a": 456
                },
                "debug_reporting": true
              }
            }
          }
        ]
      },
      // Should not result in an aggregatable report as the source has expired.
      {
        // 86,402,000 ms = 86,400 s (clamped source's
        // aggregatable_report_window) + 2 s (source's timestamp)
        "timestamp": "86402000",
        "registration_request": {
          "context_origin": "https://destination2.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "debug_reporting": true,
                "aggregatable_trigger_data": [
                  {
                    "source_keys": ["c"],
                    "key_piece": "0x30"
                  }
                ],
                "aggregatable_values": {
                  "c": 789
                }
              }
            }
          }
        ]
      },
      // Should result in an aggregatable report as the aggregatable report
      // window was not rounded.
      {
        // 88,400,999 ms = 88,400 s (source's aggregatable_report_window) + 1 s
        // (source's timestamp) - 1 ms offset to avoid falling outside the
        // window
        "timestamp": "88400999",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter2.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "aggregatable_trigger_data": [
                  {
                    "source_keys": ["b"],
                    "key_piece": "0x30"
                  }
                ],
                "aggregatable_values": {
                  "b": 321
                }
              }
            }
          }
        ]
      }
    ]
  },
  "output": {
    "reports": [
      {
        "payload": [
          {
            "body": {
              "attribution_destination": "https://destination.test",
              "source_event_id": "123",
              "source_site": "https://source.test"
            },
            "type": "trigger-aggregate-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",
        // 7,200,000 ms  = 3,600 s (clamped aggregatable_report_window)  + 1
        // hour (base delay) - 1 ms offset
        "report_time": "7199999"
      },
      {
        "payload": [
          {
            "body": {
              "attribution_destination": "https://destination2.test"
            },
            "type": "trigger-no-matching-source"
          }
        ],
        "report_time": "86402000",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
      },
      {
        "payload": {
          "aggregation_coordinator_origin": "https://coordinator.test",
          "histograms": [
            {
              "id": "0",
              "key": "0x32",
              "value": 321
            }
          ],
          "shared_info": {
            "api": "attribution-reporting",
            "attribution_destination": "https://destination.test",
            "reporting_origin": "https://reporter2.test",
            "scheduled_report_time": "92000",
            "version": "1.0"
          }
        },
        // 90,000,000 ms  = 86,400 s (clamped aggregatable_report_window)  + 1
        // hour (base delay) + 1s (source's timestamp) - 1 ms offset
        "report_time": "92000999",
        "report_url": "https://reporter2.test/.well-known/attribution-reporting/report-aggregate-attribution"
      },
      {
        "payload": {
          "attribution_destination": "https://destination.test",
          "randomized_trigger_rate": 0.0024263,
          // 176,400 s  = 2 days (default first event_report_window) + 1 hour
          // (base delay)
          "scheduled_report_time": "172800",
          "source_event_id": "123",
          "source_type": "navigation",
          "trigger_data": "1"
        },
        "report_time": "172800000",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
      },
      {
        "payload": {
          "attribution_destination": "https://destination.test",
          "randomized_trigger_rate": 0.0024263,
          // 176,400 s  = 2 day (default first event_report_window) + 1 hour
          // (base delay)
          "scheduled_report_time": "172800",
          "source_event_id": "123",
          "source_type": "navigation",
          "trigger_data": "2"
        },
        "report_time": "172800000",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
      }
    ]
  }
}