#include "chrome/browser/media/webrtc/webrtc_event_log_uploader.h"
#include <memory>
#include <string>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/media/webrtc/webrtc_event_log_manager_common.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/test/browser_task_environment.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace webrtc_event_logging {
_;
StrictMock;
BrowserContextId;
namespace {
class UploadObserver { … };
#if BUILDFLAG(IS_POSIX)
void RemovePermissions(const base::FilePath& path, int removed_permissions) { … }
void RemoveReadPermissions(const base::FilePath& path) { … }
#endif
}
class WebRtcEventLogUploaderImplTest : public ::testing::Test { … };
TEST_F(WebRtcEventLogUploaderImplTest, SuccessfulUploadReportedToObserver) { … }
TEST_F(WebRtcEventLogUploaderImplTest, UnsuccessfulUploadReportedToObserver1) { … }
TEST_F(WebRtcEventLogUploaderImplTest, UnsuccessfulUploadReportedToObserver2) { … }
#if BUILDFLAG(IS_POSIX)
TEST_F(WebRtcEventLogUploaderImplTest, FailureToReadFileReportedToObserver) { … }
TEST_F(WebRtcEventLogUploaderImplTest, NonExistentFileReportedToObserver) { … }
#endif
TEST_F(WebRtcEventLogUploaderImplTest, FilesUpToMaxSizeUploaded) { … }
TEST_F(WebRtcEventLogUploaderImplTest, ExcessivelyLargeFilesNotUploaded) { … }
TEST_F(WebRtcEventLogUploaderImplTest,
CancelBeforeUploadCompletionCallsCallbackWithFalse) { … }
TEST_F(WebRtcEventLogUploaderImplTest, SecondCallToCancelHasNoEffect) { … }
TEST_F(WebRtcEventLogUploaderImplTest,
CancelAfterUploadCompletionCallbackWasCalledHasNoEffect) { … }
TEST_F(WebRtcEventLogUploaderImplTest, CancelOnAbortedUploadHasNoEffect) { … }
TEST_F(WebRtcEventLogUploaderImplTest, CancelOnOngoingUploadDeletesFile) { … }
TEST_F(WebRtcEventLogUploaderImplTest,
GetWebRtcLogFileInfoReturnsCorrectInfoBeforeUploadDone) { … }
TEST_F(WebRtcEventLogUploaderImplTest,
GetWebRtcLogFileInfoReturnsCorrectInfoAfterUploadSucceeded) { … }
TEST_F(WebRtcEventLogUploaderImplTest,
GetWebRtcLogFileInfoReturnsCorrectInfoWhenCalledOnCancelledUpload) { … }
}