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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions.html

Issue 1952553002: [DevTools] Auto completion for proxy uses proxy target object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-property-descriptors-to-native
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions-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="console-test.js"></script> 3 <script src="console-test.js"></script>
4 <script src="inspector-test.js"></script> 4 <script src="inspector-test.js"></script>
5 <script> 5 <script>
6 6
7 window.counter = 0;
8 var handler = {
9 get: function(target, name){
10 window.counter++;
11 return Reflect.get.apply(this, arguments);
12 },
13 set: function(target, name){
14 window.counter++;
15 return Reflect.set.apply(this, arguments);
16 },
17 getPrototypeOf: function(target) {
18 window.counter++;
19 return Reflect.getPrototypeOf.apply(this, arguments);
20 },
21 setPrototypeOf: function(target) {
22 window.counter++;
23 return Reflect.setPrototypeOf.apply(this, arguments);
24 },
25 isExtensible: function(target) {
26 window.counter++;
27 return Reflect.isExtensible.apply(this, arguments);
28 },
29 isExtensible: function(target) {
30 window.counter++;
31 return Reflect.isExtensible.apply(this, arguments);
32 },
33 isExtensible: function(target) {
34 window.counter++;
35 return Reflect.isExtensible.apply(this, arguments);
36 },
37 preventExtensions: function() {
38 window.counter++;
39 return Reflect.preventExtensions.apply(this, arguments);
40 },
41 getOwnPropertyDescriptor: function() {
42 window.counter++;
43 return Reflect.getOwnPropertyDescriptor.apply(this, arguments);
44 },
45 defineProperty: function() {
46 window.counter++;
47 return Reflect.defineProperty.apply(this, arguments);
48 },
49 has: function() {
50 window.counter++;
51 return Reflect.has.apply(this, arguments);
52 },
53 get: function() {
54 window.counter++;
55 return Reflect.get.apply(this, arguments);
56 },
57 set: function() {
58 window.counter++;
59 return Reflect.set.apply(this, arguments);
60 },
61 deleteProperty: function() {
62 window.counter++;
63 return Reflect.deleteProperty.apply(this, arguments);
64 },
65 ownKeys: function() {
66 window.counter++;
67 return Reflect.ownKeys.apply(this, arguments);
68 },
69 apply: function() {
70 window.counter++;
71 return Reflect.apply.apply(this, arguments);
72 },
73 construct: function() {
74 window.counter++;
75 return Reflect.construct.apply(this, arguments);
76 }
77 };
78 window.proxy1 = new Proxy({ a : 1}, handler);
79 window.proxy2 = new Proxy(window.proxy1, handler);
80
7 function test() 81 function test()
8 { 82 {
9 InspectorTest.changeExecutionContext("myIFrame"); 83 InspectorTest.changeExecutionContext("myIFrame");
10 84
11 WebInspector.context.flavor(WebInspector.ExecutionContext).completionsForExp ression("", "myGlob", 6, "myGlob", false, checkCompletions.bind(this)); 85 WebInspector.context.flavor(WebInspector.ExecutionContext).completionsForExp ression("", "myGlob", 6, "myGlob", false, checkCompletions.bind(this));
12 function checkCompletions(completions) 86 function checkCompletions(completions)
13 { 87 {
14 var expected = ["myGlobalVar", "myGlobalFunction"]; 88 InspectorTest.addResult("myGlob completions:")
15 for (var i = 0; i < expected.length; ++i) { 89 dumpCompletions(completions, ["myGlobalVar", "myGlobalFunction"]);
16 if (completions.indexOf(expected[i]) !== -1)
17 InspectorTest.addResult(expected[i]);
18 else
19 InspectorTest.addResult("NOT FOUND: " + expected[i]);
20 }
21 requestIFrameCompletions(); 90 requestIFrameCompletions();
22 } 91 }
23 92
24 function requestIFrameCompletions() 93 function requestIFrameCompletions()
25 { 94 {
26 InspectorTest.changeExecutionContext("top"); 95 InspectorTest.changeExecutionContext("top");
27 WebInspector.context.flavor(WebInspector.ExecutionContext).completionsFo rExpression("myIFrame.", "myIFrame.", 0, "", false, checkIframeCompletions.bind( this)); 96 WebInspector.context.flavor(WebInspector.ExecutionContext).completionsFo rExpression("myIFrame.", "myIFrame.", 0, "", false, checkIframeCompletions.bind( this));
28 } 97 }
29 98
30 function checkIframeCompletions(completions) 99 function checkIframeCompletions(completions)
31 { 100 {
101 InspectorTest.addResult("myIFrame completions:")
102 dumpCompletions(completions, ["self", "top", "window"]);
103 requestProxyCompletions();
104 }
105
106 function requestProxyCompletions()
107 {
108 InspectorTest.changeExecutionContext("top");
109 WebInspector.context.flavor(WebInspector.ExecutionContext).completionsFo rExpression("window.proxy2.", "window.proxy2.", 0, "", false, checkProxyCompleti ons.bind(this));
110 }
111
112 function checkProxyCompletions(completions)
113 {
114 InspectorTest.addResult("proxy completions:")
115 dumpCompletions(completions, ["a"]);
116 InspectorTest.evaluateInPage("window.counter", dumpCounter);
117 }
118
119 function dumpCounter(result)
120 {
121 InspectorTest.addResult("window.counter = " + result.value);
122 InspectorTest.dumpConsoleMessages();
123 InspectorTest.completeTest();
124 }
125
126 function dumpCompletions(completions, expected)
127 {
32 var completionSet = new Set(completions); 128 var completionSet = new Set(completions);
33 var expected = ["self", "top", "window"];
34 InspectorTest.addResult("myIFrame completions:")
35 for (var completion of expected) { 129 for (var completion of expected) {
36 if (completionSet.has(completion)) 130 if (completionSet.has(completion))
37 InspectorTest.addResult(completion); 131 InspectorTest.addResult(completion);
38 else 132 else
39 InspectorTest.addResult("NOT FOUND: " + completion); 133 InspectorTest.addResult("NOT FOUND: " + completion);
40 } 134 }
41 InspectorTest.dumpConsoleMessages();
42 InspectorTest.completeTest();
43 } 135 }
44 } 136 }
45 137
46 </script> 138 </script>
47 </head> 139 </head>
48 140
49 <body> 141 <body>
50 <p> 142 <p>
51 Test that completions in the context of an iframe with a different origin will 143 Test that completions in the context of an iframe with a different origin will
52 result in names of its global variables. Test passes if all global variables 144 result in names of its global variables. Test passes if all global variables
53 are found among completions AND there are NO console messages. 145 are found among completions AND there are NO console messages.
54 <a href="https://bugs.webkit.org/show_bug.cgi?id=65457">Bug 65457.</a> 146 <a href="https://bugs.webkit.org/show_bug.cgi?id=65457">Bug 65457.</a>
55 </p> 147 </p>
56 <iframe name="myIFrame" src="http://localhost:8000/inspector/resources/console-c d-completions-iframe.html" onload="runTest()"></iframe> 148 <iframe name="myIFrame" src="http://localhost:8000/inspector/resources/console-c d-completions-iframe.html" onload="runTest()"></iframe>
57 149
58 </body> 150 </body>
59 </html> 151 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698