summaryrefslogtreecommitdiff
path: root/testing/embedder_test.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-28 16:54:10 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-02 18:57:50 +0000
commitd9e0e6e46d1f24231b8ab3def4cc197554e96fe7 (patch)
tree811766e948d4946c9db77a1f4bc8816daf3c03bb /testing/embedder_test.cpp
parentb31618571938e4873dcf1cdd44eeedb40caa5bd7 (diff)
downloadpdfium-d9e0e6e46d1f24231b8ab3def4cc197554e96fe7.tar.xz
Change BarcodeTest to render to bitmaps.
BarcodeTest renders to bitmaps verifies their checksums. Add some commonly used checksumming code to testing/test_support.h, and use it in tests that have duplicate code. Change-Id: I4a440674ff1084685b5d89576d967333da458a8a Reviewed-on: https://pdfium-review.googlesource.com/4618 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'testing/embedder_test.cpp')
-rw-r--r--testing/embedder_test.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index 79074153fb..1baeb57206 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -42,18 +42,6 @@ FPDF_BOOL Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) {
void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) {}
-std::string CRYPT_ToBase16(const uint8_t* digest) {
- static char const zEncode[] = "0123456789abcdef";
- std::string ret;
- ret.resize(32);
- for (int i = 0, j = 0; i < 16; i++, j += 2) {
- uint8_t a = digest[i];
- ret[j] = zEncode[(a >> 4) & 0xf];
- ret[j + 1] = zEncode[a & 0xf];
- }
- return ret;
-}
-
} // namespace
EmbedderTest::EmbedderTest()
@@ -352,7 +340,7 @@ void EmbedderTest::CompareBitmap(FPDF_BITMAP bitmap,
uint8_t digest[16];
CRYPT_MD5Generate(static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)),
expected_stride * expected_height, digest);
- EXPECT_EQ(expected_md5sum, CRYPT_ToBase16(digest));
+ EXPECT_EQ(expected_md5sum, CryptToBase16(digest));
}
// Can't use gtest-provided main since we need to stash the path to the