diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-20 16:52:41 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-20 16:52:41 +0000 |
commit | 7c80f42e202478fc3eea8747ad7d4c9bfe2997c5 (patch) | |
tree | f49c455d9990664ef517a75372ff061dc7913f82 /net | |
parent | 1fac3c3d4e9264680ac9607fcba3fee44af3feae (diff) | |
download | chromium_src-7c80f42e202478fc3eea8747ad7d4c9bfe2997c5.zip chromium_src-7c80f42e202478fc3eea8747ad7d4c9bfe2997c5.tar.gz chromium_src-7c80f42e202478fc3eea8747ad7d4c9bfe2997c5.tar.bz2 |
Fix DrMemory leaks in dhcp code.
BUG=123867
TEST=none
Review URL: http://codereview.chromium.org/10157002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc index bc1700b..644b533 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc @@ -212,8 +212,8 @@ TEST(DhcpProxyScriptFetcherWin, RealFetchWithDeferredCancel) { class DummyDhcpProxyScriptAdapterFetcher : public DhcpProxyScriptAdapterFetcher { public: - DummyDhcpProxyScriptAdapterFetcher() - : DhcpProxyScriptAdapterFetcher(new TestURLRequestContext()), + explicit DummyDhcpProxyScriptAdapterFetcher(URLRequestContext* context) + : DhcpProxyScriptAdapterFetcher(context), did_finish_(false), result_(OK), pac_script_(L"bingo"), @@ -284,8 +284,8 @@ class MockDhcpProxyScriptFetcherWin : public DhcpProxyScriptFetcherWin { std::vector<std::string> mock_adapter_names_; }; - MockDhcpProxyScriptFetcherWin() - : DhcpProxyScriptFetcherWin(new TestURLRequestContext()), + MockDhcpProxyScriptFetcherWin(URLRequestContext* context) + : DhcpProxyScriptFetcherWin(context), num_fetchers_created_(0), worker_finished_event_(true, false) { ResetTestState(); @@ -310,7 +310,7 @@ class MockDhcpProxyScriptFetcherWin : public DhcpProxyScriptFetcherWin { string16 pac_script, int fetch_delay_ms) { scoped_ptr<DummyDhcpProxyScriptAdapterFetcher> adapter_fetcher( - new DummyDhcpProxyScriptAdapterFetcher()); + new DummyDhcpProxyScriptAdapterFetcher(url_request_context())); adapter_fetcher->Configure(did_finish, result, pac_script, fetch_delay_ms); PushBackAdapter(adapter_name, adapter_fetcher.release()); } @@ -371,7 +371,9 @@ class MockDhcpProxyScriptFetcherWin : public DhcpProxyScriptFetcherWin { class FetcherClient { public: FetcherClient() - : finished_(false), + : context_(new TestURLRequestContext), + fetcher_(context_), + finished_(false), result_(ERR_UNEXPECTED) { } @@ -409,6 +411,7 @@ public: fetcher_.ResetTestState(); } + scoped_refptr<URLRequestContext> context_; MockDhcpProxyScriptFetcherWin fetcher_; bool finished_; int result_; @@ -418,8 +421,9 @@ public: // We separate out each test's logic so that we can easily implement // the ReuseFetcher test at the bottom. void TestNormalCaseURLConfiguredOneAdapter(FetcherClient* client) { + scoped_refptr<URLRequestContext> context(new TestURLRequestContext); scoped_ptr<DummyDhcpProxyScriptAdapterFetcher> adapter_fetcher( - new DummyDhcpProxyScriptAdapterFetcher()); + new DummyDhcpProxyScriptAdapterFetcher(context)); adapter_fetcher->Configure(true, OK, L"bingo", 1); client->fetcher_.PushBackAdapter("a", adapter_fetcher.release()); client->RunTest(); @@ -569,8 +573,9 @@ TEST(DhcpProxyScriptFetcherWin, ShortCircuitLessPreferredAdapters) { } void TestImmediateCancel(FetcherClient* client) { + scoped_refptr<URLRequestContext> context(new TestURLRequestContext); scoped_ptr<DummyDhcpProxyScriptAdapterFetcher> adapter_fetcher( - new DummyDhcpProxyScriptAdapterFetcher()); + new DummyDhcpProxyScriptAdapterFetcher(context)); adapter_fetcher->Configure(true, OK, L"bingo", 1); client->fetcher_.PushBackAdapter("a", adapter_fetcher.release()); client->RunTest(); |