Index: third_party/WebKit/LayoutTests/fast/media/mq-color-gamut-api.html |
diff --git a/third_party/WebKit/LayoutTests/fast/media/mq-color-gamut-api.html b/third_party/WebKit/LayoutTests/fast/media/mq-color-gamut-api.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dba13f75457472252b60eb10c1bbb576adc03524 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/media/mq-color-gamut-api.html |
@@ -0,0 +1,35 @@ |
+<!DOCTYPE html> |
+<title>Tests for color-gamut media query</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(function() { |
+ assert_true(window.matchMedia("(color-gamut)").matches); |
+}, "Test that color-gamut can be feature detected"); |
+ |
+test(function() { |
+ assert_false(window.matchMedia("(color-gamut: foobar)").matches); |
+}, "Test that unknown values are rejected"); |
+ |
+async_test(t => { |
+ assert_true('testRunner' in window); |
+ |
+ testRunner.setColorProfile('sRGB', t.step_func(() => { |
+ assert_true(window.matchMedia("(color-gamut: srgb)").matches); |
+ assert_false(window.matchMedia("(color-gamut: p3)").matches); |
+ assert_false(window.matchMedia("(color-gamut: rec2020)").matches); |
+ |
+ testRunner.setColorProfile('colorSpin', t.step_func(() => { |
+ assert_true(window.matchMedia("(color-gamut: srgb)").matches); |
+ assert_false(window.matchMedia("(color-gamut: p3)").matches); |
+ assert_false(window.matchMedia("(color-gamut: rec2020)").matches); |
+ |
+ testRunner.setColorProfile('adobeRGB', t.step_func_done(() => { |
+ assert_true(window.matchMedia("(color-gamut: srgb)").matches); |
+ assert_true(window.matchMedia("(color-gamut: p3)").matches); |
+ assert_false(window.matchMedia("(color-gamut: rec2020)").matches); |
+ })); |
+ })); |
+ })); |
+}, "Test API with various color profile"); |
+</script> |