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

Side by Side Diff: content/test/data/gpu/webgl.html

Issue 258073007: Revert of Adding test to ensure context restoration due to GC doesn't crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/context_lost.py » ('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 type="text/javascript"> 3 <script type="text/javascript">
4 var canvas; 4 var canvas;
5 var w, h; 5 var w, h;
6 var gl; 6 var gl;
7 var extension; 7 var extension;
8 8
9 var alreadySetAutomationId = false; 9 var alreadySetAutomationId = false;
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, a); 52 gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, a);
53 53
54 if (!alreadySetAutomationId) 54 if (!alreadySetAutomationId)
55 window.domAutomationController.setAutomationId(1); 55 window.domAutomationController.setAutomationId(1);
56 if (a[0] == 0 && a[1] == 0 && a[2] == 255) 56 if (a[0] == 0 && a[1] == 0 && a[2] == 255)
57 window.domAutomationController.send("SUCCESS"); 57 window.domAutomationController.send("SUCCESS");
58 else 58 else
59 window.domAutomationController.send("FAILED"); 59 window.domAutomationController.send("FAILED");
60 } 60 }
61 61
62 function testQuantityLoss() {
63 var count = 0;
64 var iterations = 128;
65
66 function createAndDiscardContext() {
67 count++;
68
69 var c = document.createElement("canvas");
70 c.width = 1;
71 c.height = 1;
72
73 var ctx = c.getContext("experimental-webgl");
74 if (!ctx) {
75 return false;
76 }
77 ctx.clear(gl.COLOR_BUFFER_BIT);
78
79 if (count < iterations) {
80 window.requestAnimationFrame(createAndDiscardContext);
81 } else {
82 window.domAutomationController.setAutomationId(1);
83 alreadySetAutomationId = true;
84 window.domAutomationController.send("LOADED");
85 }
86 };
87
88 createAndDiscardContext();
89 }
90
91 function contextLostTest(kind) 62 function contextLostTest(kind)
92 { 63 {
93 switch (kind) { 64 switch (kind) {
94 case "WEBGL_lose_context": { 65 case "WEBGL_lose_context": {
95 extension = gl.getExtension("WEBKIT_WEBGL_lose_context") || 66 extension = gl.getExtension("WEBKIT_WEBGL_lose_context") ||
96 gl.getExtension("WEBGL_lose_context"); 67 gl.getExtension("WEBGL_lose_context");
97 extension.loseContext(); 68 extension.loseContext();
98 break; 69 break;
99 } 70 }
100 case "kill": 71 case "kill":
101 // nothing -- the browser test navigates to about:gpucrash and kills 72 // nothing -- the browser test navigates to about:gpucrash and kills
102 // the GPU process. 73 // the GPU process.
103 break; 74 break;
104 case "kill_after_notification": 75 case "kill_after_notification":
105 // The browser test waits for notification from the page that it 76 // The browser test waits for notification from the page that it
106 // has been loaded before navigating to about:gpucrash. 77 // has been loaded before navigating to about:gpucrash.
107 window.domAutomationController.setAutomationId(1); 78 window.domAutomationController.setAutomationId(1);
108 alreadySetAutomationId = true; 79 alreadySetAutomationId = true;
109 window.domAutomationController.send("LOADED"); 80 window.domAutomationController.send("LOADED");
110 break; 81 break;
111 case "forced_quantity_loss":
112 // Test creates many new contexts, forcing the original context to be
113 // lost. Then a garbage collect is triggered and the original context is
114 // watched to ensure it restores properly.
115 testQuantityLoss();
116 break;
117 } 82 }
118 } 83 }
119 84
120 function onLoad() { 85 function onLoad() {
121 canvas = document.getElementById("canvas1"); 86 canvas = document.getElementById("canvas1");
122 w = canvas.width; 87 w = canvas.width;
123 h = canvas.height; 88 h = canvas.height;
124 if (!canvas) 89 if (!canvas)
125 return; 90 return;
126 canvas.addEventListener("webglcontextlost", testContextLost, false); 91 canvas.addEventListener("webglcontextlost", testContextLost, false);
(...skipping 10 matching lines...) Expand all
137 if (query) 102 if (query)
138 contextLostTest(query[1]); 103 contextLostTest(query[1]);
139 } 104 }
140 </script> 105 </script>
141 </head> 106 </head>
142 <body onload="onLoad()"> 107 <body onload="onLoad()">
143 <canvas id="canvas1" width="16px" height="32px"> 108 <canvas id="canvas1" width="16px" height="32px">
144 </canvas> 109 </canvas>
145 </body> 110 </body>
146 </html> 111 </html>
OLDNEW
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/context_lost.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698