| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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 | |
| 5 #include "testing/embedder_test.h" | |
| 6 #include "testing/gtest/include/gtest/gtest.h" | |
| 7 | |
| 8 class CPDFSecurityHandlerEmbeddertest : public EmbedderTest {}; | |
| 9 | |
| 10 TEST_F(CPDFSecurityHandlerEmbeddertest, Unencrypted) { | |
| 11 ASSERT_TRUE(OpenDocument("about_blank.pdf")); | |
| 12 EXPECT_EQ(0xFFFFFFFF, FPDF_GetDocPermissions(document())); | |
| 13 } | |
| 14 | |
| 15 TEST_F(CPDFSecurityHandlerEmbeddertest, UnencryptedWithPassword) { | |
| 16 ASSERT_TRUE(OpenDocument("about_blank.pdf", "foobar")); | |
| 17 EXPECT_EQ(0xFFFFFFFF, FPDF_GetDocPermissions(document())); | |
| 18 } | |
| 19 | |
| 20 TEST_F(CPDFSecurityHandlerEmbeddertest, NoPassword) { | |
| 21 EXPECT_FALSE(OpenDocument("encrypted.pdf")); | |
| 22 } | |
| 23 | |
| 24 TEST_F(CPDFSecurityHandlerEmbeddertest, UserPassword) { | |
| 25 ASSERT_TRUE(OpenDocument("encrypted.pdf", "1234")); | |
| 26 EXPECT_EQ(0xFFFFF2C0, FPDF_GetDocPermissions(document())); | |
| 27 } | |
| 28 | |
| 29 TEST_F(CPDFSecurityHandlerEmbeddertest, OwnerPassword) { | |
| 30 ASSERT_TRUE(OpenDocument("encrypted.pdf", "5678")); | |
| 31 EXPECT_EQ(0xFFFFFFFC, FPDF_GetDocPermissions(document())); | |
| 32 } | |
| OLD | NEW |