request_handler_for_device_attribute_update.cc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/policy/test_support/request_handler_for_device_attribute_update.h"
  5. #include "components/policy/core/common/cloud/cloud_policy_constants.h"
  6. #include "components/policy/proto/device_management_backend.pb.h"
  7. #include "components/policy/test_support/client_storage.h"
  8. #include "components/policy/test_support/policy_storage.h"
  9. #include "components/policy/test_support/test_server_helpers.h"
  10. #include "net/http/http_status_code.h"
  11. #include "net/test/embedded_test_server/http_request.h"
  12. #include "net/test/embedded_test_server/http_response.h"
  13. using net::test_server::HttpRequest;
  14. using net::test_server::HttpResponse;
  15. namespace em = enterprise_management;
  16. namespace policy {
  17. RequestHandlerForDeviceAttributeUpdate::RequestHandlerForDeviceAttributeUpdate(
  18. EmbeddedPolicyTestServer* parent)
  19. : EmbeddedPolicyTestServer::RequestHandler(parent) {}
  20. RequestHandlerForDeviceAttributeUpdate::
  21. ~RequestHandlerForDeviceAttributeUpdate() = default;
  22. std::string RequestHandlerForDeviceAttributeUpdate::RequestType() {
  23. return dm_protocol::kValueRequestDeviceAttributeUpdate;
  24. }
  25. std::unique_ptr<HttpResponse>
  26. RequestHandlerForDeviceAttributeUpdate::HandleRequest(
  27. const HttpRequest& request) {
  28. em::DeviceManagementResponse response;
  29. response.mutable_device_attribute_update_response()->set_result(
  30. em::DeviceAttributeUpdateResponse::ATTRIBUTE_UPDATE_SUCCESS);
  31. return CreateHttpResponse(net::HTTP_OK, response.SerializeAsString());
  32. }
  33. } // namespace policy