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

Side by Side Diff: chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc

Issue 363373003: Replace MessageLoopProxy::current() with ThreadTaskRunnerHandle::Get() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/thread_task_runner_handle.h"
13 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" 14 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h"
14 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" 15 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h"
15 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" 16 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
16 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" 17 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
17 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" 18 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
18 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h " 19 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h "
19 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h " 20 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h "
20 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" 21 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
21 #include "content/public/test/mock_blob_url_request_context.h" 22 #include "content/public/test/mock_blob_url_request_context.h"
22 #include "content/public/test/test_browser_thread_bundle.h" 23 #include "content/public/test/test_browser_thread_bundle.h"
(...skipping 23 matching lines...) Expand all
46 protected: 47 protected:
47 typedef FileSystemOperation::StatusCallback StatusCallback; 48 typedef FileSystemOperation::StatusCallback StatusCallback;
48 49
49 // Use the current thread as IO thread so that we can directly call 50 // Use the current thread as IO thread so that we can directly call
50 // operations in the tests. 51 // operations in the tests.
51 SyncableFileOperationRunnerTest() 52 SyncableFileOperationRunnerTest()
52 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 53 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
53 in_memory_env_(leveldb::NewMemEnv(leveldb::Env::Default())), 54 in_memory_env_(leveldb::NewMemEnv(leveldb::Env::Default())),
54 file_system_(GURL("http://example.com"), 55 file_system_(GURL("http://example.com"),
55 in_memory_env_.get(), 56 in_memory_env_.get(),
56 base::MessageLoopProxy::current().get(), 57 base::ThreadTaskRunnerHandle::Get().get(),
57 base::MessageLoopProxy::current().get()), 58 base::ThreadTaskRunnerHandle::Get().get()),
58 callback_count_(0), 59 callback_count_(0),
59 write_status_(File::FILE_ERROR_FAILED), 60 write_status_(File::FILE_ERROR_FAILED),
60 write_bytes_(0), 61 write_bytes_(0),
61 write_complete_(false), 62 write_complete_(false),
62 url_request_context_(file_system_.file_system_context()), 63 url_request_context_(file_system_.file_system_context()),
63 weak_factory_(this) {} 64 weak_factory_(this) {}
64 65
65 virtual void SetUp() OVERRIDE { 66 virtual void SetUp() OVERRIDE {
66 ASSERT_TRUE(dir_.CreateUniqueTempDir()); 67 ASSERT_TRUE(dir_.CreateUniqueTempDir());
67 68
68 file_system_.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); 69 file_system_.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED);
69 sync_context_ = new LocalFileSyncContext( 70 sync_context_ = new LocalFileSyncContext(
70 dir_.path(), 71 dir_.path(),
71 in_memory_env_.get(), 72 in_memory_env_.get(),
72 base::MessageLoopProxy::current().get(), 73 base::ThreadTaskRunnerHandle::Get().get(),
73 base::MessageLoopProxy::current().get()); 74 base::ThreadTaskRunnerHandle::Get().get());
74 ASSERT_EQ( 75 ASSERT_EQ(
75 SYNC_STATUS_OK, 76 SYNC_STATUS_OK,
76 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); 77 file_system_.MaybeInitializeFileSystemContext(sync_context_.get()));
77 78
78 ASSERT_EQ(File::FILE_OK, file_system_.OpenFileSystem()); 79 ASSERT_EQ(File::FILE_OK, file_system_.OpenFileSystem());
79 ASSERT_EQ(File::FILE_OK, 80 ASSERT_EQ(File::FILE_OK,
80 file_system_.CreateDirectory(URL(kParent))); 81 file_system_.CreateDirectory(URL(kParent)));
81 } 82 }
82 83
83 virtual void TearDown() OVERRIDE { 84 virtual void TearDown() OVERRIDE {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 file_system_.operation_runner()->Truncate( 400 file_system_.operation_runner()->Truncate(
400 URL(kFile), 10, 401 URL(kFile), 10,
401 ExpectStatus(FROM_HERE, File::FILE_OK)); 402 ExpectStatus(FROM_HERE, File::FILE_OK));
402 file_system_.operation_runner()->Cancel( 403 file_system_.operation_runner()->Cancel(
403 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); 404 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION));
404 base::MessageLoop::current()->RunUntilIdle(); 405 base::MessageLoop::current()->RunUntilIdle();
405 EXPECT_EQ(2, callback_count_); 406 EXPECT_EQ(2, callback_count_);
406 } 407 }
407 408
408 } // namespace sync_file_system 409 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698