| OLD | NEW |
| 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 module("ct-results-comparison"); |
| 13 | 13 |
| 14 asyncTest("basic", 7, function() { | 14 asyncTest("basic", 8, function() { |
| 15 var comparison = document.createElement('ct-results-comparison'); | 15 var comparison = document.createElement('ct-results-comparison'); |
| 16 comparison.type = results.kImageType; | 16 comparison.type = results.kImageType; |
| 17 | 17 |
| 18 var expected = "http://domain.com/dummy-expected"; | 18 var expected = "http://domain.com/dummy-expected"; |
| 19 var actual = "http://domain.com/dummy-actual"; | 19 var actual = "http://domain.com/dummy-actual"; |
| 20 var diff = "http://domain.com/dummy-diff"; | 20 var diff = "http://domain.com/dummy-diff"; |
| 21 | 21 |
| 22 comparison.expectedUrl = expected; | 22 comparison.expectedUrl = expected; |
| 23 comparison.actualUrl = actual; | 23 comparison.actualUrl = actual; |
| 24 comparison.diffUrl = diff; | 24 comparison.diffUrl = diff; |
| 25 | 25 |
| 26 Platform.endOfMicrotask(function() { | 26 requestAnimationFrame(function() { |
| 27 var outputs = comparison.shadowRoot.querySelectorAll('ct-test-output'); | 27 var outputs = comparison.shadowRoot.querySelectorAll('ct-test-output'); |
| 28 equal(outputs.length, 3); | 28 equal(outputs.length, 3); |
| 29 | 29 |
| 30 // Verify we didn't typo any of the bindings. | 30 // Verify we didn't typo any of the bindings. |
| 31 equal(outputs[0].type, results.kImageType); | 31 equal(outputs[0].type, results.kImageType); |
| 32 equal(outputs[0].url, expected); | 32 equal(outputs[0].url, expected); |
| 33 equal(outputs[1].type, results.kImageType); | 33 equal(outputs[1].type, results.kImageType); |
| 34 equal(outputs[1].url, actual); | 34 equal(outputs[1].url, actual); |
| 35 equal(outputs[2].type, results.kImageType); | 35 equal(outputs[2].type, results.kImageType); |
| 36 equal(outputs[2].url, diff); | 36 equal(outputs[2].url, diff); |
| 37 | 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); |
| 38 start(); | 69 start(); |
| 70 }); |
| 39 }); | 71 }); |
| 72 }); |
| 40 }); | 73 }); |
| 41 | 74 |
| 42 })() | 75 })() |
| 43 </script> | 76 </script> |
| OLD | NEW |