OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <link rel="import" href="ct-test-output.html"> |
| 8 |
| 9 <script> |
| 10 (function () { |
| 11 |
| 12 module("ct-test-output"); |
| 13 |
| 14 asyncTest("image", 4, function() { |
| 15 var output = document.createElement('ct-test-output'); |
| 16 output.type = results.kImageType; |
| 17 |
| 18 var url = "http://domain.com/dummy-expected"; |
| 19 output.url = url; |
| 20 |
| 21 Platform.endOfMicrotask(function() { |
| 22 equal(output.shadowRoot.querySelectorAll('iframe').length, 0); |
| 23 equal(output.shadowRoot.querySelectorAll('audio').length, 0); |
| 24 |
| 25 var images = output.shadowRoot.querySelectorAll('img'); |
| 26 equal(images.length, 1); |
| 27 equal(images[0].src, url); |
| 28 |
| 29 start(); |
| 30 }); |
| 31 }); |
| 32 |
| 33 asyncTest("text", 4, function() { |
| 34 var output = document.createElement('ct-test-output'); |
| 35 output.type = results.kTextType; |
| 36 |
| 37 var url = "http://domain.com/dummy-expected"; |
| 38 output.url = url; |
| 39 |
| 40 Platform.endOfMicrotask(function() { |
| 41 equal(output.shadowRoot.querySelectorAll('img').length, 0); |
| 42 equal(output.shadowRoot.querySelectorAll('audio').length, 0); |
| 43 |
| 44 var images = output.shadowRoot.querySelectorAll('iframe'); |
| 45 equal(images.length, 1); |
| 46 equal(images[0].src, url); |
| 47 |
| 48 start(); |
| 49 }); |
| 50 }); |
| 51 |
| 52 asyncTest("audio", 4, function() { |
| 53 var output = document.createElement('ct-test-output'); |
| 54 output.type = results.kAudioType; |
| 55 |
| 56 var url = "http://domain.com/dummy-expected"; |
| 57 output.url = url; |
| 58 |
| 59 Platform.endOfMicrotask(function() { |
| 60 equal(output.shadowRoot.querySelectorAll('iframe').length, 0); |
| 61 equal(output.shadowRoot.querySelectorAll('img').length, 0); |
| 62 |
| 63 var images = output.shadowRoot.querySelectorAll('audio'); |
| 64 equal(images.length, 1); |
| 65 equal(images[0].src, url); |
| 66 |
| 67 start(); |
| 68 }); |
| 69 }); |
| 70 |
| 71 asyncTest("unknown-type", 3, function() { |
| 72 var output = document.createElement('ct-test-output'); |
| 73 output.type = 'garbage'; |
| 74 |
| 75 var url = "http://domain.com/dummy-expected"; |
| 76 output.url = url; |
| 77 |
| 78 Platform.endOfMicrotask(function() { |
| 79 equal(output.shadowRoot.querySelectorAll('iframe').length, 0); |
| 80 equal(output.shadowRoot.querySelectorAll('audio').length, 0); |
| 81 equal(output.shadowRoot.querySelectorAll('img').length, 0); |
| 82 |
| 83 start(); |
| 84 }); |
| 85 }); |
| 86 |
| 87 asyncTest("no-url", 3, function() { |
| 88 var output = document.createElement('ct-test-output'); |
| 89 output.type = results.kImageType; |
| 90 |
| 91 Platform.endOfMicrotask(function() { |
| 92 equal(output.shadowRoot.querySelectorAll('iframe').length, 0); |
| 93 equal(output.shadowRoot.querySelectorAll('audio').length, 0); |
| 94 equal(output.shadowRoot.querySelectorAll('img').length, 0); |
| 95 |
| 96 start(); |
| 97 }); |
| 98 }); |
| 99 |
| 100 })() |
| 101 </script> |
OLD | NEW |