Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / media / mq-pointer.html
blob3eb4aa2c859c7cbc0e573c012a4b66941005104b
1 <html>
2 <head>
3 <title>Test the CSS4 media query "pointer" features.</title>
4 <style type="text/css">
6 </style>
7 <script type="text/javascript" charset="utf-8">
8 if (window.testRunner)
9 testRunner.dumpAsText();
11 function log(m) {
12 document.getElementById('results').innerHTML += m + '<br>';
15 function testQueries()
17 var queries = [
18 "(pointer)",
19 "(Pointer)",
20 "(pointer:none)",
21 "(pointer:NoNe)",
22 "(pointer:coarse)",
23 "(pointer:coARse)",
24 "(pointer:bogusvalue)",
25 "(pointer:fine)",
26 "(pointer:fInE)",
27 "(any-pointer)",
28 "(any-Pointer)",
29 "(any-pointer:none)",
30 "(any-pointer:NoNe)",
31 "(any-pointer:coarse)",
32 "(any-pointer:coARse)",
33 "(any-pointer:bogusvalue)",
34 "(any-pointer:fine)",
35 "(any-pointer:fInE)"
37 for (var index=0; index < queries.length; index++) {
38 log("Query &quot;" + queries[index] + "&quot: " +
39 window.matchMedia(queries[index]).matches);
43 function runTests()
45 if (!window.internals)
46 return;
48 log("------------- with 'coarse' pointer -------------");
49 internals.settings.setPrimaryPointerType('coarse');
50 internals.settings.setAvailablePointerTypes('coarse');
51 testQueries();
53 log("------------- with 'fine' pointer -------------");
54 internals.settings.setPrimaryPointerType('fine');
55 internals.settings.setAvailablePointerTypes('fine');
56 testQueries();
58 log("------------- with 'fine' and 'coarse' pointer, 'fine' is primary -------------");
59 internals.settings.setPrimaryPointerType('fine');
60 internals.settings.setAvailablePointerTypes('fine,coarse');
61 testQueries();
63 log("------------- with 'fine' and 'coarse' pointer, 'coarse' is primary -------------");
64 internals.settings.setPrimaryPointerType('coarse');
65 internals.settings.setAvailablePointerTypes('fine,coarse');
66 testQueries();
68 log("------------- with 'none', 'fine' and 'coarse' pointer, 'none' is primary -------------");
69 internals.settings.setPrimaryPointerType('none');
70 internals.settings.setAvailablePointerTypes('none,fine,coarse');
71 testQueries();
73 log("------------- with 'none' pointer -------------");
74 internals.settings.setPrimaryPointerType('none');
75 internals.settings.setAvailablePointerTypes('none');
76 testQueries();
79 </script>
80 </head>
81 <body onload="runTests()">
82 <p>Test the <a href="http://www.w3.org/TR/2014/WD-mediaqueries-4-20140605/#pointer">(pointer)</a> media features.
83 See <a href="http://crbug.com/136119">Bug 136119</a> for details.</p>
85 <div id="results">
86 </div>
87 </body>
88 </html>