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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt.js

Issue 2837083003: DevTools: create test infrastructure so devtools drives the test (Closed)
Patch Set: rebaseline Created 3 years, 6 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
OLDNEW
1 TestRunner.addResult("This tests if the TextPrompt autocomplete works properly." ); 1 TestRunner.addResult("This tests if the TextPrompt autocomplete works properly." );
2 2
3 var suggestions = ["heyoo", "hey it's a suggestion", "hey another suggestion"].m ap(s => ({text: s})); 3 var suggestions = ["heyoo", "hey it's a suggestion", "hey another suggestion"].m ap(s => ({text: s}));
4 var prompt = new UI.TextPrompt(); 4 var prompt = new UI.TextPrompt();
5 prompt.initialize(() => Promise.resolve(suggestions)); 5 prompt.initialize(() => Promise.resolve(suggestions));
6 var div = document.createElement("div"); 6 var div = document.createElement("div");
7 UI.inspectorView.element.appendChild(div); 7 UI.inspectorView.element.appendChild(div);
8 prompt.attachAndStartEditing(div); 8 prompt.attachAndStartEditing(div);
9 prompt.setText("hey"); 9 prompt.setText("hey");
10 TestRunner.addSniffer(prompt, "_completionsReady").then(step2); 10 TestRunner.addSnifferPromise(prompt, "_completionsReady").then(step2);
11 prompt.complete(); 11 prompt.complete();
12 function step2() { 12 function step2() {
13 TestRunner.addResult("Text:" + prompt.text()); 13 TestRunner.addResult("Text:" + prompt.text());
14 TestRunner.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSu ggestion()); 14 TestRunner.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSu ggestion());
15 15
16 TestRunner.addResult("Test with inexact match:"); 16 TestRunner.addResult("Test with inexact match:");
17 prompt.clearAutocomplete(); 17 prompt.clearAutocomplete();
18 prompt.setText("inexactmatch"); 18 prompt.setText("inexactmatch");
19 TestRunner.addSniffer(prompt, "_completionsReady").then(step3); 19 TestRunner.addSnifferPromise(prompt, "_completionsReady").then(step3);
20 prompt.complete(); 20 prompt.complete();
21 } 21 }
22 function step3() { 22 function step3() {
23 TestRunner.addResult("Text:" + prompt.text()); 23 TestRunner.addResult("Text:" + prompt.text());
24 TestRunner.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSu ggestion()); 24 TestRunner.addResult("TextWithCurrentSuggestion:" + prompt.textWithCurrentSu ggestion());
25 TestRunner.completeTest(); 25 TestRunner.completeTest();
26 } 26 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698