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-results-comparison.html"> |
| 8 |
| 9 <script> |
| 10 (function () { |
| 11 |
| 12 module("ct-results-comparison"); |
| 13 |
| 14 asyncTest("text", 4, function() { |
| 15 var comparison = document.createElement('ct-results-comparison'); |
| 16 comparison.type = results.kTextType; |
| 17 comparison.diffUrl = "http://domain.com/dummy-diff"; |
| 18 |
| 19 Platform.endOfMicrotask(function() { |
| 20 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
| 21 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
| 22 |
| 23 var iframes = comparison.shadowRoot.querySelectorAll('iframe'); |
| 24 equal(iframes.length, 1); |
| 25 equal(iframes[0].src, 'http://domain.com/dummy-diff'); |
| 26 start(); |
| 27 }); |
| 28 }); |
| 29 |
| 30 asyncTest("audio", 4, function() { |
| 31 var comparison = document.createElement('ct-results-comparison'); |
| 32 comparison.type = results.kAudioType; |
| 33 comparison.expectedUrl = "http://domain.com/dummy-expected"; |
| 34 |
| 35 Platform.endOfMicrotask(function() { |
| 36 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
| 37 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
| 38 |
| 39 var audios = comparison.shadowRoot.querySelectorAll('audio'); |
| 40 equal(audios.length, 1); |
| 41 equal(audios[0].src, 'http://domain.com/dummy-expected'); |
| 42 start(); |
| 43 }); |
| 44 }); |
| 45 |
| 46 asyncTest("image", 6, function() { |
| 47 var comparison = document.createElement('ct-results-comparison'); |
| 48 comparison.type = results.kImageType; |
| 49 comparison.actualUrl = "http://domain.com/dummy-actual"; |
| 50 comparison.diffUrl = "http://domain.com/dummy-diff"; |
| 51 comparison.expectedUrl = "http://domain.com/dummy-expected"; |
| 52 |
| 53 Platform.endOfMicrotask(function() { |
| 54 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
| 55 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
| 56 |
| 57 var images = comparison.shadowRoot.querySelectorAll('img'); |
| 58 equal(images.length, 3); |
| 59 equal(images[0].src, 'http://domain.com/dummy-expected'); |
| 60 equal(images[1].src, 'http://domain.com/dummy-actual'); |
| 61 equal(images[2].src, 'http://domain.com/dummy-diff'); |
| 62 start(); |
| 63 }); |
| 64 }); |
| 65 |
| 66 asyncTest("no-urls", 3, function() { |
| 67 var comparison = document.createElement('ct-results-comparison'); |
| 68 comparison.type = results.kImageType; |
| 69 |
| 70 Platform.endOfMicrotask(function() { |
| 71 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
| 72 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
| 73 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
| 74 start(); |
| 75 }); |
| 76 }); |
| 77 |
| 78 asyncTest("no-type", 3, function() { |
| 79 var comparison = document.createElement('ct-results-comparison'); |
| 80 comparison.actualUrl = "http://domain.com/dummy-actual"; |
| 81 comparison.diffUrl = "http://domain.com/dummy-diff"; |
| 82 comparison.expectedUrl = "http://domain.com/dummy-expected"; |
| 83 |
| 84 Platform.endOfMicrotask(function() { |
| 85 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
| 86 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
| 87 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
| 88 start(); |
| 89 }); |
| 90 }); |
| 91 |
| 92 })() |
| 93 </script> |
OLD | NEW |