#include "chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service/rotate_util.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/base64.h"
#include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/network/mock_key_network_delegate.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/mock_key_persistence_delegate.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/scoped_key_persistence_delegate_factory.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/shared_command_constants.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/installer/key_rotation_manager.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/installer/key_rotation_types.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service/metrics_utils.h"
#include "components/version_info/channel.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
MockKeyNetworkDelegate;
MockKeyPersistenceDelegate;
ScopedKeyPersistenceDelegateFactory;
HttpResponseCode;
_;
Invoke;
Return;
namespace {
constexpr char kChromeManagementServiceStatusHistogramName[] = …;
constexpr char kNonce[] = …;
constexpr char kEncodedNonce[] = …;
constexpr char kFakeDMToken[] = …;
constexpr char kEncodedFakeDMToken[] = …;
constexpr char kFakeDmServerUrl[] = …;
constexpr char kInvalidDmServerUrl[] = …;
constexpr HttpResponseCode kSuccessCode = …;
constexpr HttpResponseCode kFailureCode = …;
constexpr HttpResponseCode kConflictCode = …;
}
namespace enterprise_connectors {
class RotateUtilTest : public testing::Test { … };
TEST_F(RotateUtilTest, RotateDTKeySuccess) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_InvalidDmToken) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_InvalidNonce) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_NoDMServerUrl) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_InvalidDMServerUrl) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_InvalidCommand) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_PermissionsFailed) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_StoreKeyFailed) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_UploadKeyFailed) { … }
TEST_F(RotateUtilTest, RotateDTKeyFailure_UploadKeyConflict) { … }
}