| OLD | NEW | 
| (Empty) |  | 
 |   1 <!DOCTYPE html> | 
 |   2 <script src='../../../resources/testharness.js'></script> | 
 |   3 <script src='../../../resources/testharnessreport.js'></script> | 
 |   4 <p>Selected Text</p> | 
 |   5 <label> | 
 |   6 <img src="../resources/green.jpg" width=100 height=100> | 
 |   7 <br><input type=radio> Then click the image | 
 |   8 </label> | 
 |   9 <script> | 
 |  10  | 
 |  11 var text = document.querySelector("p"); | 
 |  12 var label = document.querySelector("label"); | 
 |  13 var radio = label.querySelector("input[type=radio]"); | 
 |  14 var image = label.querySelector("img"); | 
 |  15 var targetTextRect = text.getBoundingClientRect(); | 
 |  16 var textLeft = targetTextRect.left; | 
 |  17 var textTop = targetTextRect.top; | 
 |  18 var textWidth =  targetTextRect.width; | 
 |  19 var targetImageRect = image.getBoundingClientRect(); | 
 |  20 var imageLeft = targetImageRect.left; | 
 |  21 var imageTop = targetImageRect.top; | 
 |  22  | 
 |  23 function callbackValidMoveCount() { | 
 |  24     testTouchMove.step(function() { | 
 |  25     assert_equals(window.getSelection().toString(), "Selected Text"); | 
 |  26     assert_true(radio.checked); | 
 |  27     }); | 
 |  28   testTouchMove.done(); | 
 |  29 } | 
 |  30  | 
 |  31 function testLabelClickOnSelectedText() { | 
 |  32     if (window.chrome && chrome.gpuBenchmarking) { | 
 |  33         var pointerActions = | 
 |  34             [{ source: "mouse", | 
 |  35               actions: [ | 
 |  36                 { name: "pointerDown", x: textLeft, y: textTop }, | 
 |  37                 { name: "pointerMove", x: textLeft + textWidth, y: textTop }, | 
 |  38                 { name: "pointerUp" }, | 
 |  39                 { name:"pause"}, | 
 |  40                 { name: "pointerDown", x: imageLeft, y: imageTop}, | 
 |  41                 { name: "pointerUp" }]}]; | 
 |  42         chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackVal
    idMoveCount); | 
 |  43      } | 
 |  44 } | 
 |  45  | 
 |  46 var testTouchMove = async_test("Tests that Radio Input gets checked if label cli
    cked along with a text selection."); | 
 |  47 // This test runs as follows. | 
 |  48 // 1. Select the text. | 
 |  49 // 2. Then click on label element image. | 
 |  50 // 3. Radio button should be checked. | 
 |  51 testLabelClickOnSelectedText(); | 
 |  52 </script> | 
| OLD | NEW |