| Index: net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc
|
| diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc
|
| index 821e4ebd62a72dd61113c50d03664e752c09ec62..ea263e3f3358dc2c354403273596bd31afc3c6f5 100644
|
| --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc
|
| +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc
|
| @@ -31,8 +31,7 @@ const char* const kPacUrl = "http://pacserver/script.pac";
|
|
|
| // Version of DhcpProxyScriptAdapterFetcher that mocks out dependencies
|
| // to allow unit testing.
|
| -class MockDhcpProxyScriptAdapterFetcher
|
| - : public DhcpProxyScriptAdapterFetcher {
|
| +class MockDhcpProxyScriptAdapterFetcher : public DhcpProxyScriptAdapterFetcher {
|
| public:
|
| explicit MockDhcpProxyScriptAdapterFetcher(
|
| URLRequestContext* context,
|
| @@ -43,8 +42,7 @@ class MockDhcpProxyScriptAdapterFetcher
|
| configured_url_(kPacUrl),
|
| fetcher_delay_ms_(1),
|
| fetcher_result_(OK),
|
| - pac_script_("bingo") {
|
| - }
|
| + pac_script_("bingo") {}
|
|
|
| void Cancel() {
|
| DhcpProxyScriptAdapterFetcher::Cancel();
|
| @@ -57,8 +55,9 @@ class MockDhcpProxyScriptAdapterFetcher
|
| fetcher_ = new MockProxyScriptFetcher();
|
| if (fetcher_delay_ms_ != -1) {
|
| fetcher_timer_.Start(FROM_HERE,
|
| - base::TimeDelta::FromMilliseconds(fetcher_delay_ms_),
|
| - this, &MockDhcpProxyScriptAdapterFetcher::OnFetcherTimer);
|
| + base::TimeDelta::FromMilliseconds(fetcher_delay_ms_),
|
| + this,
|
| + &MockDhcpProxyScriptAdapterFetcher::OnFetcherTimer);
|
| }
|
| return fetcher_;
|
| }
|
| @@ -66,9 +65,7 @@ class MockDhcpProxyScriptAdapterFetcher
|
| class DelayingDhcpQuery : public DhcpQuery {
|
| public:
|
| explicit DelayingDhcpQuery()
|
| - : DhcpQuery(),
|
| - test_finished_event_(true, false) {
|
| - }
|
| + : DhcpQuery(), test_finished_event_(true, false) {}
|
|
|
| std::string ImplGetPacURLFromDhcp(
|
| const std::string& adapter_name) OVERRIDE {
|
| @@ -90,9 +87,7 @@ class MockDhcpProxyScriptAdapterFetcher
|
| }
|
|
|
| // Use a shorter timeout so tests can finish more quickly.
|
| - virtual base::TimeDelta ImplGetTimeout() const OVERRIDE {
|
| - return timeout_;
|
| - }
|
| + virtual base::TimeDelta ImplGetTimeout() const OVERRIDE { return timeout_; }
|
|
|
| void OnFetcherTimer() {
|
| // Note that there is an assumption by this mock implementation that
|
| @@ -107,13 +102,9 @@ class MockDhcpProxyScriptAdapterFetcher
|
| fetcher_ = NULL;
|
| }
|
|
|
| - bool IsWaitingForFetcher() const {
|
| - return state() == STATE_WAIT_URL;
|
| - }
|
| + bool IsWaitingForFetcher() const { return state() == STATE_WAIT_URL; }
|
|
|
| - bool WasCancelled() const {
|
| - return state() == STATE_CANCEL;
|
| - }
|
| + bool WasCancelled() const { return state() == STATE_CANCEL; }
|
|
|
| void FinishTest() {
|
| DCHECK(dhcp_query_);
|
| @@ -140,20 +131,15 @@ class FetcherClient {
|
| fetcher_(new MockDhcpProxyScriptAdapterFetcher(
|
| url_request_context_.get(),
|
| worker_pool_->GetTaskRunnerWithShutdownBehavior(
|
| - base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN))) {
|
| - }
|
| + base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN))) {}
|
|
|
| - ~FetcherClient() {
|
| - worker_pool_->Shutdown();
|
| - }
|
| + ~FetcherClient() { worker_pool_->Shutdown(); }
|
|
|
| void WaitForResult(int expected_error) {
|
| EXPECT_EQ(expected_error, callback_.WaitForResult());
|
| }
|
|
|
| - void RunTest() {
|
| - fetcher_->Fetch("adapter name", callback_.callback());
|
| - }
|
| + void RunTest() { fetcher_->Fetch("adapter name", callback_.callback()); }
|
|
|
| void FinishTestAllowCleanup() {
|
| fetcher_->FinishTest();
|
| @@ -268,8 +254,7 @@ class MockDhcpRealFetchProxyScriptAdapterFetcher
|
| URLRequestContext* context,
|
| scoped_refptr<base::TaskRunner> task_runner)
|
| : MockDhcpProxyScriptAdapterFetcher(context, task_runner),
|
| - url_request_context_(context) {
|
| - }
|
| + url_request_context_(context) {}
|
|
|
| // Returns a real proxy script fetcher.
|
| ProxyScriptFetcher* ImplCreateScriptFetcher() OVERRIDE {
|
| @@ -282,11 +267,10 @@ class MockDhcpRealFetchProxyScriptAdapterFetcher
|
| };
|
|
|
| TEST(DhcpProxyScriptAdapterFetcher, MockDhcpRealFetch) {
|
| - SpawnedTestServer test_server(
|
| - SpawnedTestServer::TYPE_HTTP,
|
| - SpawnedTestServer::kLocalhost,
|
| - base::FilePath(
|
| - FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest")));
|
| + SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTP,
|
| + SpawnedTestServer::kLocalhost,
|
| + base::FilePath(FILE_PATH_LITERAL(
|
| + "net/data/proxy_script_fetcher_unittest")));
|
| ASSERT_TRUE(test_server.Start());
|
|
|
| GURL configured_url = test_server.GetURL("files/downloadable.pac");
|
| @@ -296,9 +280,8 @@ TEST(DhcpProxyScriptAdapterFetcher, MockDhcpRealFetch) {
|
| scoped_refptr<base::TaskRunner> runner =
|
| client.worker_pool_->GetTaskRunnerWithShutdownBehavior(
|
| base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
|
| - client.fetcher_.reset(
|
| - new MockDhcpRealFetchProxyScriptAdapterFetcher(
|
| - &url_request_context, runner));
|
| + client.fetcher_.reset(new MockDhcpRealFetchProxyScriptAdapterFetcher(
|
| + &url_request_context, runner));
|
| client.fetcher_->configured_url_ = configured_url.spec();
|
| client.RunTest();
|
| client.WaitForResult(OK);
|
| @@ -306,8 +289,7 @@ TEST(DhcpProxyScriptAdapterFetcher, MockDhcpRealFetch) {
|
| EXPECT_EQ(OK, client.fetcher_->GetResult());
|
| EXPECT_EQ(base::string16(L"-downloadable.pac-\n"),
|
| client.fetcher_->GetPacScript());
|
| - EXPECT_EQ(configured_url,
|
| - client.fetcher_->GetPacURL());
|
| + EXPECT_EQ(configured_url, client.fetcher_->GetPacURL());
|
| }
|
|
|
| #define BASE_URL "http://corpserver/proxy.pac"
|
| @@ -317,8 +299,8 @@ TEST(DhcpProxyScriptAdapterFetcher, SanitizeDhcpApiString) {
|
|
|
| // Default case.
|
| EXPECT_EQ(BASE_URL,
|
| - DhcpProxyScriptAdapterFetcher::SanitizeDhcpApiString(
|
| - BASE_URL, kBaseUrlLen));
|
| + DhcpProxyScriptAdapterFetcher::SanitizeDhcpApiString(BASE_URL,
|
| + kBaseUrlLen));
|
|
|
| // Trailing \n and no null-termination.
|
| EXPECT_EQ(BASE_URL,
|
|
|