Add a unit test for PDF417 barcode length.

Make sure CBC_PDF417I will reject barcodes over a certain limit.

BUG=chromium:960176

Change-Id: I5f270cbd1efaa5ec959c49566c45d22481c39abf
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55571
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fxbarcode/BUILD.gn b/fxbarcode/BUILD.gn
index bb93e92..cf84648 100644
--- a/fxbarcode/BUILD.gn
+++ b/fxbarcode/BUILD.gn
@@ -143,6 +143,7 @@
 
 pdfium_unittest_source_set("unittests") {
   sources = [
+    "cbc_pdf417i_unittest.cpp",
     "datamatrix/BC_DataMatrixWriter_unittest.cpp",
     "oned/BC_OnedCodaBarWriter_unittest.cpp",
     "oned/BC_OnedCode128Writer_unittest.cpp",
diff --git a/fxbarcode/cbc_pdf417i_unittest.cpp b/fxbarcode/cbc_pdf417i_unittest.cpp
new file mode 100644
index 0000000..94e69fb
--- /dev/null
+++ b/fxbarcode/cbc_pdf417i_unittest.cpp
@@ -0,0 +1,20 @@
+// Copyright 2019 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "fxbarcode/cbc_pdf417i.h"
+
+#include <vector>
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(CBC_PDF417ITest, Normal) {
+  CBC_PDF417I encoder;
+  EXPECT_TRUE(encoder.Encode(L"Foo"));
+}
+
+TEST(CBC_PDF417ITest, MaxLength) {
+  std::vector<wchar_t> input(2711, L'1');
+  CBC_PDF417I encoder;
+  EXPECT_FALSE(encoder.Encode(WideStringView(input.data(), input.size())));
+}