Commit e31d4c24 authored by kinuko@chromium.org's avatar kinuko@chromium.org

Leak fix in FileSystemOperationUnitTest.

BUG=83944
TEST=valgrind bots green

Review URL: http://codereview.chromium.org/7053029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86792 0039d316-1c4b-4281-b951-d872f2087c98
parent 11f9de05
...@@ -1610,9 +1610,3 @@ ...@@ -1610,9 +1610,3 @@
fun:net::ClientSocketPoolManager::InitSocketHandleForRawConnect fun:net::ClientSocketPoolManager::InitSocketHandleForRawConnect
fun:notifier::ProxyResolvingClientSocket::ProcessProxyResolveDone fun:notifier::ProxyResolvingClientSocket::ProcessProxyResolveDone
} }
{
bug_83944
Heapcheck:Leak
...
fun:fileapi::FileSystemOperationTest::SetUp
}
...@@ -4650,12 +4650,6 @@ ...@@ -4650,12 +4650,6 @@
fun:_ZN3net17UDPSocketLibevent15DidCompleteReadEv fun:_ZN3net17UDPSocketLibevent15DidCompleteReadEv
fun:_ZN3net17UDPSocketLibevent11ReadWatcher28OnFileCanReadWithoutBlockingEi fun:_ZN3net17UDPSocketLibevent11ReadWatcher28OnFileCanReadWithoutBlockingEi
} }
{
bug_83944_a
Memcheck:Leak
...
fun:_ZN7fileapi23FileSystemOperationTest5SetUpEv
}
{ {
bug_83944_b bug_83944_b
Memcheck:Addr1 Memcheck:Addr1
......
...@@ -88,10 +88,29 @@ class MockQuotaManagerProxy : public QuotaManagerProxy { ...@@ -88,10 +88,29 @@ class MockQuotaManagerProxy : public QuotaManagerProxy {
public: public:
explicit MockQuotaManagerProxy(QuotaManager* quota_manager) explicit MockQuotaManagerProxy(QuotaManager* quota_manager)
: QuotaManagerProxy(quota_manager, : QuotaManagerProxy(quota_manager,
base::MessageLoopProxy::CreateForCurrentThread()) {} base::MessageLoopProxy::CreateForCurrentThread()),
registered_client_(NULL) {
}
virtual ~MockQuotaManagerProxy() {
EXPECT_FALSE(registered_client_);
}
virtual void RegisterClient(QuotaClient* client) {
EXPECT_FALSE(registered_client_);
registered_client_ = client;
}
void SimulateQuotaManagerDestroyed() {
if (registered_client_) {
// We cannot call this in the destructor as the client (indirectly)
// holds a refptr of the proxy.
registered_client_->OnQuotaManagerDestroyed();
registered_client_ = NULL;
}
}
// We don't mock them. // We don't mock them.
virtual void RegisterClient(QuotaClient* client) OVERRIDE {}
virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {} virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {}
virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {} virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {}
...@@ -120,6 +139,7 @@ class MockQuotaManagerProxy : public QuotaManagerProxy { ...@@ -120,6 +139,7 @@ class MockQuotaManagerProxy : public QuotaManagerProxy {
MockQuotaManager* mock_manager() const { MockQuotaManager* mock_manager() const {
return static_cast<MockQuotaManager*>(quota_manager()); return static_cast<MockQuotaManager*>(quota_manager());
} }
QuotaClient* registered_client_;
}; };
FilePath ASCIIToFilePath(const std::string& str) { FilePath ASCIIToFilePath(const std::string& str) {
...@@ -287,6 +307,8 @@ void FileSystemOperationTest::SetUp() { ...@@ -287,6 +307,8 @@ void FileSystemOperationTest::SetUp() {
} }
void FileSystemOperationTest::TearDown() { void FileSystemOperationTest::TearDown() {
// Let the client go away before dropping a ref of the quota manager proxy.
quota_manager_proxy()->SimulateQuotaManagerDestroyed();
quota_manager_ = NULL; quota_manager_ = NULL;
quota_manager_proxy_ = NULL; quota_manager_proxy_ = NULL;
test_helper_.TearDown(); test_helper_.TearDown();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment