diff options
Diffstat (limited to 'mobile/android/focus-android/app/src/androidTest/assets')
19 files changed, 471 insertions, 432 deletions
diff --git a/mobile/android/focus-android/app/src/androidTest/assets/audioPage.html b/mobile/android/focus-android/app/src/androidTest/assets/audioPage.html index f45ba6410f..887602dfed 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/audioPage.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/audioPage.html @@ -1,37 +1,36 @@ <html> -<head> + <head> <title>Audio_Test_Page</title> -</head> -<body> -<p id="testContent">Page content: audio player</p> + </head> + <body> + <p id="testContent">Page content: audio player</p> -<div class="audioPlayer"> - <audio id="audioSample" controls loop> - <source src="resources/audioSample.mp3"> - </audio> -</div> + <div class="audioPlayer"> + <audio id="audioSample" controls loop> + <source src="resources/audioSample.mp3" /> + </audio> + </div> -<div class="playbackState"> -</div> + <div class="playbackState"></div> -<script> - const audio = document.querySelector('audio'); - var showPlayingAlert=true; + <script> + const audio = document.querySelector("audio"); + var showPlayingAlert = true; - audio.addEventListener('playing', (event) => { - <!--document.querySelector('.playbackState').innerText="Media file is playing"--> - <!--Need this hack to verify that the video is playing,--> - <!--the test cannot currently verify the text displayed on the page--> - if(showPlayingAlert===true){ - showPlayingAlert=false; - alert("Media file is playing"); - } - }); + audio.addEventListener("playing", event => { + <!--document.querySelector('.playbackState').innerText="Media file is playing"--> + <!--Need this hack to verify that the video is playing,--> + <!--the test cannot currently verify the text displayed on the page--> + if (showPlayingAlert === true) { + showPlayingAlert = false; + alert("Media file is playing"); + } + }); - audio.addEventListener('pause', (event) => { + audio.addEventListener("pause", event => { <!--document.querySelector('.playbackState').innerText="Media file is paused"--> alert("Media file is paused"); - }); -</script> -</body> + }); + </script> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/cross-site-cookies.html b/mobile/android/focus-android/app/src/androidTest/assets/cross-site-cookies.html index 5cf99f3881..82531c202f 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/cross-site-cookies.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/cross-site-cookies.html @@ -1,12 +1,16 @@ -<!DOCTYPE HTML> +<!DOCTYPE html> <!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> <html> -<meta name="viewport" content="width=device-width"> -<body> -<h3>known-tracker.englehardt-tracker.com</h3> -<h4>different site, cross-origin iframe, on blocklist</h4> -<iframe width=500 height=600 src="https://known-tracker.englehardt-tracker.com/set_storage_simple.html"></iframe> -</body> + <meta name="viewport" content="width=device-width" /> + <body> + <h3>known-tracker.englehardt-tracker.com</h3> + <h4>different site, cross-origin iframe, on blocklist</h4> + <iframe + width="500" + height="600" + src="https://known-tracker.englehardt-tracker.com/set_storage_simple.html" + ></iframe> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/etpPages/adsTrackers.html b/mobile/android/focus-android/app/src/androidTest/assets/etpPages/adsTrackers.html index b8e0f7bc55..f043cdc7ce 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/etpPages/adsTrackers.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/etpPages/adsTrackers.html @@ -1,21 +1,22 @@ -<!DOCTYPE HTML> +<!DOCTYPE html> <!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> <html dir="ltr" xml:lang="en-US" lang="en-US"> -<meta name="viewport" content="width=device-width"> -<head> - <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width" /> + <head> + <meta charset="UTF-8" /> <title>adsTrackers</title> -</head> -<body> -<!--Level 1 Tracker blocking with separate lists (social-track-digest256,ads-track-digest256,analytics-track-digest256).--> -<!--using the https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html test page--> -<p>ads trackers:</p> -<p>if you can read this, then: </p> -<p>ads trackers not blocked</p> -<img - src="https://ads-track-digest256.dummytracker.org/test_not_blocked.png" - onerror="this.onerror=null;this.src='https://not-a-tracker.dummytracker.org/test_blocked.png';alert('ads trackers blocked')"> -</body> + </head> + <body> + <!--Level 1 Tracker blocking with separate lists (social-track-digest256,ads-track-digest256,analytics-track-digest256).--> + <!--using the https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html test page--> + <p>ads trackers:</p> + <p>if you can read this, then:</p> + <p>ads trackers not blocked</p> + <img + src="https://ads-track-digest256.dummytracker.org/test_not_blocked.png" + onerror="this.onerror=null;this.src='https://not-a-tracker.dummytracker.org/test_blocked.png';alert('ads trackers blocked')" + /> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/etpPages/analyticsTrackers.html b/mobile/android/focus-android/app/src/androidTest/assets/etpPages/analyticsTrackers.html index e97a7e35c6..69e617f495 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/etpPages/analyticsTrackers.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/etpPages/analyticsTrackers.html @@ -1,21 +1,22 @@ -<!DOCTYPE HTML> +<!DOCTYPE html> <!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> <html dir="ltr" xml:lang="en-US" lang="en-US"> -<meta name="viewport" content="width=device-width"> -<head> - <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width" /> + <head> + <meta charset="UTF-8" /> <title>analyticsTrackers</title> -</head> -<body> -<!--Level 1 Tracker blocking with separate lists (social-track-digest256,ads-track-digest256,analytics-track-digest256).--> -<!--using the https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html test page--> -<p>analytics trackers</p> -<p>if you can read this, then: </p> -<p>analytics trackers not blocked</p> -<img - src="https://analytics-track-digest256.dummytracker.org/test_not_blocked.png" - onerror="this.onerror=null;this.src='https://not-a-tracker.dummytracker.org/test_blocked.png';alert('analytics trackers blocked')"> -</body> + </head> + <body> + <!--Level 1 Tracker blocking with separate lists (social-track-digest256,ads-track-digest256,analytics-track-digest256).--> + <!--using the https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html test page--> + <p>analytics trackers</p> + <p>if you can read this, then:</p> + <p>analytics trackers not blocked</p> + <img + src="https://analytics-track-digest256.dummytracker.org/test_not_blocked.png" + onerror="this.onerror=null;this.src='https://not-a-tracker.dummytracker.org/test_blocked.png';alert('analytics trackers blocked')" + /> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/etpPages/otherTrackers.html b/mobile/android/focus-android/app/src/androidTest/assets/etpPages/otherTrackers.html index 5e4bd63a78..c7c42dde5c 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/etpPages/otherTrackers.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/etpPages/otherTrackers.html @@ -1,22 +1,23 @@ -<!DOCTYPE HTML> +<!DOCTYPE html> <!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> <html dir="ltr" xml:lang="en-US" lang="en-US"> -<meta name="viewport" content="width=device-width"> -<head> - <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width" /> + <head> + <meta charset="UTF-8" /> <title>otherTrackers</title> -</head> -<body> -<!--Level 1 Tracker blocking with separate lists (social-track-digest256,ads-track-digest256,analytics-track-digest256).--> -<!--using the https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html test page--> -<h3>Level 2 (Strict List) Tracker Blocking</h3> -<p>other content trackers</p> -<p>if you can read this, then: </p> -<p>other content trackers not blocked</p> -<img - src="https://content-track-digest256.dummytracker.org/test_not_blocked.png" - onerror="this.onerror=null;this.src='https://not-a-tracker.dummytracker.org/test_blocked.png';alert('other content trackers blocked')"> -</body> + </head> + <body> + <!--Level 1 Tracker blocking with separate lists (social-track-digest256,ads-track-digest256,analytics-track-digest256).--> + <!--using the https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html test page--> + <h3>Level 2 (Strict List) Tracker Blocking</h3> + <p>other content trackers</p> + <p>if you can read this, then:</p> + <p>other content trackers not blocked</p> + <img + src="https://content-track-digest256.dummytracker.org/test_not_blocked.png" + onerror="this.onerror=null;this.src='https://not-a-tracker.dummytracker.org/test_blocked.png';alert('other content trackers blocked')" + /> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/etpPages/socialTrackers.html b/mobile/android/focus-android/app/src/androidTest/assets/etpPages/socialTrackers.html index 5f1afd19aa..fbbb2144b6 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/etpPages/socialTrackers.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/etpPages/socialTrackers.html @@ -1,21 +1,22 @@ -<!DOCTYPE HTML> +<!DOCTYPE html> <!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> <html dir="ltr" xml:lang="en-US" lang="en-US"> -<meta name="viewport" content="width=device-width"> -<head> - <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width" /> + <head> + <meta charset="UTF-8" /> <title>socialTrackers</title> -</head> -<body> -<!--Level 1 Tracker blocking with separate lists (social-track-digest256,ads-track-digest256,analytics-track-digest256).--> -<!--using the https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html test page--> -<p>social trackers</p> -<p>if you can read this, then: </p> -<p>social trackers not blocked</p> -<img - src="https://social-track-digest256.dummytracker.org/test_not_blocked.png" - onerror="this.onerror=null;this.src='https://not-a-tracker.dummytracker.org/test_blocked.png';alert('social trackers blocked')"> -</body> + </head> + <body> + <!--Level 1 Tracker blocking with separate lists (social-track-digest256,ads-track-digest256,analytics-track-digest256).--> + <!--using the https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html test page--> + <p>social trackers</p> + <p>if you can read this, then:</p> + <p>social trackers not blocked</p> + <img + src="https://social-track-digest256.dummytracker.org/test_not_blocked.png" + onerror="this.onerror=null;this.src='https://not-a-tracker.dummytracker.org/test_blocked.png';alert('social trackers blocked')" + /> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/genericPage.html b/mobile/android/focus-android/app/src/androidTest/assets/genericPage.html index 46f36bf6d1..0ab2034c3f 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/genericPage.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/genericPage.html @@ -1,15 +1,14 @@ <!DOCTYPE html> <html> -<head> - <meta charset="UTF-8"> + <head> + <meta charset="UTF-8" /> <!-- random words that should not end up on disk --> <title>GenericPage</title> -</head> -<body> -<h1 id="header">focus test page</h1> -<!-- More random words that should not end up on disk --> -<p>groovy rabbits</p> -<p>This test page does nothing.</p> - -</body> + </head> + <body> + <h1 id="header">focus test page</h1> + <!-- More random words that should not end up on disk --> + <p>groovy rabbits</p> + <p>This test page does nothing.</p> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/global_privacy_control.html b/mobile/android/focus-android/app/src/androidTest/assets/global_privacy_control.html index e08df8c17f..d8961ebc0a 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/global_privacy_control.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/global_privacy_control.html @@ -1,15 +1,14 @@ <!DOCTYPE html> <html> -<meta name="viewport" content="width=device-width"> -<body> -<script type = "text/javascript" > - const gpcValue = navigator.globalPrivacyControl - if (gpcValue) { - document.write('<p>GPC is enabled.</p>'); - } else { - document.write('<p>GPC not enabled.</p>'); - } -</script> - -</body> + <meta name="viewport" content="width=device-width" /> + <body> + <script type="text/javascript"> + const gpcValue = navigator.globalPrivacyControl; + if (gpcValue) { + document.write("<p>GPC is enabled.</p>"); + } else { + document.write("<p>GPC not enabled.</p>"); + } + </script> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/htmlControls.html b/mobile/android/focus-android/app/src/androidTest/assets/htmlControls.html index 3677417a28..90eee7dd3d 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/htmlControls.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/htmlControls.html @@ -1,43 +1,45 @@ <!DOCTYPE html> <html> -<head> + <head> <title>Html_Control_Form</title> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width"> -</head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width" /> + </head> -<p>Misc Link Types</p> -<section> + <p>Misc Link Types</p> + <section> <a href="https://duckduckgo.com/">External link</a> -</section> + </section> -<section> + <section> <a href="mailto://example@example.com">Email link</a> <a href="tel://1234567890">Telephone link</a> -</section> + </section> -<p>Drop-down Form</p> -<select id="dropDown"> + <p>Drop-down Form</p> + <select id="dropDown"> <option type="text" text="The Only Ones">The Only Ones</option> <option type="text" text="The National">The National</option> -</select> -<button onclick="printOption()" id="submitOption"> Submit drop down option </button> -<div id="displayOption"></div> + </select> + <button onclick="printOption()" id="submitOption"> + Submit drop down option + </button> + <div id="displayOption"></div> -<section> - <p>Copy <input type="text" placeholder="and Paste" id="textInput"> me</p> - <button onclick="printInput()" id="submitInput"> Submit input </button> + <section> + <p>Copy <input type="text" placeholder="and Paste" id="textInput" /> me</p> + <button onclick="printInput()" id="submitInput">Submit input</button> <div id="displayInput"></div> -</section> + </section> -<p>Calendar Form</p> -<section> - <input type="date" id="calendar"> - <button onclick="printDate()" id="submitDate"> Submit date </button> + <p>Calendar Form</p> + <section> + <input type="date" id="calendar" /> + <button onclick="printDate()" id="submitDate">Submit date</button> <div id="displayDate"></div> -</section> + </section> -<script> + <script> function printOption() { let dropDown = document.querySelector("#dropDown"); let displayOption = document.querySelector("#displayOption"); @@ -46,7 +48,7 @@ } </script> -<script> + <script> function printInput() { let textInput = document.querySelector("#textInput"); let displayInput = document.querySelector("#displayInput"); @@ -55,7 +57,7 @@ } </script> -<script> + <script> function printDate() { let calendar = document.querySelector("#calendar"); let displayDate = document.querySelector("#displayDate"); diff --git a/mobile/android/focus-android/app/src/androidTest/assets/image_test.html b/mobile/android/focus-android/app/src/androidTest/assets/image_test.html index ea8ea10f53..a155e6c438 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/image_test.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/image_test.html @@ -1,20 +1,31 @@ <!DOCTYPE html> <html> -<head> - <meta charset="UTF-8"> + <head> + <meta charset="UTF-8" /> <!-- random words that should not end up on disk --> <title>gigantic experience</title> -</head> -<body> -<h1 id="header">focus test page</h1> + </head> + <body> + <h1 id="header">focus test page</h1> -<!-- More random words that should not end up on disk --> -<p>groovy rabbits</p> -<img id="rabbitImage" src="rabbit.jpg" alt="rabbit.jpg" width="251" height="201"> + <!-- More random words that should not end up on disk --> + <p>groovy rabbits</p> + <img + id="rabbitImage" + src="rabbit.jpg" + alt="rabbit.jpg" + width="251" + height="201" + /> -<a id="download" href="download.jpg" download="mozillaLogo"> - <img border="0" src="download.jpg" alt="download icon" width="104" height="142"> -</a> - -</body> + <a id="download" href="download.jpg" download="mozillaLogo"> + <img + border="0" + src="download.jpg" + alt="download icon" + width="104" + height="142" + /> + </a> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/mutedVideoPage.html b/mobile/android/focus-android/app/src/androidTest/assets/mutedVideoPage.html index 8c4fbfc686..9283ff296b 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/mutedVideoPage.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/mutedVideoPage.html @@ -1,53 +1,52 @@ <html> -<head> + <head> <title>Muted_Video_Test_Page</title> -</head> -<body> -<p id="testContent">Page content: muted video player</p> -<div class="playbackState"> -</div> -<div id="video-container" style="text-align:center"> - <button onclick="play()">Play</button> - <button onclick="pause()">Pause</button> - <button onclick="fullscreen()">Full Screen</button> - <br><br> - <video id="mutedVideo" width="420" autoplay muted controls loop> - <source src="resources/clip.mp4" type="video/mp4"> + </head> + <body> + <p id="testContent">Page content: muted video player</p> + <div class="playbackState"></div> + <div id="video-container" style="text-align: center"> + <button onclick="play()">Play</button> + <button onclick="pause()">Pause</button> + <button onclick="fullscreen()">Full Screen</button> + <br /><br /> + <video id="mutedVideo" width="420" autoplay muted controls loop> + <source src="resources/clip.mp4" type="video/mp4" /> Your browser does not support HTML video. - </video> -</div> + </video> + </div> -<script> - const mutedVideo = document.getElementById("mutedVideo"); + <script> + const mutedVideo = document.getElementById("mutedVideo"); - function play() { + function play() { mutedVideo.play(); - } + } - function pause() { + function pause() { mutedVideo.pause(); - } + } - function fullscreen() { + function fullscreen() { mutedVideo.requestFullscreen(); - } + } - var showPlayAlert=true; + var showPlayAlert = true; - mutedVideo.addEventListener('playing', (event) => { - <!-- document.querySelector('.playbackState').innerHTML="Media file is playing";--> - <!-- Need this hack to verify that the video is playing, --> - <!-- the test cannot currently verify the text displayed on the page--> - if(showPlayAlert===true){ - showPlayAlert=false; - alert("Media file is playing"); - } - }); + mutedVideo.addEventListener("playing", event => { + <!-- document.querySelector('.playbackState').innerHTML="Media file is playing";--> + <!-- Need this hack to verify that the video is playing, --> + <!-- the test cannot currently verify the text displayed on the page--> + if (showPlayAlert === true) { + showPlayAlert = false; + alert("Media file is playing"); + } + }); - mutedVideo.addEventListener('pause', (event) => { - // document.querySelector('.playbackState').innerHTML="Media file is paused"; - alert("Media file is paused"); - }); -</script> -</body> + mutedVideo.addEventListener("pause", event => { + // document.querySelector('.playbackState').innerHTML="Media file is paused"; + alert("Media file is paused"); + }); + </script> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/same-site-cookies.html b/mobile/android/focus-android/app/src/androidTest/assets/same-site-cookies.html index dd4fa31be7..07e75434a6 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/same-site-cookies.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/same-site-cookies.html @@ -1,125 +1,139 @@ -<!DOCTYPE HTML> +<!DOCTYPE html> <!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> <html lang="en-US" dir="ltr"> -<head> - <meta name="viewport" content="width=device-width"> - <script src="https://cdn.jsdelivr.net/npm/idb-keyval@3/dist/idb-keyval-iife.min.js"></script> -</head> -<body> -<button onclick="setAllStorageLocations();">Rerun Tests</button> -<br> -<h4>cookies</h4> -<pre id="cookie_message"></pre> + <head> + <meta name="viewport" content="width=device-width" /> + <script src="https://cdn.jsdelivr.net/npm/idb-keyval@3/dist/idb-keyval-iife.min.js"></script> + </head> + <body> + <button onclick="setAllStorageLocations();">Rerun Tests</button> + <br /> + <h4>cookies</h4> + <pre id="cookie_message"></pre> -<h4>localStorage</h4> -<pre id="ls_message"></pre> + <h4>localStorage</h4> + <pre id="ls_message"></pre> -<!-- + <!-- <h4>sessionStorage</h4> <pre id="ss_message"></pre> <h4>Indexed DB</h4> <pre id="idb_message"></pre> --> -<!-- Storage access API --> -<br /> -<h4>Storage Access API</h4> -<button onclick='requestSA()'>requestStorageAccess()</button><br /> -<p>Return value of requestStorageAccess():</p><pre id='request_storage_access'>not yet called</pre><br /> -<button onclick='hasSA()'>hasStorageAccess()</button><br /> -<p>Return value of hasStorageAccess():</p><pre id='has_storage_access'>not yet called</pre><br /> + <!-- Storage access API --> + <br /> + <h4>Storage Access API</h4> + <button onclick="requestSA()">requestStorageAccess()</button><br /> + <p>Return value of requestStorageAccess():</p> + <pre id="request_storage_access">not yet called</pre> + <br /> + <button onclick="hasSA()">hasStorageAccess()</button><br /> + <p>Return value of hasStorageAccess():</p> + <pre id="has_storage_access">not yet called</pre> + <br /> + <script> + var newRandVal = Math.random(); -<script> - var newRandVal = Math.random(); - - function outputResult(value, output_id) { - var msg = document.getElementById(output_id); - document.hasStorageAccess().then( - (hasStorageAccess) => { - if (hasStorageAccess === false) { - msg.innerHTML = "BLOCKED"; - } else if (value === "" & hasStorageAccess === true) { - msg.innerHTML = "UNEXPECTED. We have storage access but value is empty..."; - } else if (hasStorageAccess === true) { - msg.innerHTML = "UNRESTRICTED"; - } - }, - (reason) => {msg.innerHTML = 'promise rejected for reason' + reason} - ); - } - - function setCookies() { - var cookies = document.cookie; - if (cookies === "") { - document.cookie = 'foo='+newRandVal+'; SameSite=None; Secure'; - cookies = document.cookie; - } - outputResult(cookies, 'cookie_message'); - } - function setLocalStorage() { - try { - var foo = window.localStorage.getItem('foo'); - if (foo === null) { - window.localStorage.setItem('foo', newRandVal); - foo = window.localStorage.getItem('foo'); + function outputResult(value, output_id) { + var msg = document.getElementById(output_id); + document.hasStorageAccess().then( + hasStorageAccess => { + if (hasStorageAccess === false) { + msg.innerHTML = "BLOCKED"; + } else if ((value === "") & (hasStorageAccess === true)) { + msg.innerHTML = + "UNEXPECTED. We have storage access but value is empty..."; + } else if (hasStorageAccess === true) { + msg.innerHTML = "UNRESTRICTED"; } - } catch (error) { - foo = ""; + }, + reason => { + msg.innerHTML = "promise rejected for reason" + reason; } - outputResult(foo, 'ls_message'); + ); + } + + function setCookies() { + var cookies = document.cookie; + if (cookies === "") { + document.cookie = "foo=" + newRandVal + "; SameSite=None; Secure"; + cookies = document.cookie; } - function setSessionStorage() { - try { - var foo = window.sessionStorage.getItem('foo'); - if (foo === null) { - window.sessionStorage.setItem('foo', newRandVal); - foo = window.sessionStorage.getItem('foo'); - } - } catch (error) { - foo = ""; + outputResult(cookies, "cookie_message"); + } + function setLocalStorage() { + try { + var foo = window.localStorage.getItem("foo"); + if (foo === null) { + window.localStorage.setItem("foo", newRandVal); + foo = window.localStorage.getItem("foo"); } - outputResult(foo, 'ss_message'); + } catch (error) { + foo = ""; } - async function setIndexedDB() { - try { - var foo = await idbKeyval.get('foo'); - if (foo === undefined) { - await idbKeyval.set('foo', newRandVal); - foo = await idbKeyval.get('foo'); - } - } catch (error) { - foo = ""; + outputResult(foo, "ls_message"); + } + function setSessionStorage() { + try { + var foo = window.sessionStorage.getItem("foo"); + if (foo === null) { + window.sessionStorage.setItem("foo", newRandVal); + foo = window.sessionStorage.getItem("foo"); } - outputResult(foo, 'idb_message'); + } catch (error) { + foo = ""; } - function setAllStorageLocations() { - setCookies(); - setLocalStorage(); - //setSessionStorage(); - //setIndexedDB(); + outputResult(foo, "ss_message"); + } + async function setIndexedDB() { + try { + var foo = await idbKeyval.get("foo"); + if (foo === undefined) { + await idbKeyval.set("foo", newRandVal); + foo = await idbKeyval.get("foo"); + } + } catch (error) { + foo = ""; } - setAllStorageLocations(); + outputResult(foo, "idb_message"); + } + function setAllStorageLocations() { + setCookies(); + setLocalStorage(); + //setSessionStorage(); + //setIndexedDB(); + } + setAllStorageLocations(); - // Storage Access API - function requestSA() { - var result = document.getElementById('request_storage_access'); - document.requestStorageAccess().then( - () => {result.innerHTML = 'access granted'}, - () => {result.innerHTML = 'access denied'} - ); - } + // Storage Access API + function requestSA() { + var result = document.getElementById("request_storage_access"); + document.requestStorageAccess().then( + () => { + result.innerHTML = "access granted"; + }, + () => { + result.innerHTML = "access denied"; + } + ); + } - function hasSA() { - var result = document.getElementById('has_storage_access'); - document.hasStorageAccess().then( - (hasAccess) => {result.innerHTML = hasAccess}, - (reason) => {result.innerHTML = 'promise rejected for reason' + reason} - ); - } - hasSA(); - </script> -</body> + function hasSA() { + var result = document.getElementById("has_storage_access"); + document.hasStorageAccess().then( + hasAccess => { + result.innerHTML = hasAccess; + }, + reason => { + result.innerHTML = "promise rejected for reason" + reason; + } + ); + } + hasSA(); + </script> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/storage_check.html b/mobile/android/focus-android/app/src/androidTest/assets/storage_check.html index c52cae9b7b..dc7cdc0248 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/storage_check.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/storage_check.html @@ -1,23 +1,21 @@ <!DOCTYPE html> <html> -<meta name="viewport" content="width=device-width"> -<body> + <meta name="viewport" content="width=device-width" /> + <body> + <h1>Storage check</h1> -<h1>Storage check</h1> + <script type="text/javascript"> + if (sessionStorage.getItem("focusSessionTest") == "caterpillar") { + document.write("<p>Session storage has value</p>"); + } else { + document.write("<p>Session storage empty</p>"); + } -<script type="text/javascript"> - if (sessionStorage.getItem('focusSessionTest') == 'caterpillar') { - document.write('<p>Session storage has value</p>'); - } else { - document.write('<p>Session storage empty</p>'); - } - - if (localStorage.getItem('focusLocalTest') == 'caterpillar') { - document.write('<p>Local storage has value</p>'); - } else { - document.write('<p>Local storage empty</p>'); - } -</script> - -</body> + if (localStorage.getItem("focusLocalTest") == "caterpillar") { + document.write("<p>Local storage has value</p>"); + } else { + document.write("<p>Local storage empty</p>"); + } + </script> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/storage_start.html b/mobile/android/focus-android/app/src/androidTest/assets/storage_start.html index e88f7f06d1..2387b21243 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/storage_start.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/storage_start.html @@ -1,28 +1,30 @@ <!DOCTYPE html> <html> -<meta name="viewport" content="width=device-width"> -<body> + <meta name="viewport" content="width=device-width" /> + <body> + <h1>Storage Start</h1> -<h1>Storage Start</h1> + <p id="cookies"></p> + <button id="setCookies">Set cookies</button> -<p id="cookies"></p> -<button id="setCookies">Set cookies</button> + <script type="text/javascript"> + (function () { + document.getElementById("cookies").textContent = document.cookie + ? document.cookie + : "No cookies set"; + })(); -<script type="text/javascript"> - (function() { - document.getElementById("cookies").textContent = document.cookie?document.cookie:"No cookies set"; - })(); + document + .getElementById("setCookies") + .addEventListener("click", function () { + document.cookie = "user=android"; + document.getElementById("cookies").textContent = document.cookie; + }); - document.getElementById("setCookies").addEventListener("click", function() { - document.cookie = "user=android"; - document.getElementById("cookies").textContent = document.cookie; - }); + sessionStorage.setItem("focusSessionTest", "caterpillar"); + localStorage.setItem("focusLocalTest", "butterfly"); - sessionStorage.setItem('focusSessionTest', 'caterpillar'); - localStorage.setItem('focusLocalTest', 'butterfly'); - - document.write('<p>Values written to storage</p>'); -</script> - -</body> + document.write("<p>Values written to storage</p>"); + </script> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/tab1.html b/mobile/android/focus-android/app/src/androidTest/assets/tab1.html index 4a9c8ce88e..c788eae33e 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/tab1.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/tab1.html @@ -1,11 +1,11 @@ <!DOCTYPE html> <html> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width" /> <title>tab1</title> -</head> -<body> + </head> + <body> <h1 id="content">Tab 1</h1> <a href="tab2.html" id="tab2">Tab 2</a> @@ -14,16 +14,17 @@ <!-- here we display if the page is in mobile or desktop view mode --> <p id="viewMode"></p> -</body> -<script> -window.mobileCheck = function() { - let check = false; - (function(a){ - if (a.includes("Android")) - check = true; - }) (navigator.userAgent) - return check; -}; -document.getElementById('viewMode').textContent=mobileCheck()? "mobile-site":"desktop-site"; -</script> + </body> + <script> + window.mobileCheck = function () { + let check = false; + (function (a) { + if (a.includes("Android")) check = true; + })(navigator.userAgent); + return check; + }; + document.getElementById("viewMode").textContent = mobileCheck() + ? "mobile-site" + : "desktop-site"; + </script> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/tab2.html b/mobile/android/focus-android/app/src/androidTest/assets/tab2.html index be5f65e6a5..e38e6ba985 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/tab2.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/tab2.html @@ -1,16 +1,14 @@ <!DOCTYPE html> <html> -<head> - <meta charset="UTF-8"> + <head> + <meta charset="UTF-8" /> <title>tab2</title> -</head> -<body> - + </head> + <body> <h1 id="content">Tab 2</h1> <a href="tab1.html" id="tab1">Tab 1</a> <a href="tab3.html" id="tab3">Tab 3</a> - -</body> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/tab3.html b/mobile/android/focus-android/app/src/androidTest/assets/tab3.html index fc8c08446c..651afe13c1 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/tab3.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/tab3.html @@ -1,11 +1,10 @@ <!DOCTYPE html> <html> -<head> - <meta charset="UTF-8"> + <head> + <meta charset="UTF-8" /> <title>tab3</title> -</head> -<body> - + </head> + <body> <h1 id="content">Tab 3</h1> <a href="tab2.html" id="tab1">Tab 1</a> @@ -13,8 +12,9 @@ <a href="tab3.html" id="tab2">Tab 2</a> <p> - <a href="https://www.youtube.com/c/MozillaChannel/videos">Mozilla Youtube link</a> + <a href="https://www.youtube.com/c/MozillaChannel/videos" + >Mozilla Youtube link</a + > </p> - -</body> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/test.html b/mobile/android/focus-android/app/src/androidTest/assets/test.html index 7273622e6f..ad8eea883d 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/test.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/test.html @@ -1,38 +1,48 @@ <!DOCTYPE html> <html> -<head> - <meta charset="UTF-8"> + <head> + <meta charset="UTF-8" /> <!-- random words that should not end up on disk --> <title>gigantic experience</title> -</head> -<body> -<h1>focus test page</h1> -<!-- More random words that should not end up on disk --> -<p>groovy rabbits</p> -<p>This test page installs a service worker and saves a cookie.</p> + </head> + <body> + <h1>focus test page</h1> + <!-- More random words that should not end up on disk --> + <p>groovy rabbits</p> + <p>This test page installs a service worker and saves a cookie.</p> -<h2 id="cookieHeading">Cookie</h2> -<p>Initial: <script type="text/javascript">document.write(document.cookie);</script></p> -<p> - <!-- Setting a cookie --> - <script type="text/javascript"> - document.cookie = "birthday=armchair; expires=Tue, 18 Dec 2035 12:00:00 UTC; path=/"; - document.write("Cookie saved"); - </script> -</p> -<p>Afterwards: <script type="text/javascript">document.write(document.cookie);</script></p> + <h2 id="cookieHeading">Cookie</h2> + <p> + Initial: + <script type="text/javascript"> + document.write(document.cookie); + </script> + </p> + <p> + <!-- Setting a cookie --> + <script type="text/javascript"> + document.cookie = + "birthday=armchair; expires=Tue, 18 Dec 2035 12:00:00 UTC; path=/"; + document.write("Cookie saved"); + </script> + </p> + <p> + Afterwards: + <script type="text/javascript"> + document.write(document.cookie); + </script> + </p> -<h2>Service worker</h2> -<p id="status"></p> + <h2>Service worker</h2> + <p id="status"></p> -<script type="text/javascript"> - // Add a key value pair to local storage. This is required by WebViewDataTest which asserts - // that the local storage directory should exist - var script = document.createElement('script'); - script.src = "service-worker.js"; + <script type="text/javascript"> + // Add a key value pair to local storage. This is required by WebViewDataTest which asserts + // that the local storage directory should exist + var script = document.createElement("script"); + script.src = "service-worker.js"; - document.head.appendChild(script); //or something of the likes + document.head.appendChild(script); //or something of the likes </script> - -</body> + </body> </html> diff --git a/mobile/android/focus-android/app/src/androidTest/assets/videoPage.html b/mobile/android/focus-android/app/src/androidTest/assets/videoPage.html index cd352268b3..01aaafab5b 100644 --- a/mobile/android/focus-android/app/src/androidTest/assets/videoPage.html +++ b/mobile/android/focus-android/app/src/androidTest/assets/videoPage.html @@ -1,53 +1,52 @@ <html> -<head> + <head> <title>Video_Test_Page</title> -</head> -<body> -<p id="testContent">Page content: video player</p> -<div class="playbackState"> -</div> -<div id="video-container" style="text-align:center"> - <button onclick="play()">Play</button> - <button onclick="pause()">Pause</button> - <button onclick="fullscreen()">Full Screen</button> - <br><br> - <video id="video" width="420" autoplay controls loop> - <source src="resources/clip.mp4" type="video/mp4"> + </head> + <body> + <p id="testContent">Page content: video player</p> + <div class="playbackState"></div> + <div id="video-container" style="text-align: center"> + <button onclick="play()">Play</button> + <button onclick="pause()">Pause</button> + <button onclick="fullscreen()">Full Screen</button> + <br /><br /> + <video id="video" width="420" autoplay controls loop> + <source src="resources/clip.mp4" type="video/mp4" /> Your browser does not support HTML video. - </video> -</div> + </video> + </div> -<script> - const video = document.getElementById("video"); + <script> + const video = document.getElementById("video"); - function play() { + function play() { video.play(); - } + } - function pause() { + function pause() { video.pause(); - } + } - function fullscreen() { + function fullscreen() { video.requestFullscreen(); - } + } - var showPlayingAlert=true; + var showPlayingAlert = true; - video.addEventListener('playing', (event) => { - <!-- document.querySelector('.playbackState').innerHTML="Media file is playing";--> - <!-- Need this hack to verify that the video is playing, --> - <!-- the test cannot currently verify the text displayed on the page--> - if(showPlayingAlert===true){ - showPlayingAlert=false; - alert("Media file is playing"); - } - }); + video.addEventListener("playing", event => { + <!-- document.querySelector('.playbackState').innerHTML="Media file is playing";--> + <!-- Need this hack to verify that the video is playing, --> + <!-- the test cannot currently verify the text displayed on the page--> + if (showPlayingAlert === true) { + showPlayingAlert = false; + alert("Media file is playing"); + } + }); - video.addEventListener('pause', (event) => { - // document.querySelector('.playbackState').innerHTML="Media file is paused"; - alert("Media file is paused"); - }); -</script> -</body> + video.addEventListener("pause", event => { + // document.querySelector('.playbackState').innerHTML="Media file is paused"; + alert("Media file is paused"); + }); + </script> + </body> </html> |