#include <string>
#include <utility>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/gtest_util.h"
#include "base/test/simple_test_clock.h"
#include "base/test/task_environment.h"
#include "components/commerce/core/commerce_types.h"
#include "components/commerce/core/parcel/parcels_manager.h"
#include "components/commerce/core/parcel/parcels_server_proxy.h"
#include "components/commerce/core/parcel/parcels_storage.h"
#include "components/commerce/core/proto/parcel.pb.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
_;
ByMove;
InSequence;
Return;
namespace commerce {
namespace {
const std::string kTestTrackingId = …;
const std::string kSoucePageDomain = …;
base::Time GetTestTime() { … }
base::Time GetTestDeliveryTime() { … }
std::unique_ptr<std::vector<commerce::ParcelStatus>> BuildParcelStatus(
const std::string& tracking_id,
commerce::ParcelStatus::ParcelState state) { … }
std::unique_ptr<std::vector<parcel_tracking_db::ParcelTrackingContent>>
BuildParcelTracking(const std::string& tracking_id,
commerce::ParcelStatus::ParcelState state) { … }
std::vector<std::pair<commerce::ParcelIdentifier::Carrier, std::string>>
GetTestIdentifiers(const std::string& tracking_id) { … }
void ExpectGetParcelsCallback(
bool expected_success,
const std::vector<ParcelTrackingStatus>& expected_parcel_status,
bool success,
std::unique_ptr<std::vector<ParcelTrackingStatus>> parcel_status) { … }
class MockServerProxy : public ParcelsServerProxy { … };
class MockParcelsStorage : public ParcelsStorage { … };
class ParcelsManagerTest : public testing::Test { … };
TEST_F(ParcelsManagerTest, TestStartTrackingParcels) { … }
TEST_F(ParcelsManagerTest, TestStartTrackingParcels_ServerError) { … }
TEST_F(ParcelsManagerTest,
TestGetAllParcelStatuses_LocalStorageHasFreshStatus) { … }
TEST_F(ParcelsManagerTest,
TestGetAllParcelStatusesCalledTwice_LocalStorageHasFreshStatus) { … }
TEST_F(ParcelsManagerTest,
TestGetAllParcelStatuses_LocalStorageHasStaleStatus) { … }
TEST_F(ParcelsManagerTest, TestGetAllParcelStatuses_LocalStorageHasDoneStatus) { … }
TEST_F(ParcelsManagerTest, TestGetAllParcelStatuses_ServerError) { … }
TEST_F(ParcelsManagerTest, TestGetAllParcelStatuses_StorageError) { … }
TEST_F(ParcelsManagerTest, TestStopTrackingAllParcels) { … }
TEST_F(ParcelsManagerTest, TestStopTrackingAllParcels_ServerError) { … }
TEST_F(ParcelsManagerTest, TestStopTrackingParcel) { … }
TEST_F(ParcelsManagerTest, TestStopTrackingParcel_ServerError) { … }
TEST_F(ParcelsManagerTest, TestStopTrackingParcels) { … }
TEST_F(ParcelsManagerTest, TestStopTrackingParcels_ServerError) { … }
}
}