#include "base/base_switches.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "chrome/browser/preloading/preloading_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "net/base/network_change_notifier.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
NetworkChangeNotifier;
PreloadPagesState;
namespace {
const char kPrefetchPage[] = …;
const char kRedirectPrefetchPage[] = …;
const char kRedirectPrefetchUrl[] = …;
const char kRedirectedPrefetchUrl[] = …;
const char kPrefetchCachingPeriodPage[] = …;
const char kPrefetchCachingPeriodUrl[] = …;
bool HasVariationsHeader(
const net::test_server::HttpRequest::HeaderMap& headers) { … }
class MockNetworkChangeNotifierWIFI : public NetworkChangeNotifier { … };
class MockNetworkChangeNotifier4G : public NetworkChangeNotifier { … };
class PrefetchBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTest, PreferenceWorks) { … }
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTest, IncognitoTest) { … }
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTest, RedirectedPrefetch) { … }
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTest, PrefetchCachingPeriod) { … }
IN_PROC_BROWSER_TEST_F(PrefetchBrowserTest, PrefetchCachingPeriodWithAge) { … }
}