Index: Tools/GardeningServer/ui/results-comparison-tests.html |
diff --git a/Tools/GardeningServer/ui/results-comparison-tests.html b/Tools/GardeningServer/ui/results-comparison-tests.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d3b9266f5a79ad8a66b05d4cf598f811a33bbcb6 |
--- /dev/null |
+++ b/Tools/GardeningServer/ui/results-comparison-tests.html |
@@ -0,0 +1,146 @@ |
+<!-- |
+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="results-comparison.html"> |
esprehn
2014/06/22 05:15:20
ditto
ojan
2014/06/22 22:49:22
done.
|
+ |
+<script> |
+(function () { |
+ |
+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
|
+ |
+asyncTest("text", 6, function() { |
+ var comparison = document.createElement('results-comparison'); |
+ ok(comparison); |
+ |
+ comparison.type = results.kTextType; |
+ comparison.urlsByKind = { |
+ "diff": "http://domain.com/dummy-diff", |
+ }; |
+ |
+ // FIXME: We just want to run at the end of the microtask after MDV has process |
+ // all the data changes. Is there a better way? |
+ setTimeout(function() { |
+ equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
+ |
+ var iframes = comparison.shadowRoot.querySelectorAll('iframe'); |
+ equal(iframes.length, 1); |
+ equal(iframes[0].src, 'http://domain.com/dummy-diff'); |
+ equal(iframes[0].parentNode.id, 'diff') |
+ start(); |
+ }); |
+}); |
+ |
+asyncTest("audio", 6, function() { |
+ var comparison = document.createElement('results-comparison'); |
+ ok(comparison); |
+ |
+ comparison.type = results.kAudioType; |
+ comparison.urlsByKind = { |
+ "expected": "http://domain.com/dummy-expected", |
+ }; |
+ |
+ // FIXME: We just want to run at the end of the microtask after MDV has process |
+ // 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.
|
+ setTimeout(function() { |
+ equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
+ |
+ var audios = comparison.shadowRoot.querySelectorAll('audio'); |
+ equal(audios.length, 1); |
+ equal(audios[0].src, 'http://domain.com/dummy-expected'); |
+ equal(audios[0].parentNode.id, 'expected') |
+ start(); |
+ }); |
+}); |
+ |
+asyncTest("image", 10, function() { |
+ var comparison = document.createElement('results-comparison'); |
+ ok(comparison); |
+ |
+ comparison.type = results.kImageType; |
+ comparison.urlsByKind = { |
+ "expected": "http://domain.com/dummy-expected", |
+ "actual": "http://domain.com/dummy-actual", |
+ "diff": "http://domain.com/dummy-diff", |
+ }; |
+ |
+ // FIXME: We just want to run at the end of the microtask after MDV has process |
+ // all the data changes. Is there a better way? |
+ setTimeout(function() { |
+ equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
+ |
+ var images = comparison.shadowRoot.querySelectorAll('img'); |
+ equal(images.length, 3); |
+ equal(images[0].src, 'http://domain.com/dummy-expected'); |
+ equal(images[0].parentNode.id, 'expected') |
+ equal(images[1].src, 'http://domain.com/dummy-actual'); |
+ equal(images[1].parentNode.id, 'actual') |
+ equal(images[2].src, 'http://domain.com/dummy-diff'); |
+ equal(images[2].parentNode.id, 'diff') |
+ start(); |
+ }); |
+}); |
+ |
+asyncTest("unknown-kind", 4, function() { |
+ var comparison = document.createElement('results-comparison'); |
+ ok(comparison); |
+ |
+ comparison.type = results.kImageType; |
+ comparison.urlsByKind = { |
+ "garbage": "http://domain.com/dummy-expected", |
+ }; |
+ |
+ // FIXME: This should assert that the update step throws an error, |
+ // 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.
|
+ |
+ // FIXME: We just want to run at the end of the microtask after MDV has process |
+ // all the data changes. Is there a better way? |
+ setTimeout(function() { |
+ equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
+ start(); |
+ }); |
+}); |
+ |
+asyncTest("only-type", 4, function() { |
+ var comparison = document.createElement('results-comparison'); |
+ ok(comparison); |
+ |
+ comparison.type = results.kImageType; |
+ |
+ // FIXME: We just want to run at the end of the microtask after MDV has process |
+ // all the data changes. Is there a better way? |
+ setTimeout(function() { |
+ equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
+ start(); |
+ }); |
+}); |
+ |
+asyncTest("only-urlsByKind", 4, function() { |
+ var comparison = document.createElement('results-comparison'); |
+ ok(comparison); |
+ |
+ comparison.urlsByKind = { |
+ "garbage": "http://domain.com/dummy-expected", |
+ }; |
+ |
+ // FIXME: We just want to run at the end of the microtask after MDV has process |
+ // all the data changes. Is there a better way? |
+ setTimeout(function() { |
+ equal(comparison.shadowRoot.querySelectorAll('iframe').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('audio').length, 0); |
+ equal(comparison.shadowRoot.querySelectorAll('img').length, 0); |
+ start(); |
+ }); |
+}); |
+ |
+})() |
+</script> |