OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script> | 4 <script> |
5 function popup() { | 5 function popup() { |
6 var w = window.open("","","width=200,height=200"); | 6 var w = window.open("","","width=200,height=200"); |
7 var canvas = w.document.createElement("canvas"); | 7 var canvas = w.document.createElement("canvas"); |
8 canvas.width = 100; | 8 canvas.width = 100; |
9 canvas.height = 100; | 9 canvas.height = 100; |
10 w.document.body.appendChild(canvas); | 10 w.document.body.appendChild(canvas); |
11 | 11 |
12 var ctx = canvas.getContext('2d'); | 12 var ctx = canvas.getContext('2d'); |
13 ctx.fillStyle = "rgb(255,165,0)"; | 13 ctx.fillStyle = "rgb(255,165,0)"; |
14 ctx.fillRect(0, 0, 100, 100); | 14 ctx.fillRect(0, 0, 100, 100); |
15 | 15 |
16 var imageData = ctx.getImageData(50, 50, 1, 1); | 16 var imageData = ctx.getImageData(50, 50, 1, 1); |
17 document.title = imageData.data[0] + ", " + | 17 document.title = imageData.data[0] + ", " + |
18 imageData.data[1] + ", " + | 18 imageData.data[1] + ", " + |
19 imageData.data[2]; | 19 imageData.data[2]; |
20 | 20 |
21 window.domAutomationController.setAutomationId(1); | |
22 if (imageData.data[0] == 255 && | 21 if (imageData.data[0] == 255 && |
23 imageData.data[1] == 165 && | 22 imageData.data[1] == 165 && |
24 imageData.data[2] == 0) | 23 imageData.data[2] == 0) { |
25 window.domAutomationController.send("SUCCESS"); | 24 window.domAutomationController.send("SUCCESS"); |
26 else | 25 } else { |
27 window.domAutomationController.send("FAILED"); | 26 window.domAutomationController.send("FAILED"); |
| 27 } |
28 } | 28 } |
29 </script> | 29 </script> |
30 </head> | 30 </head> |
31 <body onload="popup()"> | 31 <body onload="popup()"> |
32 </body> | 32 </body> |
33 </html> | 33 </html> |
OLD | NEW |