Roll out r9059 to unbreak bots


git-svn-id: http://skia.googlecode.com/svn/trunk@9060 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/ChecksumTest.cpp b/tests/ChecksumTest.cpp
index ee33d32..81e7ef3 100644
--- a/tests/ChecksumTest.cpp
+++ b/tests/ChecksumTest.cpp
@@ -8,6 +8,7 @@
 #include "Test.h"
 
 #include "SkChecksum.h"
+#include "SkCityHash.h"
 
 // Word size that is large enough to hold results of any checksum type.
 typedef uint64_t checksum_result;
@@ -24,7 +25,9 @@
         }
     private:
         enum Algorithm {
-            kSkChecksum
+            kSkChecksum,
+            kSkCityHash32,
+            kSkCityHash64
         };
 
         // Call Compute(data, size) on the appropriate checksum algorithm,
@@ -38,6 +41,10 @@
                 REPORTER_ASSERT_MESSAGE(fReporter, SkIsAlign4(size),
                                         "test data size is not 32-bit aligned");
                 return SkChecksum::Compute(reinterpret_cast<const uint32_t *>(data), size);
+            case kSkCityHash32:
+                return SkCityHash::Compute32(data, size);
+            case kSkCityHash64:
+                return SkCityHash::Compute64(data, size);
             default:
                 SkString message("fWhichAlgorithm has unknown value ");
                 message.appendf("%d", fWhichAlgorithm);
@@ -101,11 +108,31 @@
             // Test self-consistency of checksum algorithms.
             fWhichAlgorithm = kSkChecksum;
             TestChecksumSelfConsistency(128);
+            fWhichAlgorithm = kSkCityHash32;
+            TestChecksumSelfConsistency(128);
+            fWhichAlgorithm = kSkCityHash64;
+            TestChecksumSelfConsistency(128);
 
             // Test checksum results that should be consistent across
             // versions and platforms.
             fWhichAlgorithm = kSkChecksum;
             REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0);
+            fWhichAlgorithm = kSkCityHash32;
+            REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0xdc56d17a);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(4)   == 0x616e1132);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(8)   == 0xeb0fd2d6);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(128) == 0x5321e430);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(132) == 0x924a10e4);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(256) == 0xd4de9dc9);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(260) == 0xecf0325d);
+            fWhichAlgorithm = kSkCityHash64;
+            REPORTER_ASSERT(fReporter, ComputeChecksum(NULL, 0) == 0x9ae16a3b2f90404fULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(4)   == 0x82bffd898958e540ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(8)   == 0xad5a13e1e8e93b98ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(128) == 0x10b153630af1f395ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(132) == 0x7db71dc4adcc6647ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(256) == 0xeee763519b91b010ULL);
+            REPORTER_ASSERT(fReporter, GetTestDataChecksum(260) == 0x2fe19e0b2239bc23ULL);
 
             // TODO: note the weakness exposed by these collisions...
             // We need to improve the SkChecksum algorithm.