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

Side by Side Diff: webkit/fileapi/file_system_url_request_job_unittest.cc

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_test_helper.cc ('k') | webkit/fileapi/file_writer_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit)
6 // rather than as part of test_shell_tests because they rely on being able 6 // rather than as part of test_shell_tests because they rely on being able
7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses
8 // TYPE_UI, which URLRequest doesn't allow. 8 // TYPE_UI, which URLRequest doesn't allow.
9 // 9 //
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 virtual void SetUp() { 87 virtual void SetUp() {
88 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 88 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
89 89
90 special_storage_policy_ = new TestSpecialStoragePolicy(); 90 special_storage_policy_ = new TestSpecialStoragePolicy();
91 // We use the main thread so that we can get the root path synchronously. 91 // We use the main thread so that we can get the root path synchronously.
92 // TODO(adamk): Run this on the FILE thread we've created as well. 92 // TODO(adamk): Run this on the FILE thread we've created as well.
93 file_system_context_ = 93 file_system_context_ =
94 new FileSystemContext( 94 new FileSystemContext(
95 base::MessageLoopProxy::CreateForCurrentThread(), 95 base::MessageLoopProxy::current(),
96 base::MessageLoopProxy::CreateForCurrentThread(), 96 base::MessageLoopProxy::current(),
97 special_storage_policy_, NULL, 97 special_storage_policy_, NULL,
98 FilePath(), false /* is_incognito */, 98 FilePath(), false /* is_incognito */,
99 false, true, 99 false, true,
100 new FileSystemPathManager( 100 new FileSystemPathManager(
101 base::MessageLoopProxy::CreateForCurrentThread(), 101 base::MessageLoopProxy::current(),
102 temp_dir_.path(), NULL, false, false)); 102 temp_dir_.path(), NULL, false, false));
103 103
104 file_system_context_->path_manager()->ValidateFileSystemRootAndGetURL( 104 file_system_context_->path_manager()->ValidateFileSystemRootAndGetURL(
105 GURL("http://remote/"), kFileSystemTypeTemporary, true, // create 105 GURL("http://remote/"), kFileSystemTypeTemporary, true, // create
106 callback_factory_.NewCallback( 106 callback_factory_.NewCallback(
107 &FileSystemURLRequestJobTest::OnGetRootPath)); 107 &FileSystemURLRequestJobTest::OnGetRootPath));
108 MessageLoop::current()->RunAllPending(); 108 MessageLoop::current()->RunAllPending();
109 109
110 net::URLRequest::Deprecated::RegisterProtocolFactory( 110 net::URLRequest::Deprecated::RegisterProtocolFactory(
111 "filesystem", &FileSystemURLRequestJobFactory); 111 "filesystem", &FileSystemURLRequestJobFactory);
(...skipping 15 matching lines...) Expand all
127 delegate_.reset(new TestDelegate()); 127 delegate_.reset(new TestDelegate());
128 // Make delegate_ exit the MessageLoop when the request is done. 128 // Make delegate_ exit the MessageLoop when the request is done.
129 delegate_->set_quit_on_complete(true); 129 delegate_->set_quit_on_complete(true);
130 delegate_->set_quit_on_redirect(true); 130 delegate_->set_quit_on_redirect(true);
131 request_.reset(new net::URLRequest(url, delegate_.get())); 131 request_.reset(new net::URLRequest(url, delegate_.get()));
132 if (headers) 132 if (headers)
133 request_->SetExtraRequestHeaders(*headers); 133 request_->SetExtraRequestHeaders(*headers);
134 job_ = new FileSystemURLRequestJob( 134 job_ = new FileSystemURLRequestJob(
135 request_.get(), 135 request_.get(),
136 file_system_context_.get(), 136 file_system_context_.get(),
137 base::MessageLoopProxy::CreateForCurrentThread()); 137 base::MessageLoopProxy::current());
138 138
139 request_->Start(); 139 request_->Start();
140 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async 140 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async
141 if (run_to_completion) 141 if (run_to_completion)
142 MessageLoop::current()->Run(); 142 MessageLoop::current()->Run();
143 } 143 }
144 144
145 void TestRequest(const GURL& url) { 145 void TestRequest(const GURL& url) {
146 TestRequestHelper(url, NULL, true); 146 TestRequestHelper(url, NULL, true);
147 } 147 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 383
384 TestRequest(CreateFileSystemURL(kFilename)); 384 TestRequest(CreateFileSystemURL(kFilename));
385 385
386 std::string mime_type_from_job; 386 std::string mime_type_from_job;
387 request_->GetMimeType(&mime_type_from_job); 387 request_->GetMimeType(&mime_type_from_job);
388 EXPECT_EQ(mime_type_direct, mime_type_from_job); 388 EXPECT_EQ(mime_type_direct, mime_type_from_job);
389 } 389 }
390 390
391 } // namespace (anonymous) 391 } // namespace (anonymous)
392 } // namespace fileapi 392 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_test_helper.cc ('k') | webkit/fileapi/file_writer_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698