#include "components/policy/core/common/cloud/component_cloud_policy_store.h"
#include <stdint.h>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/test/test_simple_task_runner.h"
#include "base/time/time.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.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_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 "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
em;
Mock;
namespace policy {
namespace {
const char kTestExtension[] = …;
const char kTestDownload[] = …;
const char kTestPolicy[] = …;
std::string TestPolicyHash() { … }
bool NotEqual(const std::string& expected,
const PolicyDomain domain,
const std::string& key) { … }
bool True(const PolicyDomain domain, const std::string& ignored) { … }
class MockComponentCloudPolicyStoreDelegate
: public ComponentCloudPolicyStore::Delegate { … };
}
class ComponentCloudPolicyStoreTest : public testing::Test { … };
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicy) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyWrongTimestamp) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyWrongUser) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyWrongDMToken) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyWrongDeviceId) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyBadType) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyWrongNamespace) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyNoSignature) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyBadSignature) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyEmptyComponentId) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyWrongPublicKey) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyWrongPublicKeyVersion) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyDifferentPublicKey) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyBadDownloadUrl) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyEmptyDownloadUrl) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidatePolicyBadPayload) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateNoCredentials) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateNoCredentialsUser) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateNoCredentialsDMToken) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateNoCredentialsDeviceId) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateNoCredentialsPublicKey) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateNoCredentialsPublicKeyVersion) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateWrongCredentialsDMToken) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateWrongCredentialsDeviceId) { … }
TEST_F(ComponentCloudPolicyStoreTest, ValidateWrongCredentialsPublicKey) { … }
TEST_F(ComponentCloudPolicyStoreTest,
ValidateWrongCredentialsPublicKeyVersion) { … }
TEST_F(ComponentCloudPolicyStoreTest,
ValidatePolicyWithInvalidCombinationOfDomainAndPolicyType) { … }
TEST_F(ComponentCloudPolicyStoreTest, StoreAndLoad) { … }
TEST_F(ComponentCloudPolicyStoreTest, StoreAndLoadMachineLevelUserPolicy) { … }
TEST_F(ComponentCloudPolicyStoreTest, Updates) { … }
TEST_F(ComponentCloudPolicyStoreTest, Purge) { … }
}