12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- // Copyright 2021 The Chromium Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- #include "components/policy/test_support/request_handler_for_chrome_desktop_report.h"
- #include <utility>
- #include "components/policy/core/common/cloud/cloud_policy_constants.h"
- #include "components/policy/test_support/embedded_policy_test_server_test_base.h"
- #include "net/http/http_status_code.h"
- #include "testing/gtest/include/gtest/gtest.h"
- namespace em = enterprise_management;
- namespace policy {
- namespace {
- constexpr char kDeviceId[] = "fake_device_id";
- } // namespace
- class RequestHandlerForChromeDesktopReportTest
- : public EmbeddedPolicyTestServerTestBase {
- protected:
- RequestHandlerForChromeDesktopReportTest() = default;
- ~RequestHandlerForChromeDesktopReportTest() override = default;
- void SetUp() override {
- EmbeddedPolicyTestServerTestBase::SetUp();
- SetRequestTypeParam(dm_protocol::kValueRequestChromeDesktopReport);
- SetAppType(dm_protocol::kValueAppType);
- SetDeviceIdParam(kDeviceId);
- SetDeviceType(dm_protocol::kValueDeviceType);
- }
- };
- TEST_F(RequestHandlerForChromeDesktopReportTest, HandleRequest_Success) {
- StartRequestAndWait();
- EXPECT_EQ(GetResponseCode(), net::HTTP_OK);
- ASSERT_TRUE(HasResponseBody());
- auto response = GetDeviceManagementResponse();
- EXPECT_TRUE(response.has_chrome_desktop_report_response());
- }
- } // namespace policy
|