Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script> | |
| 5 function test() { | |
| 6 Help.releaseNotesByVersion = [ | |
| 7 { | |
| 8 version: 99, | |
| 9 highlights: [ | |
| 10 { | |
| 11 text: 'Test bullet #1', | |
|
alph
2017/02/21 23:19:42
We use double quotes in tests.
chenwilliam
2017/02/22 02:36:38
Done.
| |
| 12 link: 'https://google.com/', | |
| 13 featured: true, | |
| 14 }, | |
| 15 { | |
| 16 text: 'Test bullet #2', | |
| 17 link: 'https://google.com/', | |
| 18 }, | |
| 19 ], | |
| 20 link: 'https://google.com/', | |
| 21 image: { | |
| 22 src: './resources/test.png', | |
| 23 caption: 'Test image', | |
| 24 }, | |
| 25 } | |
| 26 ]; | |
| 27 | |
| 28 const originalShowPanel = UI.inspectorView.showPanel.bind(UI.inspectorView); | |
|
alph
2017/02/21 23:19:42
Why do you need original one? the sniffer will do
chenwilliam
2017/02/22 02:36:38
Done. I misunderstood how the sniffer worked.
| |
| 29 InspectorTest.addSniffer(UI.inspectorView, 'showPanel', onShowPanel); | |
| 30 | |
| 31 InspectorTest.addResult(`Browser user agent: ${navigator.userAgent}\n`); | |
| 32 Help.showReleaseNoteIfNeeded(); | |
| 33 | |
| 34 function onShowPanel(...args) { | |
| 35 originalShowPanel(...args).then(() => onReleaseNoteShown()); | |
| 36 } | |
| 37 | |
| 38 function onReleaseNoteShown() { | |
| 39 const releaseNoteView = UI.viewManager.view('release-note'); | |
|
alph
2017/02/21 23:19:42
We don't use const. It turned out to be slow.
chenwilliam
2017/02/22 02:36:38
Done.
| |
| 40 const releaseNoteElement = releaseNoteView[UI.View._widgetSymbol].conten tElement; | |
| 41 InspectorTest.addResult('Dumping release note text:'); | |
| 42 InspectorTest.addResult(releaseNoteElement.innerText); | |
| 43 InspectorTest.addResult('Last version of release note seen should be upd ated:'); | |
| 44 InspectorTest.addResult(Help.releaseNoteVersionSetting().get() + '\n'); | |
| 45 | |
| 46 InspectorTest.addSniffer(UI.InspectorView.prototype, 'closeDrawerTab', o nClose); | |
| 47 InspectorTest.addResult('Click on hide button'); | |
| 48 const closeButton = releaseNoteElement.querySelector('.close-release-not e'); | |
| 49 closeButton.click(); | |
| 50 } | |
| 51 | |
| 52 function onClose(view) { | |
| 53 InspectorTest.addResult(`Hiding view: ${view}`); | |
| 54 InspectorTest.completeTest(); | |
| 55 } | |
| 56 } | |
| 57 | |
| 58 </script> | |
| 59 </head> | |
| 60 <body onload="runTest()"> | |
| 61 <p> | |
| 62 Test release note | |
| 63 </p> | |
| 64 | |
| 65 </body> | |
| 66 </html> | |
| OLD | NEW |