Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fullscreen/resources/media-file.js

Issue 2898503002: Reenable feature policy control over fullscreen (Closed)
Patch Set: Reworking tests a bit Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/fullscreen/resources/media-file.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fullscreen/resources/media-file.js b/third_party/WebKit/LayoutTests/http/tests/fullscreen/resources/media-file.js
new file mode 100644
index 0000000000000000000000000000000000000000..c80abcbb6e5b8d7b0903239f8c77904eb6906fd4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/fullscreen/resources/media-file.js
@@ -0,0 +1,72 @@
+var audioCodecs = [
+ ["audio/wav", "wav"],
+ ["audio/aac", "m4a"],
+ ["audio/ogg", "oga"]
+];
+
+var videoCodecs = [
+ ["video/mp4", "mp4"],
+ ["video/ogg", "ogv"],
+ ["video/webm","webm"]
+];
+
+function findMediaFile(tagName, name) {
+ var codecs;
+ if (tagName == "audio")
+ codecs = audioCodecs;
+ else
+ codecs = videoCodecs;
+
+ var element = document.getElementsByTagName(tagName)[0];
+ if (!element)
+ element = document.createElement(tagName);
+
+ for (var i = 0; i < codecs.length; ++i) {
+ if (element.canPlayType(codecs[i][0]))
+ return name + "." + codecs[i][1];
+ }
+
+ return "";
+}
+
+function mimeTypeForExtension(extension) {
+ for (var i = 0; i < videoCodecs.length; ++i) {
+ if (extension == videoCodecs[i][1])
+ return videoCodecs[i][0];
+ }
+ for (var i = 0; i < audioCodecs.length; ++i) {
+ if (extension == audioCodecs[i][1])
+ return audioCodecs[i][0];
+ }
+
+ return "";
+}
+
+function mimeTypeForFile(filename) {
+ var lastPeriodIndex = filename.lastIndexOf(".");
+ if (lastPeriodIndex > 0)
+ return mimeTypeForExtension(filename.substring(lastPeriodIndex + 1));
+
+ return "";
+}
+
+function setSrcByTagName(tagName, src) {
+ var elements = document.getElementsByTagName(tagName);
+ if (elements) {
+ for (var i = 0; i < elements.length; ++i)
+ elements[i].src = src;
+ }
+}
+
+function setSrcById(id, src) {
+ var element = document.getElementById(id);
+ if (element)
+ element.src = src;
+}
+
+function stripExtension(filename) {
+ var lastPeriodIndex = filename.lastIndexOf(".");
+ if (lastPeriodIndex > 0)
+ return filename.substring(0, lastPeriodIndex);
+ return filename;
+}

Powered by Google App Engine
This is Rietveld 408576698