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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/tabbed-pane.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 TabbedPane is keyboard navigable."); 1 TestRunner.addResult("This tests if the TabbedPane is keyboard navigable.");
2 2
3 class FocusableWidget extends UI.Widget { 3 class FocusableWidget extends UI.Widget {
4 constructor(name) { 4 constructor(name) {
5 super(); 5 super();
6 this.element.tabIndex = -1; 6 this.element.tabIndex = -1;
7 this.element.textContent = name; 7 this.element.textContent = name;
8 this.setDefaultFocusedElement(this.element); 8 this.setDefaultFocusedElement(this.element);
9 } 9 }
10 } 10 }
11 11
12 var tabbedPane = new UI.TabbedPane(); 12 var tabbedPane = new UI.TabbedPane();
13 tabbedPane.show(UI.inspectorView.element); 13 tabbedPane.show(UI.inspectorView.element);
14 TestRunner.addSniffer(tabbedPane, '_innerUpdateTabElements').then(tabsAdded); 14 TestRunner.addSnifferPromise(tabbedPane, '_innerUpdateTabElements').then(tabsAdd ed);
15 for (var i = 0; i < 10; i++) 15 for (var i = 0; i < 10; i++)
16 tabbedPane.appendTab(i.toString(), 'Tab ' + i, new FocusableWidget('Widget ' + i)); 16 tabbedPane.appendTab(i.toString(), 'Tab ' + i, new FocusableWidget('Widget ' + i));
17 17
18 function tabsAdded() { 18 function tabsAdded() {
19 tabbedPane._currentTab.tabElement.focus(); 19 tabbedPane._currentTab.tabElement.focus();
20 dumpFocus(); 20 dumpFocus();
21 TestRunner.addResult('Moving right and wrapping around'); 21 TestRunner.addResult('Moving right and wrapping around');
22 for (var i = 0; i < 20; i++) 22 for (var i = 0; i < 20; i++)
23 right(); 23 right();
24 TestRunner.addResult('Moving left and focusing widgets') 24 TestRunner.addResult('Moving left and focusing widgets')
(...skipping 28 matching lines...) Expand all
53 53
54 54
55 function dumpFocus() { 55 function dumpFocus() {
56 var element = document.deepActiveElement(); 56 var element = document.deepActiveElement();
57 if (!element) { 57 if (!element) {
58 TestRunner.addResult("null"); 58 TestRunner.addResult("null");
59 return; 59 return;
60 } 60 }
61 TestRunner.addResult(element.textContent); 61 TestRunner.addResult(element.textContent);
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698