Index: third_party/WebKit/LayoutTests/media/mediasession/mediaimage.html |
diff --git a/third_party/WebKit/LayoutTests/media/mediasession/mediaimage.html b/third_party/WebKit/LayoutTests/media/mediasession/mediaimage.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dcf76e5f5db2783c7db52642014cee1a921341e2 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/media/mediasession/mediaimage.html |
@@ -0,0 +1,48 @@ |
+<!DOCTYPE html> |
+<title>MediaImage interface</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+ console.warn("dummy log entry to avoid an empty -expected.txt in virtual/"); |
+ |
+ test(function() { |
+ var image = new MediaImage({}); |
+ assert_true(image != null); |
+ |
+ var exception = false; |
+ try { |
+ image = new MediaImage("foobar"); |
+ } catch (e) { |
+ exception = true; |
+ } |
+ assert_true(exception); |
+ |
+ exception = false; |
+ try { |
+ image = new MediaImage(42); |
+ } catch (e) { |
+ exception = true; |
+ } |
+ assert_true(exception); |
+ }, 'Test that MediaImage is constructed using a dictionary'); |
+ |
+test (function() { |
+ var image = new MediaImage({ |
+ src: 'foo', sizes: 'bar', type: 'plop'}); |
+ assert_greater_than(image.src.indexOf('foo'), -1); |
+ assert_equals(image.sizes, 'bar'); |
+ assert_equals(image.type, 'plop'); |
+}, 'Test the different values allowed in MediaImage init dictionary'); |
+ |
+test (function() { |
+ var image = new MediaImage({}); |
+ assert_equals(image.src, document.URL); |
+ assert_equals(image.sizes, ''); |
+ assert_equals(image.type, ''); |
+}, 'Test the default values for MediaImage'); |
+ |
+test (function() { |
+ var image = new MediaMetadata({ randomValueThatWillNotBeAdded: '... hopefully ;)' }); |
+ assert_equals(image.randomValueThatWillNotBeAdded, undefined); |
+}, 'Test that passing unknown values to the dictionary is a no-op'); |
+</script> |