#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/loader/fetch/response_body_loader.h"
#include <memory>
#include <string>
#include <utility>
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "services/network/public/cpp/features.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h"
#include "third_party/blink/renderer/platform/loader/fetch/data_pipe_bytes_consumer.h"
#include "third_party/blink/renderer/platform/loader/testing/bytes_consumer_test_reader.h"
#include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h"
#include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
namespace blink {
namespace {
class TestBackForwardCacheLoaderHelper : public BackForwardCacheLoaderHelper { … };
class ResponseBodyLoaderTest : public testing::Test { … };
class ResponseBodyLoaderDrainedBytesConsumerNotificationOutOfOnStateChangeTest
: public ResponseBodyLoaderTest { … };
class ResponseBodyLoaderDrainedBytesConsumerNotificationInOnStateChangeTest
: public ResponseBodyLoaderTest { … };
TEST_F(ResponseBodyLoaderTest, Load) { … }
TEST_F(ResponseBodyLoaderTest, LoadFailure) { … }
TEST_F(ResponseBodyLoaderTest, LoadWithDataAndDone) { … }
TEST_F(ResponseBodyLoaderTest, Abort) { … }
TEST_F(ResponseBodyLoaderTest, Suspend) { … }
TEST_F(ResponseBodyLoaderTest, ReadTooBigBuffer) { … }
TEST_F(ResponseBodyLoaderTest, NotDrainable) { … }
TEST_F(ResponseBodyLoaderTest, DrainAsDataPipe) { … }
class ResponseBodyLoaderLoadingTasksUnfreezableTest
: public ResponseBodyLoaderTest,
public ::testing::WithParamInterface<bool> { … };
TEST_P(ResponseBodyLoaderLoadingTasksUnfreezableTest,
SuspendedThenSuspendedForBackForwardCacheThenResume) { … }
TEST_P(ResponseBodyLoaderLoadingTasksUnfreezableTest,
FinishedWhileSuspendedThenSuspendedForBackForwardCacheThenResume) { … }
TEST_P(ResponseBodyLoaderLoadingTasksUnfreezableTest,
SuspendedForBackForwardCacheThenSuspendedThenResume) { … }
TEST_P(ResponseBodyLoaderLoadingTasksUnfreezableTest,
ReadDataFromConsumerWhileSuspendedForBackForwardCacheLong) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(ResponseBodyLoaderTest, DrainAsDataPipeAndReportError) { … }
TEST_F(ResponseBodyLoaderTest, DrainAsBytesConsumer) { … }
TEST_F(ResponseBodyLoaderTest, CancelDrainedBytesConsumer) { … }
TEST_F(ResponseBodyLoaderTest, AbortDrainAsBytesConsumerWhileLoading) { … }
TEST_F(ResponseBodyLoaderTest, DrainAsBytesConsumerWithError) { … }
TEST_F(ResponseBodyLoaderTest, AbortAfterBytesConsumerIsDrained) { … }
TEST_F(ResponseBodyLoaderTest, AbortAfterBytesConsumerIsDrainedIsNotified) { … }
TEST_F(ResponseBodyLoaderDrainedBytesConsumerNotificationOutOfOnStateChangeTest,
BeginReadAndDone) { … }
TEST_F(ResponseBodyLoaderDrainedBytesConsumerNotificationOutOfOnStateChangeTest,
BeginReadAndError) { … }
TEST_F(ResponseBodyLoaderDrainedBytesConsumerNotificationOutOfOnStateChangeTest,
EndReadAndDone) { … }
TEST_F(ResponseBodyLoaderDrainedBytesConsumerNotificationOutOfOnStateChangeTest,
DrainAsDataPipe) { … }
TEST_F(ResponseBodyLoaderDrainedBytesConsumerNotificationOutOfOnStateChangeTest,
Cancel) { … }
TEST_F(ResponseBodyLoaderDrainedBytesConsumerNotificationInOnStateChangeTest,
BeginReadAndDone) { … }
TEST_F(ResponseBodyLoaderDrainedBytesConsumerNotificationInOnStateChangeTest,
BeginReadAndError) { … }
TEST_F(ResponseBodyLoaderDrainedBytesConsumerNotificationInOnStateChangeTest,
EndReadAndDone) { … }
class ResponseBodyLoaderTestAllowDrainAsBytesConsumerInBFCache
: public ResponseBodyLoaderTest { … };
TEST_F(ResponseBodyLoaderTestAllowDrainAsBytesConsumerInBFCache,
DrainAsBytesConsumer) { … }
}
}