OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
peria
2014/07/04 05:36:44
Add #include "base/single_thread_task_runner.h" ?
tzik
2014/07/04 05:58:13
Done.
That was from run_loop.h.
| |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/thread_task_runner_handle.h" | |
12 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 13 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
13 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 14 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
14 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" | 15 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" |
15 #include "chrome/browser/sync_file_system/local/mock_sync_status_observer.h" | 16 #include "chrome/browser/sync_file_system/local/mock_sync_status_observer.h" |
16 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 17 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
17 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" | 18 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" |
18 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 19 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
19 #include "chrome/browser/sync_file_system/sync_event_observer.h" | 20 #include "chrome/browser/sync_file_system/sync_event_observer.h" |
20 #include "chrome/browser/sync_file_system/sync_file_metadata.h" | 21 #include "chrome/browser/sync_file_system/sync_file_metadata.h" |
21 #include "chrome/browser/sync_file_system/sync_file_system_service.h" | 22 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 void(const fileapi::FileSystemURL& url, | 93 void(const fileapi::FileSystemURL& url, |
93 SyncFileStatus status, | 94 SyncFileStatus status, |
94 SyncAction action, | 95 SyncAction action, |
95 SyncDirection direction)); | 96 SyncDirection direction)); |
96 }; | 97 }; |
97 | 98 |
98 ACTION_P3(NotifyStateAndCallback, | 99 ACTION_P3(NotifyStateAndCallback, |
99 mock_remote_service, service_state, operation_status) { | 100 mock_remote_service, service_state, operation_status) { |
100 mock_remote_service->NotifyRemoteServiceStateUpdated( | 101 mock_remote_service->NotifyRemoteServiceStateUpdated( |
101 service_state, "Test event."); | 102 service_state, "Test event."); |
102 base::MessageLoopProxy::current()->PostTask( | 103 base::ThreadTaskRunnerHandle::Get()->PostTask( |
103 FROM_HERE, base::Bind(arg1, operation_status)); | 104 FROM_HERE, base::Bind(arg1, operation_status)); |
104 } | 105 } |
105 | 106 |
106 ACTION_P(RecordState, states) { | 107 ACTION_P(RecordState, states) { |
107 states->push_back(arg1); | 108 states->push_back(arg1); |
108 } | 109 } |
109 | 110 |
110 ACTION_P(MockStatusCallback, status) { | 111 ACTION_P(MockStatusCallback, status) { |
111 base::MessageLoopProxy::current()->PostTask( | 112 base::ThreadTaskRunnerHandle::Get()->PostTask( |
112 FROM_HERE, base::Bind(arg4, status)); | 113 FROM_HERE, base::Bind(arg4, status)); |
113 } | 114 } |
114 | 115 |
115 ACTION_P2(MockSyncFileCallback, status, url) { | 116 ACTION_P2(MockSyncFileCallback, status, url) { |
116 base::MessageLoopProxy::current()->PostTask( | 117 base::ThreadTaskRunnerHandle::Get()->PostTask( |
117 FROM_HERE, base::Bind(arg0, status, url)); | 118 FROM_HERE, base::Bind(arg0, status, url)); |
118 } | 119 } |
119 | 120 |
120 class SyncFileSystemServiceTest : public testing::Test { | 121 class SyncFileSystemServiceTest : public testing::Test { |
121 protected: | 122 protected: |
122 SyncFileSystemServiceTest() | 123 SyncFileSystemServiceTest() |
123 : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD | | 124 : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD | |
124 content::TestBrowserThreadBundle::REAL_IO_THREAD) {} | 125 content::TestBrowserThreadBundle::REAL_IO_THREAD) {} |
125 | 126 |
126 virtual void SetUp() OVERRIDE { | 127 virtual void SetUp() OVERRIDE { |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 base::Bind(&AssignValueAndQuit<SyncFileStatus>, | 465 base::Bind(&AssignValueAndQuit<SyncFileStatus>, |
465 &run_loop, &status, &sync_file_status)); | 466 &run_loop, &status, &sync_file_status)); |
466 run_loop.Run(); | 467 run_loop.Run(); |
467 | 468 |
468 EXPECT_EQ(SYNC_STATUS_OK, status); | 469 EXPECT_EQ(SYNC_STATUS_OK, status); |
469 EXPECT_EQ(SYNC_FILE_STATUS_HAS_PENDING_CHANGES, sync_file_status); | 470 EXPECT_EQ(SYNC_FILE_STATUS_HAS_PENDING_CHANGES, sync_file_status); |
470 } | 471 } |
471 } | 472 } |
472 | 473 |
473 } // namespace sync_file_system | 474 } // namespace sync_file_system |
OLD | NEW |