// Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_PUBLIC_TEST_KEEP_ALIVE_URL_LOADER_UTILS_H_ #define CONTENT_PUBLIC_TEST_KEEP_ALIVE_URL_LOADER_UTILS_H_ #include <memory> #include <vector> #include "base/memory/raw_ptr.h" #include "services/network/public/cpp/url_loader_completion_status.h" namespace content { class BrowserContext; class KeepAliveURLLoadersTestObserverImpl; // Observes behaviors of all `KeepAliveURLLoader` instances in synchronous way. // // KeepAliveURLLoader itself is running in browser UI thread, but there can be // multiple instances created and triggered by different renderers. // For example: // - Renderer A triggers `KeepAliveURLLoader::OnReceiveRedirectForwarded()` // and then `KeepAliveURLLoader::OnReceiveResponseProcessed() // - Renderer B triggers `KeepAliveURLLoader::OnReceiveRedirectForwarded()` // twice. // - Users can call `WaitForTotalOnReceiveRedirectForwarded()` to wait until // all 3 triggerings of `KeepAliveURLLoader::OnReceiveRedirectForwarded()` // completed. // // The methods provided by this class can also be used to assert that // KeepAliveURLLoader has entered certain state, e.g. // `WaitForTotalOnReceiveRedirectProcessed()` indicates the loader handles the // redirect itself rather than handing over to renderer as renderer is gone. class KeepAliveURLLoadersTestObserver { … }; } // namespace content #endif // CONTENT_PUBLIC_TEST_KEEP_ALIVE_URL_LOADER_UTILS_H_