3 <title>Test CSSOM View module: MediaQueryList interface</title>
4 <script type="text/javascript" charset="utf-8">
6 if (window.layoutTestController) {
7 layoutTestController.dumpAsText();
8 layoutTestController.waitUntilDone();
9 layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
13 document.getElementById('results').innerHTML += m + '<br>';
16 function callback1(query) {
17 log("[1] - query " + query.media + " changed to " + (query.matches ? "true" : "false"));
20 function callback2(query) {
21 log("[2] - query " + query.media + " changed to " + (query.matches ? "true" : "false"));
24 function pageshow(evt)
27 // this will run only when the page is loaded for the first time.
29 windowedQuery = window.matchMedia("(-webkit-view-mode: windowed)");
30 floatingQuery = window.matchMedia("(-webkit-view-mode: floating)");
31 minimizedQuery = window.matchMedia("(-webkit-view-mode: minimized)");
32 maximizedQuery = window.matchMedia("(-webkit-view-mode: maximized)");
34 windowedQuery.addListener(callback1);
35 floatingQuery.addListener(callback1);
36 minimizedQuery.addListener(callback1);
37 maximizedQuery.addListener(callback1);
39 windowedQuery.addListener(callback2);
40 floatingQuery.addListener(callback2);
41 minimizedQuery.addListener(callback2);
42 maximizedQuery.addListener(callback2);
44 setTimeout('window.location = "data:text/html,<script>history.back()<" + "/script>"', 0);
47 // if this point is reached the page is comming from the page cache.
49 log("------------- minimized -------------");
50 layoutTestController.setViewModeMediaFeature("minimized");
51 log("------------- maximized -------------");
52 layoutTestController.setViewModeMediaFeature("maximized");
53 log("------------- windowed -------------");
54 layoutTestController.setViewModeMediaFeature("windowed");
55 log("------------- floating -------------");
56 layoutTestController.setViewModeMediaFeature("floating");
58 setTimeout(function() { if (window.layoutTestController) layoutTestController.notifyDone(); }, 0);
63 if (window.layoutTestController) {
64 layoutTestController.setViewModeMediaFeature("windowed");
65 window.onpageshow = pageshow;
71 <p>Test the MediaQueryList interface: <a href="http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface" title="CSSOM View Module">http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface</a>.</p>
72 <p>Testing page cache</p>
73 <div id="results"></div>