Index: Tools/GardeningServer/ui/ct-commit-data-tests.html |
diff --git a/Tools/GardeningServer/ui/ct-commit-data-tests.html b/Tools/GardeningServer/ui/ct-commit-data-tests.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8c23af0b8505f70e878a0d3804efac9d2be02711 |
--- /dev/null |
+++ b/Tools/GardeningServer/ui/ct-commit-data-tests.html |
@@ -0,0 +1,42 @@ |
+<!-- |
+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-commit-data.html"> |
+ |
+<script> |
+(function () { |
+ |
+module("ct-commit-data"); |
+ |
+asyncTest("basic", 2, function() { |
+ // FIXME: ct-commit-data should be self-contained instead of depending on this static function. |
+ var oldCommitDataListForRevisionRange = model.commitDataListForRevisionRange; |
+ var reset = function() { |
+ model.commitDataListForRevisionRange = oldCommitDataListForRevisionRange; |
+ } |
+ |
+ try { |
+ model.commitDataListForRevisionRange = function(first, last) { return [first + ':' + last]; }; |
+ |
+ var commitData = document.createElement('ct-commit-data'); |
+ |
+ commitData.first = 1; |
+ commitData.last = 2; |
+ |
+ commitData.async(function() { |
+ reset(); |
+ equal(commitData.data.length, 1); |
+ equal(commitData.data[0], '1:2'); |
+ start(); |
+ }); |
+ } catch(e) { |
+ reset(); |
+ } |
+ |
+}); |
+ |
+})() |
+</script> |