Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / canvas_2d / background.js
blob19bbbe632ce017a7fe24c581ed127bbb482aa0f5
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 canvas = document.getElementById("my-canvas");
6 if (canvas) {
7 if (canvas.getContext) {
8 context = canvas.getContext("2d");
9 if (context) {
10 context.fillStyle = 'red';
11 context.fillRect(20, 20, 40, 40);
12 chrome.test.notifyPass();
13 } else {
14 chrome.test.notifyFail("unable to getContext('2d')");
16 } else {
17 chrome.test.notifyFail("canvas.getContext null");
19 } else {
20 chrome.test.notifyFail("couldn't find element my-canvas");