chromium/chrome/browser/enterprise/connectors/analysis/local_binary_upload_service_unittest.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/enterprise/connectors/analysis/local_binary_upload_service.h"

#include "base/barrier_closure.h"
#include "base/containers/span.h"
#include "base/functional/callback_helpers.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
#include "chrome/browser/enterprise/connectors/test/fake_content_analysis_sdk_manager.h"
#include "chrome/test/base/testing_profile.h"
#include "components/device_signals/core/browser/mock_system_signals_service_host.h"
#include "components/enterprise/connectors/core/analysis_settings.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace enterprise_connectors {

BinaryUploadService;
_;
Invoke;
NiceMock;
NotNull;
Return;
SaveArg;

constexpr char kFakeUserActionId[] =;
constexpr char kFakeUserActionId2[] =;

class MockRequest : public BinaryUploadService::Request {};

// A subclass of LocalBinaryUploadService which avoids using
// SystemSignalsServiceHost and does not do any binary verification.
//
// By default this class works in auto-verify mode, which means that
// agents are always considered verified.  This simplifies writing tests.
// Test related specifically to the verification process don't use
// auto-verify mode.
class FakeLocalBinaryUploadService : public LocalBinaryUploadService {};

class LocalBinaryUploadServiceTest : public testing::Test {};

TEST_F(LocalBinaryUploadServiceTest, ClientCreatedFromMaybeAcknowledge) {}

TEST_F(LocalBinaryUploadServiceTest, ClientDestroyedWhenAckStatusIsAbnormal) {}

TEST_F(LocalBinaryUploadServiceTest, UploadSucceeds) {}

TEST_F(LocalBinaryUploadServiceTest, UploadFailsWhenClientUnableToSend) {}

TEST_F(LocalBinaryUploadServiceTest,
       VerifyRequestTokenParityWhenUploadSucceeds) {}

TEST_F(LocalBinaryUploadServiceTest, VerifyTabTitleIsSet) {}

TEST_F(LocalBinaryUploadServiceTest, SomeRequestsArePending) {}

TEST_F(LocalBinaryUploadServiceTest, PendingRequestsGetProcessed) {}

TEST_F(LocalBinaryUploadServiceTest, AgentErrorMakesRequestPending) {}

TEST_F(LocalBinaryUploadServiceTest, AgentErrorMakesManyRequestsPending) {}

TEST_F(LocalBinaryUploadServiceTest, TimeoutWhileActive) {}

TEST_F(LocalBinaryUploadServiceTest, TimeoutWhilePending) {}

TEST_F(LocalBinaryUploadServiceTest, OnConnectionRetryCompletesPending) {}

TEST_F(LocalBinaryUploadServiceTest, OnConnectionRetryCompletesManyPending) {}

TEST_F(LocalBinaryUploadServiceTest, FailureAfterTooManyRetries) {}

TEST_F(LocalBinaryUploadServiceTest, CancelRequests) {}

TEST_F(LocalBinaryUploadServiceTest, CancelRequests_MultipleUserActions) {}

TEST_F(LocalBinaryUploadServiceTest,
       ClientDestroyedWhenCancelStatusIsAbnormal) {}

TEST_F(LocalBinaryUploadServiceTest, VerifyAgent) {}

TEST_F(LocalBinaryUploadServiceTest, VerifyAgent_NotOSVerified) {}

TEST_F(LocalBinaryUploadServiceTest, VerifyAgent_NoSubject) {}

TEST_F(LocalBinaryUploadServiceTest, VerifyAgent_VerifyNotNeeded) {}

TEST_F(LocalBinaryUploadServiceTest, VerifyAgent_MissingSystemSignalService) {}

}  // namespace enterprise_connectors