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-results-comparison.html"> | |
8 | |
9 <script> | |
10 (function () { | |
11 | |
12 module("ct-results-comparison"); | |
13 | |
14 asyncTest("basic", 8, function() { | |
15 var comparison = document.createElement('ct-results-comparison'); | |
16 comparison.type = results.kImageType; | |
17 | |
18 var expected = "http://domain.com/dummy-expected"; | |
19 var actual = "http://domain.com/dummy-actual"; | |
20 var diff = "http://domain.com/dummy-diff"; | |
21 | |
22 comparison.expectedUrl = expected; | |
23 comparison.actualUrl = actual; | |
24 comparison.diffUrl = diff; | |
25 | |
26 requestAnimationFrame(function() { | |
27 var outputs = comparison.shadowRoot.querySelectorAll('ct-test-output'); | |
28 equal(outputs.length, 3); | |
29 | |
30 // Verify we didn't typo any of the bindings. | |
31 equal(outputs[0].type, results.kImageType); | |
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 | |
38 equal(comparison.shadowRoot.querySelectorAll('ct-results-comparison-zoomer')
.length, 0); | |
39 | |
40 start(); | |
41 }); | |
42 }); | |
43 | |
44 asyncTest('zoomer', 3, function() { | |
45 // FIXME: Create a MouseEventMock class to use here. | |
46 var mockMouseEvent = { | |
47 clientX: 0, | |
48 clientY: 0, | |
49 target: document.createElement('div'), | |
50 } | |
51 | |
52 var imageComparison = document.createElement('ct-results-comparison'); | |
53 imageComparison.type = results.kImageType; | |
54 | |
55 var nonImageComparison = document.createElement('ct-results-comparison'); | |
56 | |
57 requestAnimationFrame(function() { | |
58 imageComparison._handleMouseMove(mockMouseEvent); | |
59 nonImageComparison._handleMouseMove(mockMouseEvent); | |
60 | |
61 requestAnimationFrame(function() { | |
62 equal(imageComparison.shadowRoot.querySelectorAll('ct-results-comparison-z
oomer').length, 1); | |
63 equal(nonImageComparison.shadowRoot.querySelectorAll('ct-results-compariso
n-zoomer').length, 0); | |
64 | |
65 imageComparison.type = 'foo'; | |
66 | |
67 requestAnimationFrame(function() { | |
68 equal(imageComparison.shadowRoot.querySelectorAll('ct-results-comparison
-zoomer').length, 0); | |
69 start(); | |
70 }); | |
71 }); | |
72 }); | |
73 }); | |
74 | |
75 })() | |
76 </script> | |
OLD | NEW |