Changeset 189226 in webkit
- Timestamp:
- Sep 1, 2015 2:00:19 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r189225 r189226 1 2015-09-01 Brian Burg <bburg@apple.com> 2 3 Web Inspector: rewrite inspector/console/command-line-api.html to use AsyncTestSuite 4 https://bugs.webkit.org/show_bug.cgi?id=148637 5 6 Reviewed by Darin Adler. 7 8 * inspector/console/command-line-api-expected.txt: 9 * inspector/console/command-line-api.html: 10 1 11 2015-09-01 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/LayoutTests/inspector/console/command-line-api-expected.txt
r186891 r189226 3 3 4 4 5 STEP: String(keys([3,4])) 6 0,1 5 == Running test suite: Console.TestCommandLineAPI 6 -- Running test case: EvaluateArrayKeys 7 Input: keys([3,4]) 8 Output: 0,1 7 9 8 STEP: String(values([3,4])) 9 3,4 10 -- Running test case: EvaluateArrayValues 11 Input: values([3,4]) 12 Output: 3,4 10 13 11 STEP: String($0) 12 [object HTMLParagraphElement] 14 -- Running test case: EvaluateDollarZero 15 Input: $0 16 Output: undefined 13 17 14 STEP: String($('foo')) 15 CONSOLE: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")16 null18 -- Running test case: EvaluateInvalidSelector 19 Input: $('foo') 20 Output: null 17 21 18 STEP: String($('#foo')) 19 [object HTMLParagraphElement] 22 -- Running test case: EvaluateIdSelector 23 Input: $('#foo') 24 Output: [object HTMLParagraphElement] 20 25 21 STEP: String($('#foo', document.body)) 22 [object HTMLParagraphElement] 26 -- Running test case: EvaluateIdSelectorWithContext 27 Input: $('#foo', document.body) 28 Output: [object HTMLParagraphElement] 23 29 24 STEP: String($('#foo', 'non-node')) 25 [object HTMLParagraphElement] 30 -- Running test case: EvaluateIdSelectorWithInvalidContext 31 Input: $('#foo', 'non-node') 32 Output: [object HTMLParagraphElement] 26 33 27 STEP: String($('#foo', $('#bar'))) 28 null 34 -- Running test case: EvaluateIdSelectorDynamicContext 35 Input: $('#foo', $('#bar')) 36 Output: null 29 37 30 STEP: String($$('p')) 31 [object HTMLParagraphElement],[object HTMLParagraphElement] 38 -- Running test case: EvaluateElementSelectorAll 39 Input: $$('p') 40 Output: [object HTMLParagraphElement],[object HTMLParagraphElement] 32 41 33 STEP: String($$('p', document.body)) 34 [object HTMLParagraphElement],[object HTMLParagraphElement] 42 -- Running test case: EvaluateElementSelectorAllWithContext 43 Input: $$('p', document.body) 44 Output: [object HTMLParagraphElement],[object HTMLParagraphElement] 35 45 -
trunk/LayoutTests/inspector/console/command-line-api.html
r188059 r189226 6 6 function test() 7 7 { 8 var currentStepIndex = 0; 9 var steps = [ 10 "String(keys([3,4]))", 11 "String(values([3,4]))", 12 "String($0)", 13 "String($('foo'))", 14 "String($('#foo'))", 15 "String($('#foo', document.body))", 16 "String($('#foo', 'non-node'))", 17 "String($('#foo', $('#bar')))", 18 "String($$('p'))", 19 "String($$('p', document.body))", 8 // Each input is wrapped in the String constructor to force stringification. 9 let testInputs = [ 10 { 11 title: "ArrayKeys", 12 input: "keys([3,4])", 13 }, 14 { 15 title: "ArrayValues", 16 input: "values([3,4])", 17 }, 18 { 19 title: "DollarZero", 20 input: "$0", 21 setup: selectElementForDollarZero, 22 }, 23 { 24 title: "InvalidSelector", 25 input: "$('foo')", 26 setup: listenForConsoleWarning, 27 }, 28 { 29 title: "IdSelector", 30 input: "$('#foo')", 31 }, 32 { 33 title: "IdSelectorWithContext", 34 input: "$('#foo', document.body)", 35 }, 36 { 37 title: "IdSelectorWithInvalidContext", 38 input: "$('#foo', 'non-node')", 39 }, 40 { 41 title: "IdSelectorDynamicContext", 42 input: "$('#foo', $('#bar'))", 43 }, 44 { 45 title: "ElementSelectorAll", 46 input: "$$('p')", 47 }, 48 { 49 title: "ElementSelectorAllWithContext", 50 input: "$$('p', document.body)", 51 }, 20 52 ]; 21 53 22 var consoleMessage = null;54 let suite = InspectorTest.createAsyncSuite("Console.TestCommandLineAPI"); 23 55 24 function runSteps() 25 { 26 for (var step of steps) { 27 WebInspector.runtimeManager.evaluateInInspectedWindow(step, "test", true, true, false, false, false, function(result, wasThrown) { 28 InspectorTest.log("\nSTEP: " + steps[currentStepIndex]); 29 if (consoleMessage) { 30 InspectorTest.log("CONSOLE: " + consoleMessage.messageText); 31 consoleMessage = null; 56 function addAPITestCase(args) { 57 let {title, input, setup} = args; 58 suite.addTestCase({ 59 name: `Evaluate${title}`, 60 setup, 61 test: (resolve, reject) => { 62 InspectorTest.log(`Input: ${input}`); 63 64 function callback(result, wasThrown) { 65 if (result) { 66 InspectorTest.log(`Output: ${result.description}`); 67 resolve(); 68 } else 69 reject(); 32 70 } 33 InspectorTest.log(result.description);34 71 35 if (++currentStepIndex >= steps.length) 36 InspectorTest.completeTest(); 37 }); 38 } 72 const objectGroup = "test"; 73 const includeCommandLineAPI = true; 74 const ignorePauseOnExceptionsAndMute = false; 75 const shouldReturnByValue = false; 76 const shouldGeneratePreview = false; 77 const shouldSaveResult = false; 78 WebInspector.runtimeManager.evaluateInInspectedWindow(`String(${input})`, objectGroup, includeCommandLineAPI, ignorePauseOnExceptionsAndMute, shouldReturnByValue, shouldGeneratePreview, shouldSaveResult, callback); 79 } 80 }) 39 81 } 40 82 41 // Detect console warning for $('foo'). 42 WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) { 43 consoleMessage = event.data.message; 44 InspectorTest.assert(consoleMessage instanceof WebInspector.ConsoleMessage); 45 }); 83 for (let input of testInputs) 84 addAPITestCase(input); 46 85 47 // Select div#foo for $0. 48 WebInspector.domTreeManager.requestDocument(function(documentNode) { 49 WebInspector.domTreeManager.querySelector(documentNode.id, "#foo", function(contentNodeId) { 50 if (contentNodeId) { 86 suite.runTestCasesAndFinish(); 87 88 function listenForConsoleWarning(resolve, reject) { 89 // Detect console warning for $('foo'). 90 WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => { 91 let message = event.data.message; 92 InspectorTest.assert(message instanceof WebInspector.ConsoleMessage); 93 InspectorTest.log(`CONSOLE: ${message.messageText}`); 94 }); 95 96 resolve(); 97 } 98 99 function selectElementForDollarZero(resolve, reject) { 100 WebInspector.domTreeManager.requestDocument(function(documentNode) { 101 if (!documentNode) { 102 InspectorTest.log("FAIL: DOM node not found."); 103 return reject(); 104 } 105 106 // Select div#foo for $0. 107 WebInspector.domTreeManager.querySelector(documentNode.id, "#foo", function(contentNodeId) { 108 if (!contentNodeId) { 109 InspectorTest.log("FAIL: DOM node not found."); 110 return reject(); 111 } 112 51 113 ConsoleAgent.addInspectedNode(contentNodeId); 52 runSteps(); 53 } else { 54 InspectorTest.log("FAIL: DOM node not found."); 55 InspectorTest.completeTest(); 56 } 114 resolve(); 115 }); 57 116 }); 58 } );117 } 59 118 } 60 119 </script> -
trunk/Source/WebInspectorUI/ChangeLog
r189220 r189226 1 2015-09-01 Brian Burg <bburg@apple.com> 2 3 Web Inspector: rewrite inspector/console/command-line-api.html to use AsyncTestSuite 4 https://bugs.webkit.org/show_bug.cgi?id=148637 5 6 Reviewed by Darin Adler. 7 8 * UserInterface/Base/Object.js: 9 (WebInspector.Object.singleFireEventListener): 10 (WebInspector.Object.singleFireEventListener.let.wrappedCallback): Arrow. 11 1 12 2015-09-01 Devin Rousso <drousso@apple.com> 2 13 -
trunk/Source/WebInspectorUI/UserInterface/Base/Object.js
r189104 r189226 58 58 static singleFireEventListener(eventType, listener, thisObject) 59 59 { 60 let wrappedCallback = function(){60 let wrappedCallback = () => { 61 61 this.removeEventListener(eventType, wrappedCallback, null); 62 62 listener.apply(thisObject, arguments); 63 } .bind(this);63 }; 64 64 65 65 this.addEventListener(eventType, wrappedCallback, null);
Note: See TracChangeset
for help on using the changeset viewer.