Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Referrer-Policy: Debug/Release mode for test templates and sanity che…
…cks.
- Loading branch information
1 parent
7a40d6f
commit 56b0ccf
Showing
10 changed files
with
183 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// The SanityChecker is used in debug mode to identify problems with the | ||
// structure of the testsuite. In release mode it is mocked out to do nothing. | ||
|
||
function SanityChecker() {} | ||
|
||
SanityChecker.prototype.checkScenario = function(scenario) { | ||
// Check if scenario is valid. | ||
// TODO(kristijanburnik): Move to a sanity-checks.js for debug mode only. | ||
test(function() { | ||
|
||
// We extend the exsiting test_expansion_schema not to kill performance by | ||
// copying. | ||
var expectedFields = SPEC_JSON["test_expansion_schema"]; | ||
expectedFields["referrer_policy"] = SPEC_JSON["referrer_policy_schema"]; | ||
|
||
assert_own_property(scenario, "subresource_path", | ||
"Scenario has the path to the subresource."); | ||
|
||
for (var field in expectedFields) { | ||
assert_own_property(scenario, field, | ||
"The scenario contains field " + field) | ||
assert_in_array(scenario[field], expectedFields[field], | ||
"Scenario's " + field + " is one of: " + | ||
expectedFields[field].join(", ")) + "." | ||
} | ||
|
||
// Check if the protocol is matched. | ||
assert_equals(scenario["source_protocol"] + ":", location.protocol, | ||
"Protocol of the test page should match the scenario.") | ||
|
||
}, "[ReferrerPolicyTestCase] The test scenario is valid."); | ||
} | ||
|
||
SanityChecker.prototype.checkSubresourceResult = function(test, | ||
scenario, | ||
subresourceUrl, | ||
result) { | ||
test.step(function() { | ||
assert_equals(Object.keys(result).length, 3); | ||
assert_own_property(result, "location"); | ||
assert_own_property(result, "referrer"); | ||
assert_own_property(result, "headers"); | ||
|
||
// Skip location check for scripts. | ||
if (scenario.subresource == "script-tag") | ||
return; | ||
|
||
// Sanity check: location of sub-resource matches reported location. | ||
assert_equals(result.location, subresourceUrl, | ||
"Subresource reported location."); | ||
}, "Running a valid test scenario."); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
var SERVER_REQUEST_HEADERS = %(headers)s; | ||
|
||
postMessage(SERVER_REQUEST_HEADERS, '*'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.