#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/run_until.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/net/proxy_test_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/login/login_handler.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/url_loader_interceptor.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/base/load_flags.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/simple_connection_listener.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
#include "net/test/test_data_directory.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/net/dhcp_wpad_url_client.h"
#endif
namespace {
void VerifyProxyScript(Browser* browser) { … }
IN_PROC_BROWSER_TEST_F(ProxyBrowserTest, BasicAuthWSConnect) { … }
class BaseHttpProxyScriptBrowserTest : public InProcessBrowserTest { … };
class HttpProxyScriptBrowserTest : public BaseHttpProxyScriptBrowserTest { … };
IN_PROC_BROWSER_TEST_F(HttpProxyScriptBrowserTest, Verify) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
class WPADHttpProxyScriptBrowserTest : public HttpProxyScriptBrowserTest {
public:
WPADHttpProxyScriptBrowserTest() = default;
WPADHttpProxyScriptBrowserTest(const WPADHttpProxyScriptBrowserTest&) =
delete;
WPADHttpProxyScriptBrowserTest& operator=(
const WPADHttpProxyScriptBrowserTest&) = delete;
~WPADHttpProxyScriptBrowserTest() override {}
void SetUp() override {
ASSERT_TRUE(http_server_.Start());
pac_url_ = http_server_.GetURL("/" + GetPacFilename());
ash::DhcpWpadUrlClient::SetPacUrlForTesting(pac_url_);
InProcessBrowserTest::SetUp();
}
void TearDown() override {
ash::DhcpWpadUrlClient::ClearPacUrlForTesting();
InProcessBrowserTest::TearDown();
}
void SetUpCommandLine(base::CommandLine* command_line) override {
command_line->AppendSwitch(switches::kProxyAutoDetect);
}
private:
GURL pac_url_;
};
IN_PROC_BROWSER_TEST_F(WPADHttpProxyScriptBrowserTest, Verify) {
VerifyProxyScript(browser());
}
#endif
class MyIpAddressProxyScriptBrowserTest
: public BaseHttpProxyScriptBrowserTest { … };
IN_PROC_BROWSER_TEST_F(MyIpAddressProxyScriptBrowserTest, Verify) { … }
class HangingPacRequestProxyScriptBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(HangingPacRequestProxyScriptBrowserTest, Shutdown) { … }
}