blob: 70537779fe65e1f6e485555d62b13a931c584db3 [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/fpdfview.h"
Wei Li091f7a02015-11-09 12:09:55 -08006#include "testing/embedder_test.h"
Tom Sepez2255a1b2015-01-23 15:33:44 -08007#include "testing/gtest/include/gtest/gtest.h"
8
Nico Weber9d8ec5a2015-08-04 13:00:21 -07009class FPDFDataAvailEmbeddertest : public EmbedderTest {};
Tom Sepez2255a1b2015-01-23 15:33:44 -080010
11TEST_F(FPDFDataAvailEmbeddertest, TrailerUnterminated) {
Dan Sinclair6be2aab2015-10-28 13:58:49 -040012 // Document must load without crashing but is too malformed to be available.
Wei Li091f7a02015-11-09 12:09:55 -080013 EXPECT_FALSE(OpenDocument("trailer_unterminated.pdf"));
Dan Sinclair6be2aab2015-10-28 13:58:49 -040014 EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_));
Tom Sepez2255a1b2015-01-23 15:33:44 -080015}
16
17TEST_F(FPDFDataAvailEmbeddertest, TrailerAsHexstring) {
Dan Sinclair6be2aab2015-10-28 13:58:49 -040018 // Document must load without crashing but is too malformed to be available.
Wei Li091f7a02015-11-09 12:09:55 -080019 EXPECT_FALSE(OpenDocument("trailer_as_hexstring.pdf"));
Dan Sinclair6be2aab2015-10-28 13:58:49 -040020 EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_));
Tom Sepez2255a1b2015-01-23 15:33:44 -080021}