| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this |
| 3 * source code is governed by a BSD-style license that can be found in the | 3 * source code is governed by a BSD-style license that can be found in the |
| 4 * LICENSE file. | 4 * LICENSE file. |
| 5 --> | 5 --> |
| 6 <html> | 6 <html> |
| 7 <head> | 7 <head> |
| 8 <title>Background page using 2d canvas</title> | 8 <title>Background page using 2d canvas</title> |
| 9 </head> | 9 </head> |
| 10 <body> | 10 <body> |
| 11 <div>Below should be a canvas rendered with canvas2D</div> | 11 <div>Below should be a canvas rendered with canvas2D</div> |
| 12 <canvas id="my-canvas" width="100" height="100"></canvas> | 12 <canvas id="my-canvas" width="100" height="100"></canvas> |
| 13 <script type="application/javascript"> | 13 <script src="background.js"></script> |
| 14 canvas = document.getElementById("my-canvas"); | |
| 15 if (canvas) { | |
| 16 if (canvas.getContext) { | |
| 17 context = canvas.getContext("2d"); | |
| 18 if (context) { | |
| 19 context.fillStyle = 'red'; | |
| 20 context.fillRect(20, 20, 40, 40); | |
| 21 chrome.test.notifyPass(); | |
| 22 } else { | |
| 23 chrome.test.notifyFail("unable to getContext('2d')"); | |
| 24 } | |
| 25 } else { | |
| 26 chrome.test.notifyFail("canvas.getContext null"); | |
| 27 } | |
| 28 } else { | |
| 29 chrome.test.notifyFail("couldn't find element my-canvas"); | |
| 30 } | |
| 31 </script> | |
| 32 </body> | 14 </body> |
| 33 </html> | 15 </html> |
| OLD | NEW |