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

Side by Side Diff: Tools/GardeningServer/ui/test/ct-results-comparison-tests.html

Issue 459463003: Convert moar Sheriff-o-Matic tests to Polymer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!-- 1 <!--
2 Copyright 2014 The Chromium Authors. All rights reserved. 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 3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file. 4 found in the LICENSE file.
5 --> 5 -->
6 6
7 <link rel="import" href="ct-results-comparison.html"> 7 <link rel="import" href="../ct-results-comparison.html">
8 8
9 <script> 9 <script>
10 (function () { 10 (function () {
11 11
12 module("ct-results-comparison"); 12 var assert = chai.assert;
13 13
14 asyncTest("basic", 8, function() { 14 describe('ct-results-comparison', function() {
15 var comparison = document.createElement('ct-results-comparison'); 15 describe('results comparison UI', function() {
16 comparison.type = results.kImageType; 16 var comparison;
17 var expected, actual, diff;
17 18
18 var expected = "http://domain.com/dummy-expected"; 19 before(function(done) {
19 var actual = "http://domain.com/dummy-actual"; 20 comparison = document.createElement('ct-results-comparison');
20 var diff = "http://domain.com/dummy-diff"; 21 comparison.type = results.kImageType;
21 22
22 comparison.expectedUrl = expected; 23 expected = "http://domain.com/dummy-expected";
23 comparison.actualUrl = actual; 24 actual = "http://domain.com/dummy-actual";
24 comparison.diffUrl = diff; 25 diff = "http://domain.com/dummy-diff";
25 26
26 requestAnimationFrame(function() { 27 comparison.expectedUrl = expected;
27 var outputs = comparison.shadowRoot.querySelectorAll('ct-test-output'); 28 comparison.actualUrl = actual;
28 equal(outputs.length, 3); 29 comparison.diffUrl = diff;
29 30
30 // Verify we didn't typo any of the bindings. 31 setTimeout(done);
31 equal(outputs[0].type, results.kImageType); 32 });
32 equal(outputs[0].url, expected);
33 equal(outputs[1].type, results.kImageType);
34 equal(outputs[1].url, actual);
35 equal(outputs[2].type, results.kImageType);
36 equal(outputs[2].url, diff);
37 33
38 equal(comparison.shadowRoot.querySelectorAll('ct-results-comparison-zoomer') .length, 0); 34 it('should show expected, actual and diff', function() {
35 var outputs = comparison.shadowRoot.querySelectorAll('ct-test-output');
36 assert.lengthOf(outputs, 3);
39 37
40 start(); 38 // Verify we didn't typo any of the bindings.
39 assert.equal(outputs[0].type, results.kImageType);
40 assert.equal(outputs[0].url, expected);
41 assert.equal(outputs[1].type, results.kImageType);
42 assert.equal(outputs[1].url, actual);
43 assert.equal(outputs[2].type, results.kImageType);
44 assert.equal(outputs[2].url, diff);
45
46 assert.lengthOf(comparison.shadowRoot.querySelectorAll('ct-results-compari son-zoomer'), 0);
47 });
41 }); 48 });
42 });
43 49
44 asyncTest('zoomer', 3, function() { 50 describe('zoomer', function() {
45 // FIXME: Create a MouseEventMock class to use here. 51 // FIXME: Create a MouseEventMock class to use here.
46 var mockMouseEvent = { 52 var mockMouseEvent = {
47 clientX: 0, 53 clientX: 0,
48 clientY: 0, 54 clientY: 0,
49 target: document.createElement('div'), 55 target: document.createElement('div'),
50 } 56 }
51 57
52 var imageComparison = document.createElement('ct-results-comparison'); 58 var imageComparison;
53 imageComparison.type = results.kImageType; 59 var nonImageComparison;
54 60
55 var nonImageComparison = document.createElement('ct-results-comparison'); 61 before(function(done) {
62 imageComparison = document.createElement('ct-results-comparison');
63 imageComparison.type = results.kImageType;
64 nonImageComparison = document.createElement('ct-results-comparison');
65 setTimeout(done);
66 });
56 67
57 requestAnimationFrame(function() { 68 before(function(done) {
58 imageComparison._handleMouseMove(mockMouseEvent); 69 imageComparison._handleMouseMove(mockMouseEvent);
59 nonImageComparison._handleMouseMove(mockMouseEvent); 70 nonImageComparison._handleMouseMove(mockMouseEvent);
71 setTimeout(done);
72 });
60 73
61 requestAnimationFrame(function() { 74 it('should exist on images', function(done) {
62 equal(imageComparison.shadowRoot.querySelectorAll('ct-results-comparison-z oomer').length, 1); 75 assert.lengthOf(imageComparison.shadowRoot.querySelectorAll('ct-results-co mparison-zoomer'), 1);
63 equal(nonImageComparison.shadowRoot.querySelectorAll('ct-results-compariso n-zoomer').length, 0); 76 assert.lengthOf(nonImageComparison.shadowRoot.querySelectorAll('ct-results -comparison-zoomer'), 0);
64 77
65 imageComparison.type = 'foo'; 78 imageComparison.type = 'foo';
79 setTimeout(done);
80 });
66 81
67 requestAnimationFrame(function() { 82 it('should not exist on other result types', function() {
68 equal(imageComparison.shadowRoot.querySelectorAll('ct-results-comparison -zoomer').length, 0); 83 assert.lengthOf(imageComparison.shadowRoot.querySelectorAll('ct-results-co mparison-zoomer'), 0);
69 start();
70 });
71 }); 84 });
72 }); 85 });
73 }); 86 });
74 87
75 })() 88 })()
76 </script> 89 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698