#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "content/browser/download/save_package.h"
#include <stddef.h>
#include <stdint.h>
#include <string>
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "content/browser/download/save_file_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/fake_local_frame.h"
#include "content/test/test_render_view_host.h"
#include "content/test/test_web_contents.h"
#include "net/test/url_request/url_request_mock_http_job.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "url/gurl.h"
namespace content {
#define FPL …
#define HTML_EXTENSION …
#if BUILDFLAG(IS_WIN)
#define FPL_HTML_EXTENSION …
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#define FPL_HTML_EXTENSION …
#endif
namespace {
#if BUILDFLAG(IS_WIN)
const uint32_t kMaxFilePathLength = MAX_PATH - 1;
const uint32_t kMaxFileNameLength = MAX_PATH - 1;
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
const uint32_t kMaxFilePathLength = …;
const uint32_t kMaxFileNameLength = …;
#endif
bool HasOrdinalNumber(const base::FilePath::StringType& filename) { … }
}
class SavePackageTest : public RenderViewHostImplTestHarness { … };
static const struct { … } kGeneratedFiles[] = …;
TEST_F(SavePackageTest, TestSuccessfullyGenerateSavePackageFilename) { … }
TEST_F(SavePackageTest, TestUnSuccessfullyGenerateSavePackageFilename) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_TestLongSavePackageFilename …
#else
#define MAYBE_TestLongSavePackageFilename …
#endif
TEST_F(SavePackageTest, MAYBE_TestLongSavePackageFilename) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_TestLongSafePureFilename …
#else
#define MAYBE_TestLongSafePureFilename …
#endif
TEST_F(SavePackageTest, MAYBE_TestLongSafePureFilename) { … }
TEST_F(SavePackageTest, TestGetUrlToBeSaved) { … }
TEST_F(SavePackageTest, TestGetUrlToBeSavedViewSource) { … }
class SavePackageFencedFrameTest : public SavePackageTest { … };
class FakeLocalFrameWithSavableResourceLinks : public FakeLocalFrame { … };
TEST_F(SavePackageFencedFrameTest,
DontRequestSavableResourcesFromFencedFrames) { … }
}