#include "content/browser/content_index/content_index_database.h"
#include <string>
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "content/browser/service_worker/embedded_worker_test_helper.h"
#include "content/public/browser/content_index_provider.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/origin.h"
namespace content {
namespace {
_;
class MockContentIndexProvider : public ContentIndexProvider { … };
class ContentIndexTestBrowserContext : public TestBrowserContext { … };
void DidRegisterServiceWorker(int64_t* out_service_worker_registration_id,
base::OnceClosure quit_closure,
blink::ServiceWorkerStatusCode status,
const std::string& status_message,
int64_t service_worker_registration_id) { … }
void DidFindServiceWorkerRegistration(
scoped_refptr<ServiceWorkerRegistration>* out_service_worker_registration,
base::OnceClosure quit_closure,
blink::ServiceWorkerStatusCode status,
scoped_refptr<ServiceWorkerRegistration> service_worker_registration) { … }
void DatabaseErrorCallback(base::OnceClosure quit_closure,
blink::mojom::ContentIndexError* out_error,
blink::mojom::ContentIndexError error) { … }
void GetDescriptionsCallback(
base::OnceClosure quit_closure,
blink::mojom::ContentIndexError* out_error,
std::vector<blink::mojom::ContentDescriptionPtr>* out_descriptions,
blink::mojom::ContentIndexError error,
std::vector<blink::mojom::ContentDescriptionPtr> descriptions) { … }
std::vector<SkBitmap> CreateTestIcons() { … }
}
class ContentIndexDatabaseTest : public ::testing::Test { … };
TEST_F(ContentIndexDatabaseTest, DatabaseOperations) { … }
TEST_F(ContentIndexDatabaseTest, DatabaseOperationsBadSWID) { … }
TEST_F(ContentIndexDatabaseTest, AddDuplicateIdWillOverwrite) { … }
TEST_F(ContentIndexDatabaseTest, DeleteNonExistentEntry) { … }
TEST_F(ContentIndexDatabaseTest, ProviderUpdated) { … }
TEST_F(ContentIndexDatabaseTest, IconLifetimeTiedToEntry) { … }
TEST_F(ContentIndexDatabaseTest, NoIconsAreSupported) { … }
TEST_F(ContentIndexDatabaseTest, GetEntries) { … }
TEST_F(ContentIndexDatabaseTest, BlockedOriginsCannotRegisterContent) { … }
}