Tom Sepez | 2255a1b | 2015-01-23 15:33:44 -0800 | [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 | |
Lei Zhang | b4e7f30 | 2015-11-06 15:52:32 -0800 | [diff] [blame] | 5 | #include "public/fpdfview.h" |
Wei Li | 091f7a0 | 2015-11-09 12:09:55 -0800 | [diff] [blame] | 6 | #include "testing/embedder_test.h" |
Tom Sepez | 2255a1b | 2015-01-23 15:33:44 -0800 | [diff] [blame] | 7 | #include "testing/gtest/include/gtest/gtest.h" |
| 8 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 9 | class FPDFDataAvailEmbeddertest : public EmbedderTest {}; |
Tom Sepez | 2255a1b | 2015-01-23 15:33:44 -0800 | [diff] [blame] | 10 | |
| 11 | TEST_F(FPDFDataAvailEmbeddertest, TrailerUnterminated) { |
Dan Sinclair | 6be2aab | 2015-10-28 13:58:49 -0400 | [diff] [blame] | 12 | // Document must load without crashing but is too malformed to be available. |
Wei Li | 091f7a0 | 2015-11-09 12:09:55 -0800 | [diff] [blame] | 13 | EXPECT_FALSE(OpenDocument("trailer_unterminated.pdf")); |
Dan Sinclair | 6be2aab | 2015-10-28 13:58:49 -0400 | [diff] [blame] | 14 | EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_)); |
Tom Sepez | 2255a1b | 2015-01-23 15:33:44 -0800 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | TEST_F(FPDFDataAvailEmbeddertest, TrailerAsHexstring) { |
Dan Sinclair | 6be2aab | 2015-10-28 13:58:49 -0400 | [diff] [blame] | 18 | // Document must load without crashing but is too malformed to be available. |
Wei Li | 091f7a0 | 2015-11-09 12:09:55 -0800 | [diff] [blame] | 19 | EXPECT_FALSE(OpenDocument("trailer_as_hexstring.pdf")); |
Dan Sinclair | 6be2aab | 2015-10-28 13:58:49 -0400 | [diff] [blame] | 20 | EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_)); |
Tom Sepez | 2255a1b | 2015-01-23 15:33:44 -0800 | [diff] [blame] | 21 | } |