Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: LayoutTests/fullscreen/full-screen-test.js

Issue 469203002: Simplify full-screen-test.js's runWithKeyDown() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var console = null; 1 var console = null;
2 var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting()) 2 var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting())
3 3
4 logConsole(); 4 logConsole();
5 5
6 if (window.testRunner) { 6 if (window.testRunner) {
7 if (window.runPixelTests) 7 if (window.runPixelTests)
8 testRunner.dumpAsTextWithPixelResults(); 8 testRunner.dumpAsTextWithPixelResults();
9 else 9 else
10 testRunner.dumpAsText(); 10 testRunner.dumpAsText();
11 testRunner.waitUntilDone(); 11 testRunner.waitUntilDone();
12 } 12 }
13 13
14 function runWithKeyDown(fn) 14 function runWithKeyDown(fn)
15 { 15 {
16 // FIXME: WKTR does not yet support the keyDown() message. Do a mouseDown h ere
17 // instead until keyDown support is added.
18 var eventName = !window.testRunner || eventSender.keyDown ? 'keypress' : 'mo usedown'
19
20 function thunk() { 16 function thunk() {
21 document.removeEventListener(eventName, thunk, false); 17 document.removeEventListener('keypress', thunk, false);
22 fn(); 18 fn();
23 } 19 }
24 document.addEventListener(eventName, thunk, false); 20 document.addEventListener('keypress', thunk, false);
25 21
26 if (window.testRunner) { 22 if (window.eventSender)
27 if (eventSender.keyDown) 23 eventSender.keyDown(" ", []);
falken 2014/08/15 13:21:35 let's make this ' ' or the others " " for consiste
philipj_slow 2014/08/15 13:40:17 This file seems to use double quotes slightly more
28 eventSender.keyDown(" ", []);
29 else
30 eventSender.mouseDown();
31 }
32 } 24 }
33 25
34 function logConsole() 26 function logConsole()
35 { 27 {
36 if (!console && document.body) { 28 if (!console && document.body) {
37 console = document.createElement('div'); 29 console = document.createElement('div');
38 document.body.appendChild(console); 30 document.body.appendChild(console);
39 } 31 }
40 return console; 32 return console;
41 } 33 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 else 150 else
159 consoleWrite(text + " <span style='color:red'>FAIL</span>"); 151 consoleWrite(text + " <span style='color:red'>FAIL</span>");
160 } 152 }
161 153
162 function consoleWrite(text) 154 function consoleWrite(text)
163 { 155 {
164 if (testEnded) 156 if (testEnded)
165 return; 157 return;
166 logConsole().innerHTML += text + "<br>"; 158 logConsole().innerHTML += text + "<br>";
167 } 159 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698