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

Side by Side Diff: LayoutTests/inspector/extensions/extensions-panel.html

Issue 18835002: DevTools extensions: forward keyboard shortcuts to DevTools (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | LayoutTests/inspector/extensions/extensions-panel-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/extensions-test.js"></script> 4 <script src="../../http/tests/inspector/extensions-test.js"></script>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 function logMessage() 6 function logMessage()
7 { 7 {
8 console.log("hello"); 8 console.log("hello");
9 } 9 }
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 { 56 {
57 function showAnchorLocationHook(anchor) 57 function showAnchorLocationHook(anchor)
58 { 58 {
59 var url = anchor.href.replace(/^.*(([/][^/]*){3}[^/)]*)$/, "...$1"); 59 var url = anchor.href.replace(/^.*(([/][^/]*){3}[^/)]*)$/, "...$1");
60 InspectorTest.addResult("Showing resource " + url + " in panel " + t his.name + " (" + WebInspector.inspectorView.currentPanel().name + "), line: " + anchor.lineNumber); 60 InspectorTest.addResult("Showing resource " + url + " in panel " + t his.name + " (" + WebInspector.inspectorView.currentPanel().name + "), line: " + anchor.lineNumber);
61 } 61 }
62 var panels = ["scripts", "resources", "network"]; 62 var panels = ["scripts", "resources", "network"];
63 for (var i = 0; i < panels.length; ++i) 63 for (var i = 0; i < panels.length; ++i)
64 InspectorTest.addSniffer(WebInspector.panel(panels[i]), "showAnchorL ocation", showAnchorLocationHook, true); 64 InspectorTest.addSniffer(WebInspector.panel(panels[i]), "showAnchorL ocation", showAnchorLocationHook, true);
65 } 65 }
66
67 InspectorTest.switchToLastPanel = function()
68 {
69 var lastPanelName = WebInspector.inspectorView._panelOrder.peekLast();
70 WebInspector.showPanel(lastPanelName);
71 }
66 } 72 }
67 73
68 function extension_testCreatePanel(nextTest) 74 function extension_testCreatePanel(nextTest)
69 { 75 {
70 var expectOnShown = false; 76 var expectOnShown = false;
71 77
72 function onPanelShown(panel, window) 78 function onPanelShown(panel, window)
73 { 79 {
74 if (!expectOnShown) { 80 if (!expectOnShown) {
75 output("FAIL: unexpected onShown event"); 81 output("FAIL: unexpected onShown event");
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (urlIndex >= urls.length) { 231 if (urlIndex >= urls.length) {
226 nextTest(); 232 nextTest();
227 return; 233 return;
228 } 234 }
229 var url = urls[urlIndex++]; 235 var url = urls[urlIndex++];
230 output("Showing " + trimURL(url)); 236 output("Showing " + trimURL(url));
231 webInspector.panels.openResource(url, 1000 + urlIndex, showNextURL); 237 webInspector.panels.openResource(url, 1000 + urlIndex, showNextURL);
232 } 238 }
233 } 239 }
234 240
241 function extension_testGlobalShortcuts(nextTest)
242 {
243 var platform;
244 var testPanel;
245 evaluateOnFrontend("reply(WebInspector.platform())", function(result) {
246 platform = result;
247 var basePath = location.pathname.replace(/\/[^/]*$/, "/");
248 webInspector.panels.create("Shortcuts Test Panel", basePath + "extension -panel.png", basePath + "extension-panel.html", onPanelCreated);
249 });
250 function dispatchKeydownEvent(attributes)
251 {
252 var event = new KeyboardEvent("keydown", attributes);
253 document.dispatchEvent(event);
254 }
255 function onPanelCreated(panel)
256 {
257 testPanel = panel;
258 testPanel.onShown.addListener(onPanelShown);
259 testPanel.onHidden.addListener(onPanelHidden);
260 evaluateOnFrontend("InspectorTest.switchToLastPanel();", function() {});
261 }
262 function onPanelShown(window)
263 {
264 testPanel.onShown.removeListener(onPanelShown);
265 output("Panel shown, now toggling console...");
266 window.addEventListener("resize", onPanelResized);
267 dispatchKeydownEvent({ keyIdentifier: "U+001B" });
268 }
269 function onPanelResized()
270 {
271 window.removeEventListener("resize", onPanelResized);
272 output("Panel resized, switching away...");
273 var isMac = platform === "mac";
274 dispatchKeydownEvent({ ctrlKey: !isMac, metaKey: isMac, keyIdentifier: " U+005D" });
275 }
276 function onPanelHidden()
277 {
278 output("Panel hidden, test passed.");
279 testPanel.onShown.removeListener(onPanelHidden);
280 nextTest();
281 }
282 }
283
235 function loadResources() 284 function loadResources()
236 { 285 {
237 var xhr = new XMLHttpRequest(); 286 var xhr = new XMLHttpRequest();
238 xhr.open("GET", "resources/missing.txt", false); 287 xhr.open("GET", "resources/missing.txt", false);
239 xhr.send(); 288 xhr.send();
240 var img = document.createElement("img"); 289 var img = document.createElement("img");
241 img.src = "resources/abe.png"; 290 img.src = "resources/abe.png";
242 document.body.appendChild(img); 291 document.body.appendChild(img);
243 } 292 }
244 </script> 293 </script>
245 </head> 294 </head>
246 <body onload="runTest()"> 295 <body onload="runTest()">
247 <p>Tests WebInspector extension API</p> 296 <p>Tests WebInspector extension API</p>
248 </body> 297 </body>
249 </html> 298 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/extensions/extensions-panel-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698