Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: webkit/fileapi/file_system_operation_unittest.cc

Issue 7053029: Leak fix in FileSystemOperationUnitTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/valgrind/memcheck/suppressions.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_operation_unittest.cc
diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc
index 9e4844d94b356529c874864f5f0b697b3003e935..ae80ad9f2c67e830f09f168f1032e2622d14e9ae 100644
--- a/webkit/fileapi/file_system_operation_unittest.cc
+++ b/webkit/fileapi/file_system_operation_unittest.cc
@@ -88,10 +88,29 @@ class MockQuotaManagerProxy : public QuotaManagerProxy {
public:
explicit MockQuotaManagerProxy(QuotaManager* 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.
- virtual void RegisterClient(QuotaClient* client) OVERRIDE {}
virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {}
virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {}
@@ -120,6 +139,7 @@ class MockQuotaManagerProxy : public QuotaManagerProxy {
MockQuotaManager* mock_manager() const {
return static_cast<MockQuotaManager*>(quota_manager());
}
+ QuotaClient* registered_client_;
};
FilePath ASCIIToFilePath(const std::string& str) {
@@ -287,6 +307,8 @@ void FileSystemOperationTest::SetUp() {
}
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_proxy_ = NULL;
test_helper_.TearDown();
« no previous file with comments | « tools/valgrind/memcheck/suppressions.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698