#include "chrome/browser/policy/messaging_layer/util/manual_test_heartbeat_event.h"
#include <memory>
#include "base/check_op.h"
#include "base/feature_list.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "build/buildflag.h"
#include "chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.h"
#include "components/reporting/client/report_queue_configuration.h"
#include "components/reporting/proto/synced/record_constants.pb.h"
#include "components/reporting/util/status.h"
#include "components/reporting/util/task_runner_context.h"
namespace reporting {
namespace {
BASE_FEATURE(…);
}
ManualTestHeartbeatEvent::ManualTestHeartbeatEvent() { … }
ManualTestHeartbeatEvent::~ManualTestHeartbeatEvent() { … }
void ManualTestHeartbeatEvent::Shutdown() { … }
void ManualTestHeartbeatEvent::StartHeartbeatEvent() const { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
namespace {
BASE_FEATURE(kEncryptedReportingManualTestUserHeartbeatEvent,
"EncryptedReportingManualTestUserHeartbeatEvent",
base::FEATURE_DISABLED_BY_DEFAULT);
}
void ManualTestHeartbeatEvent::OnLogin(Profile* profile) {
managed_session_observation_.Reset();
CHECK_NE(profile, nullptr);
if (base::FeatureList::IsEnabled(
kEncryptedReportingManualTestUserHeartbeatEvent)) {
Start<ReportQueueManualTestContext>(
base::Seconds(1),
10,
HEARTBEAT_EVENTS,
FAST_BATCH, EventType::kUser,
base::BindOnce([](Status status) {
LOG(WARNING) << "Heartbeat Event completed with status: " << status;
}),
base::ThreadPool::CreateSequencedTaskRunner(
{base::TaskPriority::BEST_EFFORT, base::MayBlock()}));
}
}
#endif
}