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

Side by Side Diff: net/disk_cache/disk_cache_test_base.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 | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/disk_cache_test_util.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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 #include "net/disk_cache/disk_cache_test_base.h" 5 #include "net/disk_cache/disk_cache_test_base.h"
6 6
7 #include "net/base/io_buffer.h" 7 #include "net/base/io_buffer.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/test_completion_callback.h" 9 #include "net/base/test_completion_callback.h"
10 #include "net/disk_cache/backend_impl.h" 10 #include "net/disk_cache/backend_impl.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 if (!cache_thread_.IsRunning()) { 243 if (!cache_thread_.IsRunning()) {
244 EXPECT_TRUE(cache_thread_.StartWithOptions( 244 EXPECT_TRUE(cache_thread_.StartWithOptions(
245 base::Thread::Options(MessageLoop::TYPE_IO, 0))); 245 base::Thread::Options(MessageLoop::TYPE_IO, 0)));
246 } 246 }
247 ASSERT_TRUE(cache_thread_.message_loop() != NULL); 247 ASSERT_TRUE(cache_thread_.message_loop() != NULL);
248 248
249 if (implementation_) 249 if (implementation_)
250 return InitDiskCacheImpl(path); 250 return InitDiskCacheImpl(path);
251 251
252 scoped_refptr<base::MessageLoopProxy> thread = 252 scoped_refptr<base::MessageLoopProxy> thread =
253 use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() : 253 use_current_thread_ ? base::MessageLoopProxy::current() :
254 cache_thread_.message_loop_proxy(); 254 cache_thread_.message_loop_proxy();
255 255
256 TestCompletionCallback cb; 256 TestCompletionCallback cb;
257 int rv = disk_cache::BackendImpl::CreateBackend( 257 int rv = disk_cache::BackendImpl::CreateBackend(
258 path, force_creation_, size_, type_, 258 path, force_creation_, size_, type_,
259 disk_cache::kNoRandom, thread, NULL, &cache_, &cb); 259 disk_cache::kNoRandom, thread, NULL, &cache_, &cb);
260 ASSERT_EQ(net::OK, cb.GetResult(rv)); 260 ASSERT_EQ(net::OK, cb.GetResult(rv));
261 } 261 }
262 262
263 void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) { 263 void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) {
264 scoped_refptr<base::MessageLoopProxy> thread = 264 scoped_refptr<base::MessageLoopProxy> thread =
265 use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() : 265 use_current_thread_ ? base::MessageLoopProxy::current() :
266 cache_thread_.message_loop_proxy(); 266 cache_thread_.message_loop_proxy();
267 if (mask_) 267 if (mask_)
268 cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread, NULL); 268 cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread, NULL);
269 else 269 else
270 cache_impl_ = new disk_cache::BackendImpl(path, thread, NULL); 270 cache_impl_ = new disk_cache::BackendImpl(path, thread, NULL);
271 271
272 cache_ = cache_impl_; 272 cache_ = cache_impl_;
273 ASSERT_TRUE(NULL != cache_); 273 ASSERT_TRUE(NULL != cache_);
274 274
275 if (size_) 275 if (size_)
276 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); 276 EXPECT_TRUE(cache_impl_->SetMaxSize(size_));
277 277
278 if (new_eviction_) 278 if (new_eviction_)
279 cache_impl_->SetNewEviction(); 279 cache_impl_->SetNewEviction();
280 280
281 cache_impl_->SetType(type_); 281 cache_impl_->SetType(type_);
282 cache_impl_->SetFlags(disk_cache::kNoRandom); 282 cache_impl_->SetFlags(disk_cache::kNoRandom);
283 TestCompletionCallback cb; 283 TestCompletionCallback cb;
284 int rv = cache_impl_->Init(&cb); 284 int rv = cache_impl_->Init(&cb);
285 ASSERT_EQ(net::OK, cb.GetResult(rv)); 285 ASSERT_EQ(net::OK, cb.GetResult(rv));
286 } 286 }
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/disk_cache_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698