| <!-- |
| Copyright 2014 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="ct-test-output.html"> |
| |
| <script> |
| (function () { |
| |
| module("ct-test-output"); |
| |
| asyncTest("image", 4, function() { |
| var output = document.createElement('ct-test-output'); |
| output.type = results.kImageType; |
| |
| var url = "http://domain.com/dummy-expected"; |
| output.url = url; |
| |
| Platform.endOfMicrotask(function() { |
| equal(output.shadowRoot.querySelectorAll('iframe').length, 0); |
| equal(output.shadowRoot.querySelectorAll('audio').length, 0); |
| |
| var images = output.shadowRoot.querySelectorAll('img'); |
| equal(images.length, 1); |
| equal(images[0].src, url); |
| |
| start(); |
| }); |
| }); |
| |
| asyncTest("text", 4, function() { |
| var output = document.createElement('ct-test-output'); |
| output.type = results.kTextType; |
| |
| var url = "http://domain.com/dummy-expected"; |
| output.url = url; |
| |
| Platform.endOfMicrotask(function() { |
| equal(output.shadowRoot.querySelectorAll('img').length, 0); |
| equal(output.shadowRoot.querySelectorAll('audio').length, 0); |
| |
| var images = output.shadowRoot.querySelectorAll('iframe'); |
| equal(images.length, 1); |
| equal(images[0].src, url); |
| |
| start(); |
| }); |
| }); |
| |
| asyncTest("audio", 4, function() { |
| var output = document.createElement('ct-test-output'); |
| output.type = results.kAudioType; |
| |
| var url = "http://domain.com/dummy-expected"; |
| output.url = url; |
| |
| Platform.endOfMicrotask(function() { |
| equal(output.shadowRoot.querySelectorAll('iframe').length, 0); |
| equal(output.shadowRoot.querySelectorAll('img').length, 0); |
| |
| var images = output.shadowRoot.querySelectorAll('audio'); |
| equal(images.length, 1); |
| equal(images[0].src, url); |
| |
| start(); |
| }); |
| }); |
| |
| asyncTest("unknown-type", 3, function() { |
| var output = document.createElement('ct-test-output'); |
| output.type = 'garbage'; |
| |
| var url = "http://domain.com/dummy-expected"; |
| output.url = url; |
| |
| Platform.endOfMicrotask(function() { |
| equal(output.shadowRoot.querySelectorAll('iframe').length, 0); |
| equal(output.shadowRoot.querySelectorAll('audio').length, 0); |
| equal(output.shadowRoot.querySelectorAll('img').length, 0); |
| |
| start(); |
| }); |
| }); |
| |
| asyncTest("no-url", 3, function() { |
| var output = document.createElement('ct-test-output'); |
| output.type = results.kImageType; |
| |
| Platform.endOfMicrotask(function() { |
| equal(output.shadowRoot.querySelectorAll('iframe').length, 0); |
| equal(output.shadowRoot.querySelectorAll('audio').length, 0); |
| equal(output.shadowRoot.querySelectorAll('img').length, 0); |
| |
| start(); |
| }); |
| }); |
| |
| })() |
| </script> |