OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <deque> | 5 #include <deque> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" | 14 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" |
15 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" | 15 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" |
16 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" | 16 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" |
17 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" | 17 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "webkit/common/fileapi/file_system_util.h" | 19 #include "storage/common/fileapi/file_system_util.h" |
20 | 20 |
21 #define MAKE_PATH(path) \ | 21 #define MAKE_PATH(path) \ |
22 base::FilePath(fileapi::VirtualPath::GetNormalizedFilePath( \ | 22 base::FilePath(storage::VirtualPath::GetNormalizedFilePath( \ |
23 base::FilePath(FILE_PATH_LITERAL(path)))) | 23 base::FilePath(FILE_PATH_LITERAL(path)))) |
24 | 24 |
25 namespace sync_file_system { | 25 namespace sync_file_system { |
26 namespace drive_backend { | 26 namespace drive_backend { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 void DumbTask(SyncStatusCode status, | 30 void DumbTask(SyncStatusCode status, |
31 const SyncStatusCallback& callback) { | 31 const SyncStatusCallback& callback) { |
32 base::MessageLoop::current()->PostTask( | 32 base::MessageLoop::current()->PostTask( |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 | 262 |
263 std::string updating_to = paths_.front(); | 263 std::string updating_to = paths_.front(); |
264 paths_.pop_front(); | 264 paths_.pop_front(); |
265 | 265 |
266 log_->push_back(name_ + ": updating to " + updating_to); | 266 log_->push_back(name_ + ": updating to " + updating_to); |
267 | 267 |
268 scoped_ptr<BlockingFactor> blocking_factor(new BlockingFactor); | 268 scoped_ptr<BlockingFactor> blocking_factor(new BlockingFactor); |
269 blocking_factor->app_id = app_id_; | 269 blocking_factor->app_id = app_id_; |
270 blocking_factor->paths.push_back( | 270 blocking_factor->paths.push_back( |
271 base::FilePath(fileapi::VirtualPath::GetNormalizedFilePath( | 271 base::FilePath(storage::VirtualPath::GetNormalizedFilePath( |
272 base::FilePath::FromUTF8Unsafe(updating_to)))); | 272 base::FilePath::FromUTF8Unsafe(updating_to)))); |
273 | 273 |
274 SyncTaskManager::UpdateBlockingFactor( | 274 SyncTaskManager::UpdateBlockingFactor( |
275 token.Pass(), blocking_factor.Pass(), | 275 token.Pass(), blocking_factor.Pass(), |
276 base::Bind(&BlockerUpdateTestHelper::UpdateBlockerSoon, | 276 base::Bind(&BlockerUpdateTestHelper::UpdateBlockerSoon, |
277 weak_ptr_factory_.GetWeakPtr(), | 277 weak_ptr_factory_.GetWeakPtr(), |
278 updating_to)); | 278 updating_to)); |
279 } | 279 } |
280 | 280 |
281 void UpdateBlockerSoon(const std::string& updated_to, | 281 void UpdateBlockerSoon(const std::string& updated_to, |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 | 667 |
668 EXPECT_EQ("task1: finished", log[i++]); | 668 EXPECT_EQ("task1: finished", log[i++]); |
669 | 669 |
670 EXPECT_EQ("task2: updating to /hoge/fuga/piyo", log[i++]); | 670 EXPECT_EQ("task2: updating to /hoge/fuga/piyo", log[i++]); |
671 EXPECT_EQ("task2: updated to /hoge/fuga/piyo", log[i++]); | 671 EXPECT_EQ("task2: updated to /hoge/fuga/piyo", log[i++]); |
672 EXPECT_EQ("task2: finished", log[i++]); | 672 EXPECT_EQ("task2: finished", log[i++]); |
673 } | 673 } |
674 | 674 |
675 } // namespace drive_backend | 675 } // namespace drive_backend |
676 } // namespace sync_file_system | 676 } // namespace sync_file_system |
OLD | NEW |