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

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

Issue 464163002: Sheriff-o-Matic: Convert some more ui tests to mocha (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
(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-zoomer.html">
8
9 <link rel="import" href="../base/ct-canvas-2d-context-mock.html">
10
11 <script>
12 (function () {
13
14 module("ct-results-comparison-zoomer");
15
16 asyncTest("no-position", 2, function() {
17 var zoomer = document.createElement('ct-results-comparison-zoomer');
18 // FIXME: This should set zoomer.position instead, but there's no way
19 // to get between the microtask and requestAnimationFrame to verify the
20 // behavior.
21 zoomer.positionChanged();
22 ok(zoomer._drawScheduled);
23
24 requestAnimationFrame(function() {
25 ok(!zoomer._drawScheduled);
26 start();
27 });
28 });
29
30 test("draw", 3, function() {
31 // Hard to verify correct behavior here, but at least make sure the
32 // code executes without throwing errors.
33
34 var zoomer = document.createElement('ct-results-comparison-zoomer');
35
36 try {
37 zoomer._drawAll();
38 ok(true);
39 } catch(e) {
40 ok(false);
41 }
42
43 // FIXME: Use a proper model class instead of a dumb object.
44 zoomer.position = {x: 0, y: 0};
45 try {
46 zoomer._drawAll();
47 ok(true);
48 } catch(e) {
49 ok(false);
50 }
51
52 try {
53 zoomer._draw(zoomer.$.diffZoomer);
54 ok(true);
55 } catch(e) {
56 ok(false);
57 }
58 });
59
60 asyncTest("drawCanvas", 1, function() {
61 var zoomer = document.createElement('ct-results-comparison-zoomer');
62 zoomer.position = {x: 0.2, y: 0.5};
63
64 requestAnimationFrame(function() {
65 var canvasContext = new CTCanvas2dContextMock();
66 zoomer._drawCanvas(canvasContext, zoomer.$.diffZoomer);
67
68 var expectedContext = new CTCanvas2dContextMock();
69 expectedContext.imageSmoothingEnabled = false;
70 expectedContext.translate(-960, -1800);
71 expectedContext.strokeRect(-1.5, -1.5, 4802, 3602);
72 expectedContext.scale(6, 6);
73 expectedContext.drawImage(zoomer.shadowRoot.querySelector('img'), 0, 0);
74 deepEqual(canvasContext, expectedContext);
75 start();
76 });
77 });
78
79 })()
80 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698