summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfdoc_embeddertest.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-01-06 10:16:32 -0800
committerTom Sepez <tsepez@chromium.org>2016-01-06 10:16:32 -0800
commit0aa3531a87dde44ffd90416f6d621b1828edaf22 (patch)
tree9b5f0e12a5e1aec13fd3d4f0242efcc6834d830e /fpdfsdk/src/fpdfdoc_embeddertest.cpp
parentd483eb46d8920547d1b47351e65fa0299eaba191 (diff)
downloadpdfium-0aa3531a87dde44ffd90416f6d621b1828edaf22.tar.xz
Merge to XFA: Return unique_ptrs from test_support functions
Orignal Review URL: https://codereview.chromium.org/1563513002 . (cherry picked from commit aa326bd6b169dc1b5b9b83048c71799799ab34c6) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1564583004 .
Diffstat (limited to 'fpdfsdk/src/fpdfdoc_embeddertest.cpp')
-rw-r--r--fpdfsdk/src/fpdfdoc_embeddertest.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/fpdfsdk/src/fpdfdoc_embeddertest.cpp b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
index 260f25f309..1c66a15bad 100644
--- a/fpdfsdk/src/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
@@ -106,8 +106,9 @@ TEST_F(FPDFDocEmbeddertest, FindBookmarks) {
EXPECT_TRUE(OpenDocument("bookmarks.pdf"));
// Find the first one, based on its known title.
- FPDF_WIDESTRING title = GetFPDFWideString(L"A Good Beginning");
- FPDF_BOOKMARK child = FPDFBookmark_Find(document(), title);
+ std::unique_ptr<unsigned short, pdfium::FreeDeleter> title =
+ GetFPDFWideString(L"A Good Beginning");
+ FPDF_BOOKMARK child = FPDFBookmark_Find(document(), title.get());
EXPECT_NE(nullptr, child);
// Check that the string matches.
@@ -120,10 +121,7 @@ TEST_F(FPDFDocEmbeddertest, FindBookmarks) {
EXPECT_EQ(child, FPDFBookmark_GetFirstChild(document(), nullptr));
// Try to find one using a non-existent title.
- FPDF_WIDESTRING bad_title = GetFPDFWideString(L"A BAD Beginning");
- EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), bad_title));
-
- // Alas, the typedef includes the "const".
- free(const_cast<unsigned short*>(title));
- free(const_cast<unsigned short*>(bad_title));
+ std::unique_ptr<unsigned short, pdfium::FreeDeleter> bad_title =
+ GetFPDFWideString(L"A BAD Beginning");
+ EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), bad_title.get()));
}