chromium/components/offline_pages/core/background/request_queue_store_unittest.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/offline_pages/core/background/request_queue_store.h"

#include <memory>
#include <string>
#include <utility>

#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/test_mock_time_task_runner.h"
#include "components/offline_pages/core/background/request_queue.h"
#include "components/offline_pages/core/background/save_page_request.h"
#include "components/offline_pages/core/offline_clock.h"
#include "sql/database.h"
#include "sql/statement.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace offline_pages {

#define REQUEST_QUEUE_TABLE_NAME

UpdateStatus;

namespace {

const int64_t kRequestId =;
const int64_t kRequestId2 =;
const int64_t kRequestId3 =;

const ClientId kClientId("bookmark", "1234");
const ClientId kClientId2("async", "5678");
const bool kUserRequested =;
const char kRequestOrigin[] =;
enum class LastResult {};

SavePageRequest GetTestRequest(const GURL& url, const GURL& original_url) {}

void BuildTestStoreWithSchemaFromM57(const base::FilePath& file,
                                     const GURL& url) {}

void BuildTestStoreWithSchemaFromM58(const base::FilePath& file,
                                     const GURL& url,
                                     const GURL& original_url) {}

void BuildTestStoreWithSchemaFromM61(const base::FilePath& file,
                                     const GURL& url,
                                     const GURL& original_url) {}

void BuildTestStoreWithSchemaFromM72(const base::FilePath& file,
                                     const GURL& url,
                                     const GURL& original_url) {}

// Class that serves as a base for testing different implementations of the
// |RequestQueueStore|. Specific implementations extend the templatized version
// of this class and provide appropriate store factory.
class RequestQueueStoreTestBase : public testing::Test {};

RequestQueueStoreTestBase::RequestQueueStoreTestBase()
    :{}

void RequestQueueStoreTestBase::TearDown() {}

void RequestQueueStoreTestBase::PumpLoop() {}

void RequestQueueStoreTestBase::ClearResults() {}

void RequestQueueStoreTestBase::InitializeStore(RequestQueueStore* store) {}

void RequestQueueStoreTestBase::InitializeCallback(bool success) {}

void RequestQueueStoreTestBase::GetRequestsDone(
    bool result,
    std::vector<std::unique_ptr<SavePageRequest>> requests) {}

void RequestQueueStoreTestBase::AddOrUpdateDone(UpdateStatus status) {}

void RequestQueueStoreTestBase::AddRequestDone(AddRequestResult result) {}

void RequestQueueStoreTestBase::UpdateRequestDone(UpdateRequestsResult result) {}

void RequestQueueStoreTestBase::ResetDone(bool result) {}

// Defines a store test fixture templatized by the store factory.
class RequestQueueStoreTest : public RequestQueueStoreTestBase {};

// This portion causes test fixtures to be defined.
// Notice that in the store we are using "this->" to refer to the methods
// defined on the |RequestQuieueStoreBaseTest| class. That's by design.

TEST_F(RequestQueueStoreTest, UpgradeFromVersion57Store) {}

TEST_F(RequestQueueStoreTest, UpgradeFromVersion58Store) {}

TEST_F(RequestQueueStoreTest, UpgradeFromVersion61Store) {}

TEST_F(RequestQueueStoreTest, UpgradeFromVersion72Store) {}

TEST_F(RequestQueueStoreTest, GetRequestsEmpty) {}

TEST_F(RequestQueueStoreTest, GetRequestsByIds) {}

TEST_F(RequestQueueStoreTest, AddRequest) {}

TEST_F(RequestQueueStoreTest, AddAndGetRequestsMatch) {}

TEST_F(RequestQueueStoreTest, UpdateRequest) {}

TEST_F(RequestQueueStoreTest, RemoveRequests) {}

TEST_F(RequestQueueStoreTest, ResetStore) {}

// Makes sure that persistent DB is actually persisting requests across store
// restarts.
TEST_F(RequestQueueStoreTest, SaveCloseReopenRead) {}

}  // namespace
}  // namespace offline_pages