blob: 222fdc4be2c17927f8945d78017ee2361752099b [file] [log] [blame]
Svet Ganove6986e12015-06-04 14:52:15 -07001// Copyright 2015 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -08005#include "public/fpdf_doc.h"
6#include "public/fpdfview.h"
7#include "testing/embedder_test.h"
Svet Ganove6986e12015-06-04 14:52:15 -07008#include "testing/gtest/include/gtest/gtest.h"
9
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080010class FPDFDataAvailEmbeddertest : public EmbedderTest {};
Svet Ganove6986e12015-06-04 14:52:15 -070011
12TEST_F(FPDFDataAvailEmbeddertest, TrailerUnterminated) {
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080013 // Document must load without crashing but is too malformed to be available.
14 EXPECT_FALSE(OpenDocument("trailer_unterminated.pdf"));
Svet Ganove6986e12015-06-04 14:52:15 -070015 EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_));
16}
17
18TEST_F(FPDFDataAvailEmbeddertest, TrailerAsHexstring) {
Philip P. Moltmannac3d58c2016-03-04 15:19:21 -080019 // Document must load without crashing but is too malformed to be available.
20 EXPECT_FALSE(OpenDocument("trailer_as_hexstring.pdf"));
Svet Ganove6986e12015-06-04 14:52:15 -070021 EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_));
22}