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

Unified Diff: webkit/fileapi/file_system_url_request_job_unittest.cc

Issue 10067031: Memory leak fix in FileSystemURLRequestJobTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_url_request_job_unittest.cc
diff --git a/webkit/fileapi/file_system_url_request_job_unittest.cc b/webkit/fileapi/file_system_url_request_job_unittest.cc
index 015839fd8c623380e55edf4f103d283504ea029c..3fc8ad71d8afd22de2e0dbeef3e75b4675779aa2 100644
--- a/webkit/fileapi/file_system_url_request_job_unittest.cc
+++ b/webkit/fileapi/file_system_url_request_job_unittest.cc
@@ -70,7 +70,7 @@ class FileSystemURLRequestJobTest : public testing::Test {
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
}
- virtual void SetUp() {
+ virtual void SetUp() OVERRIDE {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
special_storage_policy_ = new quota::MockSpecialStoragePolicy;
@@ -94,9 +94,15 @@ class FileSystemURLRequestJobTest : public testing::Test {
"filesystem", &FileSystemURLRequestJobFactory);
}
- virtual void TearDown() {
+ virtual void TearDown() OVERRIDE {
net::URLRequest::Deprecated::RegisterProtocolFactory("filesystem", NULL);
ClearUnusedJob();
+ if (pending_job_) {
+ pending_job_->Kill();
+ pending_job_ = NULL;
+ }
+ // FileReader posts a task to close the file in destructor.
+ MessageLoop::current()->RunAllPending();
}
void OnValidateFileSystem(base::PlatformFileError result) {
@@ -113,10 +119,12 @@ class FileSystemURLRequestJobTest : public testing::Test {
request_.reset(new net::URLRequest(url, delegate_.get()));
if (headers)
request_->SetExtraRequestHeaders(*headers);
+ ASSERT_TRUE(!job_);
job_ = new FileSystemURLRequestJob(
request_.get(),
file_system_context_.get(),
base::MessageLoopProxy::current());
+ pending_job_ = job_;
request_->Start();
ASSERT_TRUE(request_->is_pending()); // verify that we're starting async
@@ -212,6 +220,7 @@ class FileSystemURLRequestJobTest : public testing::Test {
scoped_ptr<TestDelegate> delegate_;
scoped_ptr<net::URLRequest> request_;
+ scoped_refptr<net::URLRequestJob> pending_job_;
static net::URLRequestJob* job_;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698