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

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

Issue 728023004: Remove GardeningServer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 var assert = chai.assert;
15
16 describe('ct-results-comparison-zoomer', function() {
17 var zoomer;
18
19 beforeEach(function(done) {
20 zoomer = document.createElement('ct-results-comparison-zoomer');
21 setTimeout(done);
22 });
23
24 it('should draw after position is changed', function(done) {
25 // FIXME: This should set zoomer.position instead, but there's no way
26 // to get between the microtask and requestAnimationFrame to verify the
27 // behavior.
28 zoomer.positionChanged();
29 assert(zoomer._drawScheduled);
30
31 requestAnimationFrame(function() {
32 assert(!zoomer._drawScheduled);
33 done();
34 });
35 });
36
37 it('draw', function() {
38 zoomer._drawAll();
39
40 // FIXME: Use a proper model class instead of a dumb object.
41 zoomer.position = {x: 0, y: 0};
42 zoomer._drawAll();
43
44 zoomer._draw(zoomer.$.diffZoomer);
45 });
46
47 it('drawCanvas', function(done) {
48 zoomer.position = {x: 0.2, y: 0.5};
49
50 setTimeout(function() {
51 var canvasContext = new CTCanvas2dContextMock();
52 zoomer._drawCanvas(canvasContext, zoomer.$.diffZoomer);
53
54 var expectedContext = new CTCanvas2dContextMock();
55 expectedContext.imageSmoothingEnabled = false;
56 expectedContext.translate(-960, -1800);
57 expectedContext.strokeRect(-1.5, -1.5, 4802, 3602);
58 expectedContext.scale(6, 6);
59 expectedContext.drawImage(zoomer.shadowRoot.querySelector('img'), 0, 0);
60 assert.deepEqual(canvasContext, expectedContext);
61
62 done();
63 });
64 });
65 });
66
67 })();
68 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698