Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minSupportedVersion ref tests #48

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion privacy-configuration/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Test suite specific fields:
- frameURL - string - URL of an iframe in which the feature is operating (optional - if not set assume main frame context)
- scriptURL - string - URL of script that is trying to use a protected feature (optional - if not set assume no script URL)
- expectFeatureEnabled - bool - if feature is expected to be disabled or not
- platformVersion - string - (optional) string to be considered as the testing platform's app version for use with `minSupportedVerison` tests

## Pseudo-code implementation

Expand All @@ -35,7 +36,8 @@ for $testSet in test.json
feature=$test.featureName,
url=$test.siteURL,
frame=$test.frameURL,
script=$test.scriptURL
script=$test.scriptURL,
platformVersion=$test.platformVersion?
)

expect($enabled === $test.expectFeatureEnabled)
Expand Down
12 changes: 12 additions & 0 deletions privacy-configuration/config4_reference.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"readme": "This configuration's features have a minSupportedVersion",
"features": {
"contentBlocking": {
"state": "enabled",
"minSupportedVersion": "2022.6.1",
"exceptions": []
}
},
"version": 1635943904459,
"unprotectedTemporary": []
}
23 changes: 23 additions & 0 deletions privacy-configuration/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -656,5 +656,28 @@
"exceptPlatforms": []
}
]
},
"minSupportedVersion": {
"name": "Features are expected to be disabled if the platform version is too low",
"desc": "Those tests use config14reference.json where features contain a minSupportedVresion",
"referenceConfig": "config4_reference.json",
"tests": [
{
"name": "Feature should be disabled if the platform version is too low",
"featureName": "contentBlocking",
"siteURL": "https://example.org",
"expectFeatureEnabled": false,
"platformVersion": "2022.5.30",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this test work for platforms other than extensions? e.g. android seems to use different format:

"minSupportedVersion": 51250000

They may not be able to implement this test (they may explode parsing that config file).

"exceptPlatforms": []
},
{
"name": "Feature should be enabled if the platform version is higher than the minSupportedVersion",
"featureName": "contentBlocking",
"siteURL": "https://example.org",
"expectFeatureEnabled": true,
"platformVersion": "2022.6.15",
"exceptPlatforms": []
}
]
}
}