diff options
Diffstat (limited to 'android_webview/tools/system_webview_shell/test/data/blink-apis')
12 files changed, 209 insertions, 0 deletions
diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/battery-status/battery-callback-expected.txt b/android_webview/tools/system_webview_shell/test/data/blink-apis/battery-status/battery-callback-expected.txt new file mode 100644 index 0000000..2d7be9a --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/battery-status/battery-callback-expected.txt @@ -0,0 +1,8 @@ +Test Battery Status API callback in WebView +batteryStatusSuccess invoked +PASS: battery.level is >= 0 +PASS: battery.level is <= 1 +PASS: battery.level.toPrecision(2) == battery.level is true +PASS: !battery.charging || battery.dischargingTime === Infinity is true +PASS: battery.charging || battery.chargingTime === Infinity is true +TEST FINISHED diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/battery-status/battery-callback.html b/android_webview/tools/system_webview_shell/test/data/blink-apis/battery-status/battery-callback.html new file mode 100644 index 0000000..fd9a2e1 --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/battery-status/battery-callback.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> + <script src="../../resources/js-test.js"></script> + <body> + <script type="text/javascript"> + description("Test Battery Status API callback in WebView"); + window.jsTestIsAsync = true; + + var battery; + function batteryStatusSuccess(batteryManager) { + debug('batteryStatusSuccess invoked'); + battery = batteryManager; + + // Validate values + shouldBeGreaterThanOrEqual('battery.level', '0'); + shouldBeLessThanOrEqual('battery.level', '1'); + // Check that level has at most 2 significant digits + shouldBeTrue('battery.level.toPrecision(2) == battery.level'); + shouldBeTrue('!battery.charging || battery.dischargingTime === Infinity'); + shouldBeTrue('battery.charging || battery.chargingTime === Infinity'); + finishJSTest(); + } + + function batteryStatusFailure() { + testFailed("failed to successfully resolve the promise"); + finishJSTest(); + } + + navigator.getBattery().then(batteryStatusSuccess, batteryStatusFailure); + </script> + </body> +</html> diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/geolocation/geolocation-permission-callbacks-expected.txt b/android_webview/tools/system_webview_shell/test/data/blink-apis/geolocation/geolocation-permission-callbacks-expected.txt new file mode 100644 index 0000000..708e1b0 --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/geolocation/geolocation-permission-callbacks-expected.txt @@ -0,0 +1,5 @@ +Test Geolocation API permission callbacks in WebView +onGeolocationPermissionsShowPrompt +geolocation request denied +onError: code=1, message=User denied Geolocation +TEST FINISHED diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/geolocation/geolocation-permission-callbacks.html b/android_webview/tools/system_webview_shell/test/data/blink-apis/geolocation/geolocation-permission-callbacks.html new file mode 100644 index 0000000..d947758 --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/geolocation/geolocation-permission-callbacks.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <script src="../../resources/js-test.js"></script> + <body> + <script type="text/javascript"> + description("Test Geolocation API permission callbacks in WebView"); + window.jsTestIsAsync = true; + + function gotPosition() { + testFailed("geolocation should have been denied"); + finishJSTest(); + } + + function onError(err) { + debug("onError: code=" + err.code + ", message=" + err.message); + finishJSTest(); + } + + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(gotPosition, onError); + } else { + debug('geolocation not supported'); + finishJSTest(); + } + </script> + </body> +</html>
\ No newline at end of file diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-expected.txt b/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-expected.txt new file mode 100644 index 0000000..a758a32 --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-expected.txt @@ -0,0 +1,6 @@ +Test navigator.requestMIDIAccess API in WebView +onPermissionRequest: android.webkit.resource.MIDI_SYSEX +request granted: android.webkit.resource.MIDI_SYSEX +PASS: access.sysexEnabled is true +PASS: requestMIDIAccess with option sysex:true succeeded. +TEST FINISHED
\ No newline at end of file diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-permission-denied-expected.html b/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-permission-denied-expected.html new file mode 100644 index 0000000..6db4ae5 --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-permission-denied-expected.html @@ -0,0 +1,5 @@ +Test navigator.requestMIDIAccess API in WebView +onPermissionRequest: android.webkit.resource.MIDI_SYSEX +request denied +PASS: requestMIDIAccess error, reason: SecurityError: An attempt was made to break through the security policy of the user agent. +TEST FINISHED
\ No newline at end of file diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-permission-denied.html b/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-permission-denied.html new file mode 100644 index 0000000..aabd8c1 --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess-permission-denied.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> + <script src="../../resources/js-test.js"></script> + <body> + <script type="text/javascript"> + description("Test navigator.requestMIDIAccess API in WebView"); + window.jsTestIsAsync = true; + + function onMIDIError(errorMessage) { + testPassed('requestMIDIAccess error, reason: ' + errorMessage); + finishJSTest(); + } + + function onMIDISuccess(stream) { + testFail('access was granted but should not have been.'); + finishJSTest(); + } + + navigator.requestMIDIAccess({sysex:true}).then( + onMIDISuccess, onMIDIError); + </script> + </body> +</html>
\ No newline at end of file diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess.html b/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess.html new file mode 100644 index 0000000..58258be --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/webmidi/requestmidiaccess.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> + <script src="../../resources/js-test.js"></script> + <body> + <script type="text/javascript"> + description("Test navigator.requestMIDIAccess API in WebView"); + window.jsTestIsAsync = true; + + function onMIDIError(errorMessage) { + testFailed('requestMIDIAccess error callback, reason: ' + errorMessage); + finishJSTest(); + } + + function onMIDISuccess(access) { + window.access = access; + shouldBeTrue('access.sysexEnabled'); + testPassed('requestMIDIAccess with option sysex:true succeeded.'); + finishJSTest(); + } + + navigator.requestMIDIAccess({sysex:true}).then( + onMIDISuccess, onMIDIError); + </script> + </body> +</html>
\ No newline at end of file diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-callbacks-expected.txt b/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-callbacks-expected.txt new file mode 100644 index 0000000..c4ebe15 --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-callbacks-expected.txt @@ -0,0 +1,7 @@ +Test MediaStream API callbacks in WebView +onPermissionRequest: android.webkit.resource.VIDEO_CAPTURE,android.webkit.resource.AUDIO_CAPTURE +request granted: android.webkit.resource.VIDEO_CAPTURE,android.webkit.resource.AUDIO_CAPTURE +PASS: getUserMedia succeeded. +PASS: track.readyState is "live" +PASS: activeStream.active is true +TEST FINISHED
\ No newline at end of file diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-callbacks.html b/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-callbacks.html new file mode 100644 index 0000000..7db56fc --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-callbacks.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <script src="../../resources/js-test.js"></script> + <body> + <script type="text/javascript"> + description("Test MediaStream API callbacks in WebView"); + window.jsTestIsAsync = true; + + function error(e) { + testFailed('getUserMedia error callback, reason: ' + e.name); + finishJSTest(); + } + + function gotStream(stream) { + testPassed('getUserMedia succeeded.'); + track = stream.getVideoTracks()[0]; + activeStream = stream; + shouldBeEqualToString('track.readyState', 'live'); + shouldBeTrue('activeStream.active'); + finishJSTest(); + } + + function getUserMedia(constraints, callback) { + try { + navigator.webkitGetUserMedia(constraints, callback, error); + } catch (e) { + testFailed('webkitGetUserMedia threw exception :' + e); + finishJSTest(); + } + } + + getUserMedia({audio:true, video:true}, gotStream); + </script> + </body> +</html>
\ No newline at end of file diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-permission-denied-callbacks-expected.txt b/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-permission-denied-callbacks-expected.txt new file mode 100644 index 0000000..e753b5a --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-permission-denied-callbacks-expected.txt @@ -0,0 +1,5 @@ +Test MediaStream API permission denied callbacks in WebView +onPermissionRequest: android.webkit.resource.VIDEO_CAPTURE,android.webkit.resource.AUDIO_CAPTURE +request denied +PASS: getUserMedia error callback, reason: PermissionDeniedError +TEST FINISHED
\ No newline at end of file diff --git a/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-permission-denied-callbacks.html b/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-permission-denied-callbacks.html new file mode 100644 index 0000000..3eef13b --- /dev/null +++ b/android_webview/tools/system_webview_shell/test/data/blink-apis/webrtc/mediastream-permission-denied-callbacks.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <script src="../../resources/js-test.js"></script> + <body> + <script type="text/javascript"> + description("Test MediaStream API permission denied callbacks in WebView"); + window.jsTestIsAsync = true; + + function error(e) { + testPassed('getUserMedia error callback, reason: ' + e.name); + finishJSTest(); + } + + function gotStream(stream) { + testFailed('getUserMedia should not have succeeded.'); + finishJSTest(); + } + + function getUserMedia(constraints, callback) { + try { + navigator.webkitGetUserMedia(constraints, callback, error); + } catch (e) { + testFailed('webkitGetUserMedia threw exception :' + e); + finishJSTest(); + } + } + + getUserMedia({audio:true, video:true}, gotStream); + </script> + </body> +</html>
\ No newline at end of file |