Chromium Code Reviews| 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="results-comparison.html"> | |
|
esprehn
2014/06/22 05:15:20
ditto
ojan
2014/06/22 22:49:22
done.
| |
| 8 | |
| 9 <script> | |
| 10 (function () { | |
| 11 | |
| 12 module("results-comparison"); | |
|
esprehn
2014/06/22 05:15:20
What is this?
ojan
2014/06/22 06:33:19
This is just the name of the test suite. Makes it
ojan
2014/06/22 22:49:22
Alternately, we could do this manually, e.g. async
| |
| 13 | |
| 14 asyncTest("text", 6, function() { | |
| 15 var comparison = document.createElement('results-comparison'); | |
| 16 ok(comparison); | |
| 17 | |
| 18 comparison.type = results.kTextType; | |
| 19 comparison.urlsByKind = { | |
| 20 "diff": "http://domain.com/dummy-diff", | |
| 21 }; | |
| 22 | |
| 23 // FIXME: We just want to run at the end of the microtask after MDV has proc ess | |
| 24 // all the data changes. Is there a better way? | |
| 25 setTimeout(function() { | |
| 26 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); | |
| 27 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); | |
| 28 | |
| 29 var iframes = comparison.shadowRoot.querySelectorAll('iframe'); | |
| 30 equal(iframes.length, 1); | |
| 31 equal(iframes[0].src, 'http://domain.com/dummy-diff'); | |
| 32 equal(iframes[0].parentNode.id, 'diff') | |
| 33 start(); | |
| 34 }); | |
| 35 }); | |
| 36 | |
| 37 asyncTest("audio", 6, function() { | |
| 38 var comparison = document.createElement('results-comparison'); | |
| 39 ok(comparison); | |
| 40 | |
| 41 comparison.type = results.kAudioType; | |
| 42 comparison.urlsByKind = { | |
| 43 "expected": "http://domain.com/dummy-expected", | |
| 44 }; | |
| 45 | |
| 46 // FIXME: We just want to run at the end of the microtask after MDV has proc ess | |
| 47 // all the data changes. Is there a better way? | |
|
esprehn
2014/06/22 05:15:20
Platform.endOfMicrotask(fn). I wouldn't use setTim
ojan
2014/06/22 22:49:22
Done.
| |
| 48 setTimeout(function() { | |
| 49 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); | |
| 50 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); | |
| 51 | |
| 52 var audios = comparison.shadowRoot.querySelectorAll('audio'); | |
| 53 equal(audios.length, 1); | |
| 54 equal(audios[0].src, 'http://domain.com/dummy-expected'); | |
| 55 equal(audios[0].parentNode.id, 'expected') | |
| 56 start(); | |
| 57 }); | |
| 58 }); | |
| 59 | |
| 60 asyncTest("image", 10, function() { | |
| 61 var comparison = document.createElement('results-comparison'); | |
| 62 ok(comparison); | |
| 63 | |
| 64 comparison.type = results.kImageType; | |
| 65 comparison.urlsByKind = { | |
| 66 "expected": "http://domain.com/dummy-expected", | |
| 67 "actual": "http://domain.com/dummy-actual", | |
| 68 "diff": "http://domain.com/dummy-diff", | |
| 69 }; | |
| 70 | |
| 71 // FIXME: We just want to run at the end of the microtask after MDV has proc ess | |
| 72 // all the data changes. Is there a better way? | |
| 73 setTimeout(function() { | |
| 74 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); | |
| 75 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); | |
| 76 | |
| 77 var images = comparison.shadowRoot.querySelectorAll('img'); | |
| 78 equal(images.length, 3); | |
| 79 equal(images[0].src, 'http://domain.com/dummy-expected'); | |
| 80 equal(images[0].parentNode.id, 'expected') | |
| 81 equal(images[1].src, 'http://domain.com/dummy-actual'); | |
| 82 equal(images[1].parentNode.id, 'actual') | |
| 83 equal(images[2].src, 'http://domain.com/dummy-diff'); | |
| 84 equal(images[2].parentNode.id, 'diff') | |
| 85 start(); | |
| 86 }); | |
| 87 }); | |
| 88 | |
| 89 asyncTest("unknown-kind", 4, function() { | |
| 90 var comparison = document.createElement('results-comparison'); | |
| 91 ok(comparison); | |
| 92 | |
| 93 comparison.type = results.kImageType; | |
| 94 comparison.urlsByKind = { | |
| 95 "garbage": "http://domain.com/dummy-expected", | |
| 96 }; | |
| 97 | |
| 98 // FIXME: This should assert that the update step throws an error, | |
| 99 // but that happens at microtask time, so there's no way to catch it. | |
|
esprehn
2014/06/22 05:15:20
What update step throws errors?
ojan
2014/06/22 06:33:19
The actual _update method in results-comparison th
ojan
2014/06/22 22:49:22
In either case, it's gone now.
| |
| 100 | |
| 101 // FIXME: We just want to run at the end of the microtask after MDV has proc ess | |
| 102 // all the data changes. Is there a better way? | |
| 103 setTimeout(function() { | |
| 104 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); | |
| 105 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); | |
| 106 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); | |
| 107 start(); | |
| 108 }); | |
| 109 }); | |
| 110 | |
| 111 asyncTest("only-type", 4, function() { | |
| 112 var comparison = document.createElement('results-comparison'); | |
| 113 ok(comparison); | |
| 114 | |
| 115 comparison.type = results.kImageType; | |
| 116 | |
| 117 // FIXME: We just want to run at the end of the microtask after MDV has proc ess | |
| 118 // all the data changes. Is there a better way? | |
| 119 setTimeout(function() { | |
| 120 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); | |
| 121 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); | |
| 122 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); | |
| 123 start(); | |
| 124 }); | |
| 125 }); | |
| 126 | |
| 127 asyncTest("only-urlsByKind", 4, function() { | |
| 128 var comparison = document.createElement('results-comparison'); | |
| 129 ok(comparison); | |
| 130 | |
| 131 comparison.urlsByKind = { | |
| 132 "garbage": "http://domain.com/dummy-expected", | |
| 133 }; | |
| 134 | |
| 135 // FIXME: We just want to run at the end of the microtask after MDV has proc ess | |
| 136 // all the data changes. Is there a better way? | |
| 137 setTimeout(function() { | |
| 138 equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); | |
| 139 equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); | |
| 140 equal(comparison.shadowRoot.querySelectorAll('img').length, 0); | |
| 141 start(); | |
| 142 }); | |
| 143 }); | |
| 144 | |
| 145 })() | |
| 146 </script> | |
| OLD | NEW |