Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / extend-selection-after-double-click.html
blob252602ca2a27e1c4f084f49afd5be97a79427edd
1 <html>
2 <head>
3 <script>
4 function doubleClickWord()
6 var start = document.getElementById("start");
8 var x = start.offsetLeft + 2;
9 var y = start.offsetTop + 10;
11 eventSender.leapForward(1000);
12 eventSender.mouseMoveTo(x, y);
13 eventSender.mouseDown();
14 eventSender.mouseUp();
15 eventSender.leapForward(1);
16 eventSender.mouseDown();
17 eventSender.mouseUp();
18 eventSender.leapForward(1000);
21 function logResult(result)
23 document.getElementById("result").innerHTML += result + "<br/>";
26 function runTests()
28 if (!window.eventSender || !window.testRunner || !window.internals)
29 return;
31 testRunner.dumpAsText();
33 runTest("mac", "a paragraph");
34 runTest("win", "paragra");
37 function runTest(behavior, expectedText)
39 internals.settings.setEditingBehavior(behavior);
40 doubleClickWord();
41 getSelection().modify("extend", "backward", "character");
42 getSelection().modify("extend", "backward", "character");
43 doubleClickWord();
44 getSelection().modify("extend", "backward", "character");
45 getSelection().modify("extend", "backward", "character");
47 var selectedText = getSelection().toString();
48 if (selectedText == expectedText)
49 logResult("SUCCESS");
50 else
51 logResult("FAILURE: The selected text is \"" + selectedText + "\" and should be \"" + expectedText + "\".");
53 </script>
54 </head>
55 <body onload="runTests()">
56 <p>This tests modifying a selection created with a double click with shift arrow key.</p>
57 <p style="color:green">
58 This test does not run interactively.
59 It uses the event sender to do mouse clicks.
60 To run it manually, double click on the blue "g", then press shift-left-arrow twice.
61 Then repeat those steps again.
62 The selection should include the words "a paragraph" on mac and "paragra" on win/linux..
63 </p>
64 <p>This is a para<span style="color:blue" id="start">g</span>raph.</p>
65 <p id="result"></p>
66 </body>