#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/threading/scoped_blocking_call.h"
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "base/barrier_closure.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/environment_config.h"
#include "base/task/thread_pool/thread_pool_impl.h"
#include "base/test/bind.h"
#include "base/test/gtest_util.h"
#include "base/test/task_environment.h"
#include "base/test/test_waitable_event.h"
#include "base/threading/scoped_blocking_call_internal.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time_override.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
ElementsAre;
namespace base {
namespace {
class MockBlockingObserver : public internal::BlockingObserver { … };
class ScopedBlockingCallTest : public testing::Test { … };
}
TEST_F(ScopedBlockingCallTest, MayBlock) { … }
TEST_F(ScopedBlockingCallTest, WillBlock) { … }
TEST_F(ScopedBlockingCallTest, MayBlockWillBlock) { … }
TEST_F(ScopedBlockingCallTest, WillBlockMayBlock) { … }
TEST_F(ScopedBlockingCallTest, MayBlockMayBlock) { … }
TEST_F(ScopedBlockingCallTest, WillBlockWillBlock) { … }
TEST_F(ScopedBlockingCallTest, MayBlockWillBlockTwice) { … }
TEST(ScopedBlockingCallDestructionOrderTest, InvalidDestructionOrder) { … }
namespace {
class ScopedBlockingCallIOJankMonitoringTest : public testing::Test { … };
}
TEST_F(ScopedBlockingCallIOJankMonitoringTest, Basic) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, NestedDoesntMatter) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, ManyInAWindow) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, OverlappingMultipleWindows) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, InstantUnblockReportsZero) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, Jank7sMidInterval) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, Jank1sMidInterval) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, JankRoundDown) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, JankRoundUp) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, NoJankMidInterval) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, MultiThreaded) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, MultiThreadedOverlapped) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, MultiThreadedOverlappedWindows) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, CancellationAcrossSleep) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, SleepWithLongJank) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, BackgroundBlockingCallsIgnored) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest,
BackgroundAndForegroundCallsMixed) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, WillBlockNotMonitored) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest,
NestedWillBlockCancelsMonitoring) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, NestedMayBlockIgnored) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest, BaseSyncPrimitivesNotMonitored) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest,
NestedBaseSyncPrimitivesCancels) { … }
TEST_F(ScopedBlockingCallIOJankMonitoringTest,
RacySampleNearMonitoringWindowBoundary) { … }
}