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 var assert = chai.assert; | |
13 | |
14 describe('ct-test-output', function() { | |
15 var output; | |
16 var resultType; | |
17 var url; | |
18 | |
19 beforeEach(function(done) { | |
20 output = document.createElement('ct-test-output'); | |
21 output.type = resultType; | |
22 output.url = url; | |
23 | |
24 setTimeout(done); | |
25 }); | |
26 | |
27 describe('image', function() { | |
28 before(function() { | |
29 resultType = results.kImageType; | |
30 url = 'https://domain.com/dummy-expected'; | |
31 }); | |
32 | |
33 it('image', function() { | |
34 assert.lengthOf(output.shadowRoot.querySelectorAll('iframe'), 0); | |
35 assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0); | |
36 | |
37 var images = output.shadowRoot.querySelectorAll('img'); | |
38 assert.lengthOf(images, 1); | |
39 assert.equal(images[0].src, url); | |
40 }); | |
41 }); | |
42 | |
43 describe('text', function() { | |
44 before(function() { | |
45 resultType = results.kTextType; | |
46 url = 'https://domain.com/dummy-expected'; | |
47 }); | |
48 | |
49 it('text', function() { | |
50 assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0); | |
51 assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0); | |
52 | |
53 var iframes = output.shadowRoot.querySelectorAll('ct-popout-iframe'); | |
54 assert.lengthOf(iframes, 1); | |
55 assert.equal(iframes[0].src, url); | |
56 }); | |
57 }); | |
58 | |
59 describe('audio', function() { | |
60 before(function() { | |
61 resultType = results.kAudioType; | |
62 url = 'https://domain.com/dummy-expected'; | |
63 }); | |
64 | |
65 it('audio', function() { | |
66 assert.lengthOf(output.shadowRoot.querySelectorAll('iframe'), 0); | |
67 assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0); | |
68 | |
69 var audios = output.shadowRoot.querySelectorAll('audio'); | |
70 assert.lengthOf(audios, 1); | |
71 assert.equal(audios[0].src, url); | |
72 }); | |
73 }); | |
74 | |
75 describe('unknown type', function() { | |
76 before(function() { | |
77 resultType = 'lambeosaurus'; | |
78 url = 'https://domain.com/dummy-expected'; | |
79 }); | |
80 | |
81 it('no output', function() { | |
82 assert.lengthOf(output.shadowRoot.querySelectorAll('iframe'), 0); | |
83 assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0); | |
84 assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0); | |
85 }); | |
86 }); | |
87 | |
88 describe('no url', function() { | |
89 before(function() { | |
90 resultType = results.kImageType; | |
91 url = undefined; | |
92 }); | |
93 | |
94 it('no output', function() { | |
95 assert.lengthOf(output.shadowRoot.querySelectorAll('iframe'), 0); | |
96 assert.lengthOf(output.shadowRoot.querySelectorAll('audio'), 0); | |
97 assert.lengthOf(output.shadowRoot.querySelectorAll('img'), 0); | |
98 }); | |
99 }); | |
100 }); | |
101 | |
102 })(); | |
103 </script> | |
OLD | NEW |