-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New presentation start tests that trigger a mixed content error (#3590)
* New start presentation tests that trigger a mixed content error The tests need to run over HTTPS, hence the ".https.html" extension. They create a PresentationRequest with an HTTP URL and ensure that "start" reports a SecurityError exception. * Disable button once clicked and use document.title for test name The tests are semi-manual and the test harness gets confused if the button gets clicked more than once. Disabling the button ensures the user will only run the test once. Also, since the page only contains one test, it is good practice to use the title of the page to convey the name of the test. * New mixed content tests for Presentation API The tests check "reconnect" and "getAvailability" mixed content steps.
- Loading branch information
1 parent
038f2db
commit f9ee769
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
presentation-api/controlling-ua/getAvailability_mixedcontent.https.html
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,18 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Calling "getAvailability" with an a priori unauthenticated URL in an HTTPS context throws a SecurityError exception.</title> | ||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd"> | ||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-getavailability"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
function getAvailability() { | ||
var request = new PresentationRequest('http://example.org/presentation.html'); | ||
return request.getAvailability(); | ||
} | ||
|
||
promise_test(function (t) { | ||
return promise_rejects(t, 'SecurityError', getAvailability()); | ||
}); | ||
</script> | ||
|
18 changes: 18 additions & 0 deletions
18
presentation-api/controlling-ua/reconnectToPresentation_mixedcontent.https.html
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,18 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Calling "reconnect" with an a priori unauthenticated URL in an HTTPS context throws a SecurityError exception.</title> | ||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd"> | ||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-reconnect"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
function reconnectToPresentation() { | ||
var request = new PresentationRequest('http://example.org/presentation.html'); | ||
return request.reconnect('someid'); | ||
} | ||
|
||
promise_test(function (t) { | ||
return promise_rejects(t, 'SecurityError', reconnectToPresentation()); | ||
}); | ||
</script> | ||
|
29 changes: 29 additions & 0 deletions
29
presentation-api/controlling-ua/startNewPresentation_mixedcontent-manual.https.html
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,29 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Calling "start" with an a priori unauthenticated URL in an HTTPS context throws a SecurityError exception.</title> | ||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd"> | ||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-start"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<p>Click the button below to start the manual test. If prompted to select a device, please dismiss the dialog box. The test passes if a "PASS" result appears.</p> | ||
<button id="presentBtn" onclick="startPresentationTest()">Start Presentation Test</button> | ||
|
||
<script> | ||
setup({explicit_timeout: true}); | ||
|
||
var presentBtn = document.getElementById("presentBtn"); | ||
|
||
function startPresentation() { | ||
var request = new PresentationRequest('http://example.org/presentation.html'); | ||
return request.start(); | ||
}; | ||
|
||
function startPresentationTest() { | ||
presentBtn.disabled = true; | ||
promise_test(function (t) { | ||
return promise_rejects(t, 'SecurityError', startPresentation()); | ||
}); | ||
} | ||
</script> | ||
|
32 changes: 32 additions & 0 deletions
32
presentation-api/controlling-ua/startNewPresentation_mixedcontent_multiple-manual.https.html
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,32 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Calling "start" with a set of URLs containing an a priori unauthenticated URL in an HTTPS context throws a SecurityError exception.</title> | ||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd"> | ||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-start"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<p>Click the button below to start the manual test. If prompted to select a device, please dismiss the dialog box. The test passes if a "PASS" result appears.</p> | ||
<button id="presentBtn" onclick="startPresentationTest()">Start Presentation Test</button> | ||
|
||
<script> | ||
setup({explicit_timeout: true}); | ||
|
||
var presentBtn = document.getElementById("presentBtn"); | ||
|
||
function startPresentation() { | ||
var request = new PresentationRequest([ | ||
'presentation.html', | ||
'http://example.org/presentation.html' | ||
]); | ||
return request.start(); | ||
}; | ||
|
||
function startPresentationTest() { | ||
presentBtn.disabled = true; | ||
promise_test(function (t) { | ||
return promise_rejects(t, 'SecurityError', startPresentation()); | ||
}); | ||
} | ||
</script> | ||
|