| // Copyright 2023 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/data_sharing/internal/data_sharing_service_impl.h" |
| |
| #include <memory> |
| |
| #include "base/test/task_environment.h" |
| #include "components/signin/public/identity_manager/identity_test_environment.h" |
| #include "services/network/public/cpp/shared_url_loader_factory.h" |
| #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" |
| #include "services/network/test/test_url_loader_factory.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| |
| namespace data_sharing { |
| |
| class DataSharingServiceImplTest : public testing::Test { |
| public: |
| DataSharingServiceImplTest() = default; |
| |
| ~DataSharingServiceImplTest() override = default; |
| |
| void SetUp() override { |
| scoped_refptr<network::SharedURLLoaderFactory> test_url_loader_factory = |
| base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( |
| &test_url_loader_factory_); |
| data_sharing_service_ = std::make_unique<DataSharingServiceImpl>( |
| std::move(test_url_loader_factory), |
| identity_test_env_.identity_manager()); |
| } |
| |
| protected: |
| base::test::TaskEnvironment task_environment_; |
| signin::IdentityTestEnvironment identity_test_env_; |
| network::TestURLLoaderFactory test_url_loader_factory_; |
| std::unique_ptr<DataSharingServiceImpl> data_sharing_service_; |
| }; |
| |
| TEST_F(DataSharingServiceImplTest, ConstructionAndEmptyServiceCheck) { |
| EXPECT_FALSE(data_sharing_service_->IsEmptyService()); |
| } |
| |
| TEST_F(DataSharingServiceImplTest, GetDataSharingNetworkLoader) { |
| EXPECT_TRUE(data_sharing_service_->GetDataSharingNetworkLoader()); |
| } |
| |
| } // namespace data_sharing |