summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/copy-image-when-no-image-exists.html
blob: 56cd6bb460c04398b66c525575997e141f32385b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!-- This test checks copyImageAt() with position parameter 
     that actually doesn't point to an Image(Canvas).
     (Negative test for crbug.com/392765) -->
<head>
<script src="../resources/js-test.js"></script>
<script>

function main()
{
  if (!window.testRunner) {
    testFailed("Requires window.testRunner");
  } else {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
    window.requestAnimationFrame(runTest);
  }
}

function runTest() {
  try {
    testRunner.copyImageAtAndCapturePixelsAsyncThen(50, 50, completionCallback);
  } catch (e) {
    debug('error in runTest');
    debug(e);
    testRunner.notifyDone();
  }
}
var width, height;
function completionCallback(w, h, snapshot) {
  try {
    width = w;
    height = h;
    shouldBeEqualToNumber("width", 0);
    shouldBeEqualToNumber("height", 0);
  } catch (e) {
    debug('error in completionCallback');
    debug(e);
    testRunner.notifyDone();
    return;
  }
  testRunner.notifyDone();
}

main();
</script>
</head>
<body>
<div id="console"></div>
</body>