summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/image-tests-data.js
blob: ee070c338b8783157f2e5edda80756f36f3126bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
export const kTestFolderName = "image-tests";

// The internal priorities are specified as implementation-defined,
// (https://fetch.spec.whatwg.org/#concept-fetch, step 15). For web-
// compatibility, Chromium's mapping is chosen
// (https://web.dev/articles/fetch-priority#browser_priority_and_fetchpriority).
const kExpectedRequestsOfInitialLoad = [
    {   fileNameAndSuffix: "square_25px_x_25px.png?1",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
    {   fileNameAndSuffix: "square_25px_x_25px.png?2",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
    },
    {   fileNameAndSuffix: "square_25px_x_25px.png?3",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
    {   fileNameAndSuffix: "square_25px_x_25px.png?4",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
];

const kExpectedRequestsOfInitialLoadDisabled = [
    {   fileNameAndSuffix: "square_25px_x_25px.png?1",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
    {   fileNameAndSuffix: "square_25px_x_25px.png?2",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
    {   fileNameAndSuffix: "square_25px_x_25px.png?3",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
    {   fileNameAndSuffix: "square_25px_x_25px.png?4",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
];

const kExpectedRequestsOfDynamicLoad = kExpectedRequestsOfInitialLoad;

const kExpectedRequestsOfDynamicLoadDisabled = kExpectedRequestsOfInitialLoadDisabled;

const kExpectedRequestsOfInitialLoadForSVGImageTagDisabled = kExpectedRequestsOfInitialLoadDisabled;

// TODO(bug 1865837): Should SVG's `<image>` element support the `fetchpriority` attribute?
const kExpectedRequestsOfInitialLoadForSVGImageTag = kExpectedRequestsOfInitialLoadForSVGImageTagDisabled;

const kExpectedRequestsOfDynamicLoadForSVGImageTagDisabled = kExpectedRequestsOfDynamicLoadDisabled;

// TODO(bug 1865837): Should SVG's `<image>` element support the `fetchpriority` attribute?
const kExpectedRequestsOfDynamicLoadForSVGImageTag = kExpectedRequestsOfDynamicLoadForSVGImageTagDisabled;

const kExpectedRequestsShapeOutsideImage = [
    {   fileNameAndSuffix: "square_25px_x_25px.png?1",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
    {   fileNameAndSuffix: "square_25px_x_25px.png?2",
        internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
    },
];

const kExpectedRequestsShapeOutsideImageDisabled = kExpectedRequestsShapeOutsideImage;

export const kTestData = [
    {   testFileName: "image-initial-load.h2.html",
        expectedRequests: kExpectedRequestsOfInitialLoad
    },
    {   testFileName: "image-dynamic-load.h2.html",
        expectedRequests: kExpectedRequestsOfDynamicLoad
    },
    {   testFileName: "image-svg-initial-load.h2.html",
        expectedRequests: kExpectedRequestsOfInitialLoadForSVGImageTag,
    },
    {   testFileName: "image-svg-dynamic-load.h2.html",
        expectedRequests: kExpectedRequestsOfDynamicLoadForSVGImageTag,
    },
    {   testFileName: "shape-outside-image.h2.html",
        expectedRequests: kExpectedRequestsShapeOutsideImage
    },
];

export const kTestDataDisabled = [
    {   testFileName: "image-initial-load.h2.html",
        expectedRequests: kExpectedRequestsOfInitialLoadDisabled
    },
    {   testFileName: "image-dynamic-load.h2.html",
        expectedRequests: kExpectedRequestsOfDynamicLoadDisabled
    },
    {   testFileName: "image-svg-initial-load.h2.html",
        expectedRequests: kExpectedRequestsOfInitialLoadForSVGImageTagDisabled,
    },
    {   testFileName: "image-svg-dynamic-load.h2.html",
        expectedRequests: kExpectedRequestsOfDynamicLoadForSVGImageTagDisabled,
    },
    {   testFileName: "shape-outside-image.h2.html",
        expectedRequests: kExpectedRequestsShapeOutsideImageDisabled
    },
];