| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <stack> | 6 #include <stack> |
| 7 | 7 |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/sync_file_system/drive_backend/sync_worker.h" | 22 #include "chrome/browser/sync_file_system/drive_backend/sync_worker.h" |
| 23 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 23 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
| 24 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 24 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 25 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" | 25 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" |
| 26 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 26 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 27 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" | 27 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" |
| 28 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 28 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 29 #include "chrome/test/base/testing_profile.h" | 29 #include "chrome/test/base/testing_profile.h" |
| 30 #include "content/public/test/test_browser_thread.h" | 30 #include "content/public/test/test_browser_thread.h" |
| 31 #include "content/public/test/test_browser_thread_bundle.h" | 31 #include "content/public/test/test_browser_thread_bundle.h" |
| 32 #include "content/public/test/test_utils.h" |
| 32 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
| 33 #include "google_apis/drive/drive_api_parser.h" | 34 #include "google_apis/drive/drive_api_parser.h" |
| 34 #include "net/url_request/url_request_context_getter.h" | 35 #include "net/url_request/url_request_context_getter.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 37 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
| 37 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 38 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
| 38 #include "webkit/browser/fileapi/file_system_context.h" | 39 #include "webkit/browser/fileapi/file_system_context.h" |
| 39 | 40 |
| 40 #define FPL(a) FILE_PATH_LITERAL(a) | 41 #define FPL(a) FILE_PATH_LITERAL(a) |
| 41 | 42 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 delete itr->second; | 146 delete itr->second; |
| 146 } | 147 } |
| 147 file_systems_.clear(); | 148 file_systems_.clear(); |
| 148 | 149 |
| 149 local_sync_service_->Shutdown(); | 150 local_sync_service_->Shutdown(); |
| 150 | 151 |
| 151 fake_drive_service_helper_.reset(); | 152 fake_drive_service_helper_.reset(); |
| 152 local_sync_service_.reset(); | 153 local_sync_service_.reset(); |
| 153 remote_sync_service_.reset(); | 154 remote_sync_service_.reset(); |
| 154 | 155 |
| 155 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 156 content::RunAllBlockingPoolTasksUntilIdle(); |
| 156 base::RunLoop().RunUntilIdle(); | |
| 157 RevokeSyncableFileSystem(); | 157 RevokeSyncableFileSystem(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 virtual void OnRemoteChangeQueueUpdated(int64 pending_changes_hint) OVERRIDE { | 160 virtual void OnRemoteChangeQueueUpdated(int64 pending_changes_hint) OVERRIDE { |
| 161 pending_remote_changes_ = pending_changes_hint; | 161 pending_remote_changes_ = pending_changes_hint; |
| 162 } | 162 } |
| 163 | 163 |
| 164 virtual void OnLocalChangeAvailable(int64 pending_changes_hint) OVERRIDE { | 164 virtual void OnLocalChangeAvailable(int64 pending_changes_hint) OVERRIDE { |
| 165 pending_local_changes_ = pending_changes_hint; | 165 pending_local_changes_ = pending_changes_hint; |
| 166 } | 166 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 return local_sync_status; | 352 return local_sync_status; |
| 353 | 353 |
| 354 remote_sync_status = ProcessRemoteChange(); | 354 remote_sync_status = ProcessRemoteChange(); |
| 355 if (remote_sync_status != SYNC_STATUS_OK && | 355 if (remote_sync_status != SYNC_STATUS_OK && |
| 356 remote_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC && | 356 remote_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC && |
| 357 remote_sync_status != SYNC_STATUS_FILE_BUSY) | 357 remote_sync_status != SYNC_STATUS_FILE_BUSY) |
| 358 return remote_sync_status; | 358 return remote_sync_status; |
| 359 | 359 |
| 360 if (local_sync_status == SYNC_STATUS_NO_CHANGE_TO_SYNC && | 360 if (local_sync_status == SYNC_STATUS_NO_CHANGE_TO_SYNC && |
| 361 remote_sync_status == SYNC_STATUS_NO_CHANGE_TO_SYNC) { | 361 remote_sync_status == SYNC_STATUS_NO_CHANGE_TO_SYNC) { |
| 362 | |
| 363 { | 362 { |
| 364 base::RunLoop run_loop; | 363 base::RunLoop run_loop; |
| 365 remote_sync_service_->PromoteDemotedChanges(run_loop.QuitClosure()); | 364 remote_sync_service_->PromoteDemotedChanges(run_loop.QuitClosure()); |
| 366 run_loop.Run(); | 365 run_loop.Run(); |
| 367 } | 366 } |
| 368 | 367 |
| 369 { | 368 { |
| 370 base::RunLoop run_loop; | 369 base::RunLoop run_loop; |
| 371 local_sync_service_->PromoteDemotedChanges(run_loop.QuitClosure()); | 370 local_sync_service_->PromoteDemotedChanges(run_loop.QuitClosure()); |
| 372 run_loop.Run(); | 371 run_loop.Run(); |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1722 | 1721 |
| 1723 EXPECT_EQ(1u, CountApp()); | 1722 EXPECT_EQ(1u, CountApp()); |
| 1724 EXPECT_EQ(1u, CountLocalFile(app_id)); | 1723 EXPECT_EQ(1u, CountLocalFile(app_id)); |
| 1725 | 1724 |
| 1726 EXPECT_EQ(2u, CountMetadata()); | 1725 EXPECT_EQ(2u, CountMetadata()); |
| 1727 EXPECT_EQ(2u, CountTracker()); | 1726 EXPECT_EQ(2u, CountTracker()); |
| 1728 } | 1727 } |
| 1729 | 1728 |
| 1730 } // namespace drive_backend | 1729 } // namespace drive_backend |
| 1731 } // namespace sync_file_system | 1730 } // namespace sync_file_system |
| OLD | NEW |