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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/suggest-box.js

Issue 2513423003: DevTools: Convert inspector-unit tests to use reusable test harness (Closed)
Patch Set: Moved type definition out of externs Created 4 years 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
(Empty)
1 TestRunner.addResult("This tests if the SuggestBox works properly.");
2
3 var delegate = {
4 applySuggestion: function(suggestion, isIntermediateSuggestion) {
5 TestRunner.addResult((isIntermediateSuggestion ? "Intermediate " : "") + "Suggestion Applied: " + suggestion);
6 },
7 acceptSuggestion: function() {
8 TestRunner.addResult("Suggestion accepted");
9 }
10 };
11 var div = document.createElement("div");
12 UI.inspectorView.element.appendChild(div);
13 var suggestBox = new UI.SuggestBox(delegate);
14
15 TestRunner.addResult("");
16 TestRunner.addResult("Testing that the first item is selected.");
17 suggestBox.updateSuggestions(new AnchorBox(50, 50, 400, 400), [
18 {title: "First"},
19 {title: "Hello"},
20 {title: "The best suggestion"}], true, true, "e");
21
22 TestRunner.addResult("");
23 TestRunner.addResult("Testing that no item is selected.");
24 suggestBox.updateSuggestions(new AnchorBox(50, 50, 400, 400), [
25 {title: "First"},
26 {title: "Hello", priority: 2},
27 {title: "The best suggestion", priority: 5}], false, true, "e");
28
29 TestRunner.addResult("");
30 TestRunner.addResult("Testing that highest priority item is selected.");
31 suggestBox.updateSuggestions(new AnchorBox(50, 50, 400, 400), [
32 {title: "First"},
33 {title: "Hello", priority: 2},
34 {title: "The best suggestion", priority: 5}], true, true, "e");
35
36 TestRunner.addResult("");
37 TestRunner.addResult("Testing that arrow keys can be used for selection.");
38 suggestBox.keyPressed(TestRunner.createKeyEvent("ArrowUp"));
39 suggestBox.keyPressed(TestRunner.createKeyEvent("ArrowUp"));
40 suggestBox.keyPressed(TestRunner.createKeyEvent("ArrowUp"));
41 suggestBox.keyPressed(TestRunner.createKeyEvent("ArrowDown"));
42 suggestBox.keyPressed(TestRunner.createKeyEvent("ArrowDown"));
43
44 TestRunner.addResult("");
45 TestRunner.addResult("Testing that enter can be used to accept a suggestion.");
46 suggestBox.keyPressed(TestRunner.createKeyEvent("Enter"));
47
48 TestRunner.addResult("");
49 TestRunner.addResult("Testing that highest priority item is selected.");
50 suggestBox.updateSuggestions(new AnchorBox(50, 50, 400, 400), [
51 {title: "First"},
52 {title: "Hello", priority: 2},
53 {title: "The best suggestion", priority: 5}], true, true, "e");
54
55 TestRunner.completeTest();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698