summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/google_url_tracker_unittest.cc8
-rw-r--r--chrome/common/net/test_url_fetcher_factory.h9
-rw-r--r--chrome/common/net/url_fetcher.h2
-rw-r--r--tools/valgrind/memcheck/suppressions.txt7
4 files changed, 10 insertions, 16 deletions
diff --git a/chrome/browser/google_url_tracker_unittest.cc b/chrome/browser/google_url_tracker_unittest.cc
index 428a3e3..f0a6d2a 100644
--- a/chrome/browser/google_url_tracker_unittest.cc
+++ b/chrome/browser/google_url_tracker_unittest.cc
@@ -70,13 +70,16 @@ class TestInfoBarDelegateFactory
class GoogleURLTrackerTest : public testing::Test {
protected:
GoogleURLTrackerTest()
- : original_default_request_context_(NULL) {
+ : message_loop_(NULL),
+ io_thread_(NULL),
+ original_default_request_context_(NULL) {
}
void SetUp() {
original_default_request_context_ = Profile::GetDefaultRequestContext();
Profile::set_default_request_context(NULL);
message_loop_ = new MessageLoop(MessageLoop::TYPE_IO);
+ io_thread_ = new ChromeThread(ChromeThread::IO, message_loop_);
network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock());
testing_profile_.reset(new TestingProfile);
TestingBrowserProcess* testing_browser_process =
@@ -99,8 +102,10 @@ class GoogleURLTrackerTest : public testing::Test {
testing_browser_process->SetPrefService(NULL);
testing_profile_.reset();
network_change_notifier_.reset();
+ delete io_thread_;
delete message_loop_;
Profile::set_default_request_context(original_default_request_context_);
+ original_default_request_context_ = NULL;
}
void CreateRequestContext() {
@@ -215,6 +220,7 @@ class GoogleURLTrackerTest : public testing::Test {
private:
MessageLoop* message_loop_;
+ ChromeThread* io_thread_;
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
scoped_ptr<TestingProfile> testing_profile_;
diff --git a/chrome/common/net/test_url_fetcher_factory.h b/chrome/common/net/test_url_fetcher_factory.h
index 676cfe0..b34c0a1 100644
--- a/chrome/common/net/test_url_fetcher_factory.h
+++ b/chrome/common/net/test_url_fetcher_factory.h
@@ -21,6 +21,8 @@
// Typical usage:
// // TestURLFetcher requires a MessageLoop:
// MessageLoopForUI message_loop;
+// // And io_thread to release URLRequestContextGetter in URLFetcher::Core.
+// ChromeThread io_thread(ChromeThread::IO, &message_loop);
// // Create and register factory.
// TestURLFetcherFactory factory;
// URLFetcher::set_factory(&factory);
@@ -53,13 +55,6 @@ class TestURLFetcher : public URLFetcher {
// Returns the data uploaded on this URLFetcher.
const std::string& upload_data() const { return URLFetcher::upload_data(); }
- // Overriden to do nothing. URLFetcher implementation add reference
- // to request_context_getter in core_, but it might not be released
- // because we wouldn't call Core::CancelURLRequest.
- // Without this, we'll see leaks of URLRequestContext in test.
- virtual void set_request_context(
- URLRequestContextGetter* request_context_getter) {}
-
private:
const GURL original_url_;
diff --git a/chrome/common/net/url_fetcher.h b/chrome/common/net/url_fetcher.h
index 1a96f91..9294db3 100644
--- a/chrome/common/net/url_fetcher.h
+++ b/chrome/common/net/url_fetcher.h
@@ -140,7 +140,7 @@ class URLFetcher {
// Set the URLRequestContext on the request. Must be called before the
// request is started.
- virtual void set_request_context(
+ void set_request_context(
URLRequestContextGetter* request_context_getter);
// If |retry| is false, 5xx responses will be propagated to the observer,
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index 44d7cf4..ad2d771 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -4142,13 +4142,6 @@
fun:_ZN17URLRequestHttpJobD0Ev
}
{
- bug_52826
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN14TestingProfile20CreateRequestContextEv
- fun:_ZN20GoogleURLTrackerTest20CreateRequestContextEv
-}
-{
bug_52831
Memcheck:Leak
fun:_Znw*