diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2018-06-06 12:31:18 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-06 12:31:18 +0000 |
commit | eababa10789bc0d73a325291e2854090ee3896cd (patch) | |
tree | 67bb315c3e405c622c9fac40f0f473b4ec2b8fc1 /core/fpdfapi/parser/cpdf_object_unittest.cpp | |
parent | c22d671728605bc614dc84ec6a42a5647808b30d (diff) | |
download | pdfium-eababa10789bc0d73a325291e2854090ee3896cd.tar.xz |
Use CPDF_StreamAcc to data access of CPDF_Stream.
Change-Id: I68b88e013ac542f245dbe7b6889799c814d46eb8
Reviewed-on: https://pdfium-review.googlesource.com/33690
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_object_unittest.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_object_unittest.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_object_unittest.cpp b/core/fpdfapi/parser/cpdf_object_unittest.cpp index 4780e87bc0..856dd0ac3b 100644 --- a/core/fpdfapi/parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_object_unittest.cpp @@ -17,6 +17,7 @@ #include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_reference.h" #include "core/fpdfapi/parser/cpdf_stream.h" +#include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fpdfapi/parser/cpdf_string.h" #include "testing/gtest/include/gtest/gtest.h" @@ -153,16 +154,18 @@ class PDFObjectsTest : public testing::Test { // Compare dictionaries. if (!Equal(stream1->GetDict(), stream2->GetDict())) return false; + + auto streamAcc1 = pdfium::MakeRetain<CPDF_StreamAcc>(stream1); + streamAcc1->LoadAllDataRaw(); + auto streamAcc2 = pdfium::MakeRetain<CPDF_StreamAcc>(stream2); + streamAcc2->LoadAllDataRaw(); + // Compare sizes. - if (stream1->GetRawSize() != stream2->GetRawSize()) + if (streamAcc1->GetSize() != streamAcc2->GetSize()) return false; - // Compare contents. - // Since this function is used for testing Clone(), only memory based - // streams need to be handled. - if (!stream1->IsMemoryBased() || !stream2->IsMemoryBased()) - return false; - return memcmp(stream1->GetRawData(), stream2->GetRawData(), - stream1->GetRawSize()) == 0; + + return memcmp(streamAcc1->GetData(), streamAcc2->GetData(), + streamAcc2->GetSize()) == 0; } case CPDF_Object::REFERENCE: return obj1->AsReference()->GetRefObjNum() == |