Index: Tools/GardeningServer/ui/ct-results-comparison-zoomer-tests.html |
diff --git a/Tools/GardeningServer/ui/ct-results-comparison-zoomer-tests.html b/Tools/GardeningServer/ui/ct-results-comparison-zoomer-tests.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e678b2087cb5c9ad78f579faa2bdad2240cb9cd9 |
--- /dev/null |
+++ b/Tools/GardeningServer/ui/ct-results-comparison-zoomer-tests.html |
@@ -0,0 +1,59 @@ |
+<!-- |
+Copyright 2014 The Chromium Authors. All rights reserved. |
+Use of this source code is governed by a BSD-style license that can be |
+found in the LICENSE file. |
+--> |
+ |
+<link rel="import" href="ct-results-comparison-zoomer.html"> |
+ |
+<script> |
+(function () { |
+ |
+module("ct-results-comparison-zoomer"); |
+ |
+asyncTest("no-position", 2, function() { |
+ var zoomer = document.createElement('ct-results-comparison-zoomer'); |
+ // FIXME: This should set zoomer.position instead, but there's no way |
+ // to get between the microtask and requestAnimationFrame to verify the |
+ // behavior. |
+ zoomer.positionChanged(); |
+ ok(zoomer._drawScheduled); |
+ |
+ requestAnimationFrame(function() { |
+ ok(!zoomer._drawScheduled); |
+ start(); |
+ }); |
+}); |
+ |
+test("draw", 3, function() { |
+ // Hard to verify correct behavior here, but at least make sure the |
+ // code executes without throwing errors. |
+ |
+ var zoomer = document.createElement('ct-results-comparison-zoomer'); |
+ |
+ try { |
+ zoomer._drawAll(); |
+ ok(true); |
+ } catch(e) { |
+ ok(false); |
+ } |
+ |
+ // FIXME: Use a proper model class instead of a dumb object. |
+ zoomer.position = {x: 0, y: 0}; |
+ try { |
+ zoomer._drawAll(); |
+ ok(true); |
+ } catch(e) { |
+ ok(false); |
+ } |
+ |
+ try { |
+ zoomer._draw(zoomer.$.diffZoomer); |
+ ok(true); |
+ } catch(e) { |
+ ok(false); |
+ } |
+}); |
+ |
+})() |
+</script> |