#include "components/policy/core/common/cloud/component_cloud_policy_updater.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/compiler_specific.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/component_cloud_policy_store.h"
#include "components/policy/core/common/cloud/external_policy_data_fetcher.h"
#include "components/policy/core/common/cloud/resource_cache.h"
#include "components/policy/core/common/cloud/test/policy_builder.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_bundle.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/proto/chrome_extension_policy.pb.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "crypto/rsa_private_key.h"
#include "crypto/sha2.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"
#include "url/gurl.h"
em;
Mock;
namespace policy {
namespace {
const char kTestExtension[] = …;
const char kTestExtension2[] = …;
const char kTestExtension3[] = …;
const char kTestDownload[] = …;
const char kTestDownload2[] = …;
const char kTestDownload3[] = …;
const char kTestPolicy[] = …;
class MockComponentCloudPolicyStoreDelegate
: public ComponentCloudPolicyStore::Delegate { … };
}
class ComponentCloudPolicyUpdaterTest : public testing::Test { … };
ComponentCloudPolicyUpdaterTest::ComponentCloudPolicyUpdaterTest()
: … { … }
void ComponentCloudPolicyUpdaterTest::SetUp() { … }
void ComponentCloudPolicyUpdaterTest::TearDown() { … }
std::unique_ptr<em::PolicyFetchResponse>
ComponentCloudPolicyUpdaterTest::CreateResponse() { … }
TEST_F(ComponentCloudPolicyUpdaterTest, FetchAndCache) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseTooLarge) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseInvalid) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseNoSignature) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseBadSignature) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseWrongPublicKey) { … }
TEST_F(ComponentCloudPolicyUpdaterTest,
PolicyFetchResponseWrongPublicKeyVersion) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseDifferentPublicKey) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseEmptyComponentId) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, AlreadyCached) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, DataTooLarge) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, FetchUpdatedData) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, FetchUpdatedDataWithoutPolicy) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, NoPolicy) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, CancelUpdate) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, RetryAfterDataTooLarge) { … }
TEST_F(ComponentCloudPolicyUpdaterTest, RetryAfterDataValidationFails) { … }
}