Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 1 | // 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. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 5 | #include "public/fpdf_doc.h" |
| 6 | #include "public/fpdfview.h" |
| 7 | #include "testing/embedder_test.h" |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 8 | #include "testing/gtest/include/gtest/gtest.h" |
| 9 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 10 | class FPDFDataAvailEmbeddertest : public EmbedderTest {}; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 11 | |
| 12 | TEST_F(FPDFDataAvailEmbeddertest, TrailerUnterminated) { |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 13 | // Document must load without crashing but is too malformed to be available. |
| 14 | EXPECT_FALSE(OpenDocument("trailer_unterminated.pdf")); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 15 | EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_)); |
| 16 | } |
| 17 | |
| 18 | TEST_F(FPDFDataAvailEmbeddertest, TrailerAsHexstring) { |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 19 | // Document must load without crashing but is too malformed to be available. |
| 20 | EXPECT_FALSE(OpenDocument("trailer_as_hexstring.pdf")); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 21 | EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_)); |
| 22 | } |