#include "chrome/enterprise_companion/event_logger.h"
#include <memory>
#include <optional>
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/files/scoped_temp_file.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/bind_post_task.h"
#include "base/test/task_environment.h"
#include "base/threading/sequence_bound.h"
#include "base/time/time.h"
#include "chrome/enterprise_companion/enterprise_companion_branding.h"
#include "chrome/enterprise_companion/enterprise_companion_status.h"
#include "chrome/enterprise_companion/global_constants.h"
#include "chrome/enterprise_companion/ipc_support.h"
#include "chrome/enterprise_companion/proto/enterprise_companion_event.pb.h"
#include "chrome/enterprise_companion/proto/log_request.pb.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/cookies/cookie_access_result.h"
#include "net/cookies/cookie_change_dispatcher.h"
#include "net/http/http_status_code.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "services/network/test/test_cookie_manager.h"
#include "services/network/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace enterprise_companion {
namespace {
class MockEventLogUploader final : public EventLogUploader { … };
}
class EventLoggerTest : public ::testing::Test { … };
TEST_F(EventLoggerTest, TransmitsEvents) { … }
TEST_F(EventLoggerTest, RespectsMinimumCooldown) { … }
TEST_F(EventLoggerTest, RespectsRequestedCooldown) { … }
TEST_F(EventLoggerTest, RequestsBatchedAcrossLoggers) { … }
TEST_F(EventLoggerTest, FlushedLogsClearedOnHTTP2XX) { … }
TEST_F(EventLoggerTest, FlushedLogsClearedOnHTTP4XX) { … }
TEST_F(EventLoggerTest, FlushedLogsRetainedOnHTTP5XX) { … }
class MockCookieManager
: public ::testing::StrictMock<network::TestCookieManager> { … };
class EventLoggerCookieHandlerTest : public ::testing::Test { … };
TEST_F(EventLoggerCookieHandlerTest, InitializesNewLoggingCookie) { … }
TEST_F(EventLoggerCookieHandlerTest, InitializesExistingLoggingCookie) { … }
TEST_F(EventLoggerCookieHandlerTest, PersistsLoggingCookie) { … }
TEST_F(EventLoggerCookieHandlerTest, OverwritesLoggingCookie) { … }
TEST_F(EventLoggerCookieHandlerTest, IgnoresNonInsertionEvents) { … }
}