blob: 222fdc4be2c17927f8945d78017ee2361752099b [file] [log] [blame]
Tom Sepez2255a1b2015-01-23 15:33:44 -08001// 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
Lei Zhangb4e7f302015-11-06 15:52:32 -08005#include "public/fpdf_doc.h"
6#include "public/fpdfview.h"
Wei Li091f7a02015-11-09 12:09:55 -08007#include "testing/embedder_test.h"
Tom Sepez2255a1b2015-01-23 15:33:44 -08008#include "testing/gtest/include/gtest/gtest.h"
9
Nico Weber9d8ec5a2015-08-04 13:00:21 -070010class FPDFDataAvailEmbeddertest : public EmbedderTest {};
Tom Sepez2255a1b2015-01-23 15:33:44 -080011
12TEST_F(FPDFDataAvailEmbeddertest, TrailerUnterminated) {
Dan Sinclair6be2aab2015-10-28 13:58:49 -040013 // Document must load without crashing but is too malformed to be available.
Wei Li091f7a02015-11-09 12:09:55 -080014 EXPECT_FALSE(OpenDocument("trailer_unterminated.pdf"));
Dan Sinclair6be2aab2015-10-28 13:58:49 -040015 EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_));
Tom Sepez2255a1b2015-01-23 15:33:44 -080016}
17
18TEST_F(FPDFDataAvailEmbeddertest, TrailerAsHexstring) {
Dan Sinclair6be2aab2015-10-28 13:58:49 -040019 // Document must load without crashing but is too malformed to be available.
Wei Li091f7a02015-11-09 12:09:55 -080020 EXPECT_FALSE(OpenDocument("trailer_as_hexstring.pdf"));
Dan Sinclair6be2aab2015-10-28 13:58:49 -040021 EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_));
Tom Sepez2255a1b2015-01-23 15:33:44 -080022}