#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/services/file_util/public/cpp/sandboxed_rar_analyzer.h"
#include <string>
#include <utility>
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/safe_browsing/archive_analyzer_results.h"
#include "chrome/services/file_util/fake_file_util_service.h"
#include "chrome/services/file_util/file_util_service.h"
#include "components/safe_browsing/core/common/features.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "crypto/sha2.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace safe_browsing {
namespace {
#define CDRDT(x) …
_;
UnorderedElementsAre;
class SandboxedRarAnalyzerTest : public testing::Test { … };
const SandboxedRarAnalyzerTest::BinaryData SandboxedRarAnalyzerTest::kNotARar = …;
const SandboxedRarAnalyzerTest::BinaryData
SandboxedRarAnalyzerTest::kSignedExe = …;
const uint8_t SandboxedRarAnalyzerTest::kNotARarSignature[] = …;
const uint8_t SandboxedRarAnalyzerTest::kSignedExeSignature[] = …;
TEST_F(SandboxedRarAnalyzerTest, AnalyzeBenignRar) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeEncryptedRar) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeEncryptedRarWithCorrectPassword) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeEncryptedRarWithIncorrectPassword) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeRarWithPasswordMultipleFiles) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeRarContainingExecutable) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeTextAsRar) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeRarContainingArchive) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeRarContainingAssortmentOfFiles) { … }
TEST_F(SandboxedRarAnalyzerTest,
AnalyzeRarContainingExecutableWithContentInspection) { … }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeMultipartRarContainingExecutable) { … }
TEST_F(SandboxedRarAnalyzerTest,
AnalyzeMultipartRarContainingMultipleExecutables) { … }
TEST_F(SandboxedRarAnalyzerTest, CanDeleteDuringExecution) { … }
TEST_F(SandboxedRarAnalyzerTest, InvalidPath) { … }
TEST_F(SandboxedRarAnalyzerTest, HeaderEncryptionCorrectPassword) { … }
TEST_F(SandboxedRarAnalyzerTest, HeaderEncryptionIncorrectPassword) { … }
TEST_F(SandboxedRarAnalyzerTest, HeaderEncryptionNoPassword) { … }
}
}