Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Unified Diff: Tools/GardeningServer/ui/results-comparison-tests.html

Issue 350563002: Port first garden-o-matic component over to polymer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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">
+
+<script>
+(function () {
+
+module("results-comparison");
+
+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?
+ 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.
+
+ // 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>
« Tools/GardeningServer/garden-o-matic.html ('K') | « Tools/GardeningServer/ui/results-comparison.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698