#include "chrome/updater/device_management/dm_client.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "chrome/enterprise_companion/device_management_storage/dm_storage.h"
#include "chrome/updater/device_management/dm_message.h"
#include "chrome/updater/device_management/dm_policy_builder_for_testing.h"
#include "chrome/updater/device_management/dm_response_validator.h"
#include "chrome/updater/net/network.h"
#include "chrome/updater/policy/dm_policy_manager.h"
#include "chrome/updater/policy/service.h"
#include "chrome/updater/protos/omaha_settings.pb.h"
#include "chrome/updater/test/unit_test_util.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "components/update_client/network.h"
#include "net/base/url_util.h"
#include "net/http/http_status_code.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
RunClosure;
namespace updater {
namespace {
class TestTokenService
: public device_management_storage::TokenServiceInterface { … };
class TestConfigurator : public DMClient::Configurator { … };
TestConfigurator::TestConfigurator(const GURL& url)
: … { … }
class DMRequestCallbackHandler
: public base::RefCountedThreadSafe<DMRequestCallbackHandler> { … };
class DMRegisterRequestCallbackHandler : public DMRequestCallbackHandler { … };
class DMPolicyFetchRequestCallbackHandler : public DMRequestCallbackHandler { … };
class DMValidationReportRequestCallbackHandler
: public DMRequestCallbackHandler { … };
}
class DMClientTest : public ::testing::Test { … };
class DMRegisterClientTest : public DMClientTest { … };
class DMPolicyFetchClientTest : public DMClientTest { … };
class DMPolicyValidationReportClientTest : public DMClientTest { … };
TEST_F(DMRegisterClientTest, Success) { … }
TEST_F(DMRegisterClientTest, Deregister) { … }
TEST_F(DMRegisterClientTest, DeregisterWithDeletion) { … }
TEST_F(DMRegisterClientTest, BadRequest) { … }
TEST_F(DMRegisterClientTest, AlreadyRegistered) { … }
TEST_F(DMRegisterClientTest, BadResponseData) { … }
TEST_F(DMPolicyFetchClientTest, NoDMToken) { … }
TEST_F(DMPolicyFetchClientTest, FirstRequest) { … }
TEST_F(DMPolicyFetchClientTest, NoRotateKey) { … }
TEST_F(DMPolicyFetchClientTest, RotateKey) { … }
TEST_F(DMPolicyFetchClientTest, RejectKeyWithBadSignature) { … }
TEST_F(DMPolicyFetchClientTest, RejectDataWithBadSignature) { … }
TEST_F(DMPolicyFetchClientTest, Deregister) { … }
TEST_F(DMPolicyFetchClientTest, DeregisterWithDeletion) { … }
TEST_F(DMPolicyFetchClientTest, BadResponse) { … }
TEST_F(DMPolicyFetchClientTest, BadRequest) { … }
TEST_F(DMPolicyValidationReportClientTest, Success) { … }
TEST_F(DMPolicyValidationReportClientTest, NoDMToken) { … }
TEST_F(DMPolicyValidationReportClientTest, NoPayload) { … }
TEST(DMClient, StreamRequestResultEnumValue) { … }
}