Chromium Code Reviews| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../../../resources/js-test.js"></script> | |
| 5 <style type="text/css"> | |
| 6 #box { | |
| 7 width: 300px; | |
| 8 height: 50px; | |
| 9 } | |
| 10 | |
| 11 .interactive { background-color: blue; } | |
| 12 | |
| 13 .interactive:hover { background-color: red; } | |
| 14 | |
| 15 .interactive:active { background-color: green; } | |
| 16 | |
| 17 .interactive:hover:active { background-color: yellow; } | |
| 18 </style> | |
| 19 </head> | |
| 20 <body> | |
| 21 <div id="box" class="interactive">Gestures go here</div> | |
| 22 | |
| 23 <p id="description"></p> | |
| 24 <p>See http://crbug.com/316974 for details</p> | |
| 25 | |
| 26 <div id="console"></div> | |
| 27 | |
| 28 <script> | |
| 29 if (window.internals) { | |
| 30 internals.settings.setViewportEnabled(true); | |
| 31 internals.settings.setViewportMetaEnabled(true); | |
| 32 | |
| 33 // Now append meta tag so that it is handled properly | |
| 34 var meta = document.createElement('meta'); | |
| 35 meta.name = 'viewport'; | |
| 36 meta.content = 'initial-scale=1, maximum-scale=2'; | |
| 37 document.head.appendChild(meta); | |
| 38 } | |
| 39 | |
| 40 var color; | |
| 41 | |
| 42 function isBoxOfColor(id, givenColor) | |
| 43 { | |
| 44 var b = document.getElementById(id); | |
| 45 color = window.getComputedStyle(b).backgroundColor; | |
| 46 if (color == givenColor) | |
| 47 return true; | |
| 48 | |
| 49 testFailed('Box had backgroundColor: ' + color); | |
| 50 return false; | |
| 51 } | |
| 52 | |
| 53 function isBoxHoverActive(id) | |
| 54 { | |
| 55 return isBoxOfColor(id, "rgb(255, 255, 0)"); | |
| 56 } | |
| 57 | |
| 58 function isBoxDefault(id) | |
| 59 { | |
| 60 return isBoxOfColor(id, "rgb(0, 0, 255)"); | |
| 61 } | |
| 62 | |
| 63 description("Tests that gesture tapdown doesn't set hover/active when page is pi nchable."); | |
| 64 | |
| 65 function runTests() | |
| 66 { | |
| 67 if (!window.eventSender) { | |
| 68 debug('This test requires DRT.'); | |
| 69 return; | |
| 70 } | |
| 71 | |
| 72 if (!eventSender.gestureTapDown | |
| 73 || !eventSender.gestureShowPress) { | |
| 74 debug('Gesture events are not supported by this platform'); | |
| 75 return; | |
| 76 } | |
| 77 | |
| 78 /* Verify behaviour when page is pinchable */ | |
| 
 
Rick Byers
2014/02/21 03:35:52
does this really need to be a separate test (there
 
Zeeshan Qureshi
2014/02/24 03:14:26
Not really, I was just skeptical that adding too m
 
 | |
| 79 debug("Verify hover, active aren't initially set (page isn't scrollable)."); | |
| 80 shouldBeTrue("isBoxDefault('box')"); | |
| 81 | |
| 82 debug("tapdown on element should activate."); | |
| 83 eventSender.gestureTapDown(50, 25); | |
| 84 shouldBeTrue("isBoxDefault('box')"); | |
| 85 | |
| 86 debug("showpress on element should keep hover and active."); | |
| 87 eventSender.gestureShowPress(50, 25); | |
| 88 shouldBeTrue("isBoxHoverActive('box')"); | |
| 89 } | |
| 90 | |
| 91 runTests(); | |
| 92 </script> | |
| 93 </body> | |
| 94 </html> | |
| 95 | |
| OLD | NEW |