#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include <algorithm>
#include <vector>
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted_memory.h"
#include "base/path_service.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/favicon/core/favicon_database.h"
#include "components/favicon_base/favicon_types.h"
#include "components/history/core/test/database_test_utils.h"
#include "sql/database.h"
#include "sql/recovery.h"
#include "sql/test/scoped_error_expecter.h"
#include "sql/test/test_helpers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
AllOf;
ElementsAre;
Field;
Pair;
Return;
namespace favicon {
namespace {
const unsigned char kBlob1[] = …;
const unsigned char kBlob2[] = …;
const gfx::Size kSmallSize = …;
const gfx::Size kLargeSize = …;
void VerifyTablesAndColumns(sql::Database* db) { … }
void AddAndMapFaviconSimple(FaviconDatabase* db,
const GURL& page_url,
const GURL& icon_url,
favicon_base::IconType icon_type) { … }
void VerifyDatabaseEmpty(sql::Database* db) { … }
[[nodiscard]] bool CheckPageHasIcon(
FaviconDatabase* db,
const GURL& page_url,
favicon_base::IconType expected_icon_type,
const GURL& expected_icon_url,
const gfx::Size& expected_icon_size,
size_t expected_icon_contents_size,
const unsigned char* expected_icon_contents) { … }
bool CompareIconMappingIconUrl(const IconMapping& a, const IconMapping& b) { … }
void SortMappingsByIconUrl(std::vector<IconMapping>* mappings) { … }
base::Time GetLastUpdated(FaviconDatabase* db, favicon_base::FaviconID icon) { … }
}
class FaviconDatabaseTest : public testing::Test { … };
TEST_F(FaviconDatabaseTest, AddIconMapping) { … }
TEST_F(FaviconDatabaseTest, AddOnDemandFaviconBitmapCreatesCorrectTimestamps) { … }
TEST_F(FaviconDatabaseTest, AddFaviconBitmapCreatesCorrectTimestamps) { … }
TEST_F(FaviconDatabaseTest, GetFaviconLastUpdatedTimeReturnsFalseForNoBitmaps) { … }
TEST_F(FaviconDatabaseTest, GetFaviconLastUpdatedTimeReturnsMaxTime) { … }
TEST_F(FaviconDatabaseTest, TouchUpdatesOnDemandFavicons) { … }
TEST_F(FaviconDatabaseTest, TouchUpdatesOnlyInfrequently) { … }
TEST_F(FaviconDatabaseTest, TouchDoesNotUpdateStandardFavicons) { … }
TEST_F(FaviconDatabaseTest, GetOldOnDemandFaviconsReturnsOld) { … }
TEST_F(FaviconDatabaseTest, GetOldOnDemandFaviconsDoesNotReturnExpired) { … }
TEST_F(FaviconDatabaseTest, GetOldOnDemandFaviconsDoesNotReturnFresh) { … }
TEST_F(FaviconDatabaseTest, GetOldOnDemandFaviconsDoesNotDeleteStandard) { … }
TEST_F(FaviconDatabaseTest, DeleteIconMappings) { … }
TEST_F(FaviconDatabaseTest, GetIconMappingsForPageURL) { … }
TEST_F(FaviconDatabaseTest, RetainDataForPageUrls) { … }
TEST_F(FaviconDatabaseTest, RetainDataForPageUrlsExpiresRetainedFavicons) { … }
TEST_F(FaviconDatabaseTest, DeleteFavicon) { … }
TEST_F(FaviconDatabaseTest, GetIconMappingsForPageURLForReturnOrder) { … }
TEST_F(FaviconDatabaseTest, GetIconMappingsForPageURLWithIconTypes) { … }
TEST_F(FaviconDatabaseTest, FindFirstPageURLForHost) { … }
TEST_F(FaviconDatabaseTest, HasMappingFor) { … }
TEST_F(FaviconDatabaseTest, Version3) { … }
TEST_F(FaviconDatabaseTest, Version4) { … }
TEST_F(FaviconDatabaseTest, Version5) { … }
TEST_F(FaviconDatabaseTest, Version6) { … }
TEST_F(FaviconDatabaseTest, Version7) { … }
TEST_F(FaviconDatabaseTest, Version8) { … }
TEST_F(FaviconDatabaseTest, Recovery) { … }
TEST_F(FaviconDatabaseTest, Recovery7) { … }
TEST_F(FaviconDatabaseTest, Recovery6) { … }
TEST_F(FaviconDatabaseTest, Recovery5) { … }
TEST_F(FaviconDatabaseTest, WildSchema) { … }
TEST(FaviconDatabaseIconTypeTest, ShouldBeBackwardCompatible) { … }
TEST_F(FaviconDatabaseTest, GetFaviconsLastUpdatedBefore) { … }
TEST_F(FaviconDatabaseTest, SetFaviconsOutOfDateBetween) { … }
TEST_F(FaviconDatabaseTest, GetFaviconIDForFaviconURLOriginFilter) { … }
}