Chromium Code Reviews| 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..92bb2e90dce83b5a3f6f0f7bb245df6bd260b1c2 100644 |
| --- a/webkit/fileapi/file_system_operation_unittest.cc |
| +++ b/webkit/fileapi/file_system_operation_unittest.cc |
| @@ -88,10 +88,27 @@ 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_); |
|
oshima
2011/05/26 01:17:07
Any reason not deleting here? (deletion order matt
kinuko
2011/05/26 02:19:25
Yes there's an ordering issue. I added a comment.
|
| + } |
| + |
| + virtual void RegisterClient(QuotaClient* client) { |
| + EXPECT_FALSE(registered_client_); |
| + registered_client_ = client; |
| + } |
| + |
| + void SimulateQuotaManagerDestroyed() { |
| + if (registered_client_) { |
| + 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 +137,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 +305,7 @@ void FileSystemOperationTest::SetUp() { |
| } |
| void FileSystemOperationTest::TearDown() { |
| + quota_manager_proxy()->SimulateQuotaManagerDestroyed(); |
| quota_manager_ = NULL; |
| quota_manager_proxy_ = NULL; |
| test_helper_.TearDown(); |