| 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 "chrome/browser/chromeos/drive/file_system.h" | 5 #include "chrome/browser/chromeos/drive/file_system.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/message_loop/message_loop_proxy.h" | 15 #include "base/message_loop/message_loop_proxy.h" |
| 16 #include "base/prefs/testing_pref_service.h" | 16 #include "base/prefs/testing_pref_service.h" |
| 17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 18 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
| 19 #include "chrome/browser/chromeos/drive/change_list_processor.h" | |
| 20 #include "chrome/browser/chromeos/drive/drive.pb.h" | 19 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 21 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 20 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
| 22 #include "chrome/browser/chromeos/drive/file_system_observer.h" | 21 #include "chrome/browser/chromeos/drive/file_system_observer.h" |
| 23 #include "chrome/browser/chromeos/drive/file_system_util.h" | 22 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 24 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 23 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
| 25 #include "chrome/browser/chromeos/drive/sync_client.h" | 24 #include "chrome/browser/chromeos/drive/sync_client.h" |
| 26 #include "chrome/browser/chromeos/drive/test_util.h" | 25 #include "chrome/browser/chromeos/drive/test_util.h" |
| 27 #include "chrome/browser/drive/fake_drive_service.h" | 26 #include "chrome/browser/drive/fake_drive_service.h" |
| 28 #include "content/public/test/test_browser_thread_bundle.h" | 27 #include "content/public/test/test_browser_thread_bundle.h" |
| 29 #include "google_apis/drive/drive_api_parser.h" | 28 #include "google_apis/drive/drive_api_parser.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 file_system_->AddObserver(mock_directory_observer_.get()); | 130 file_system_->AddObserver(mock_directory_observer_.get()); |
| 132 | 131 |
| 133 // Disable delaying so that the sync starts immediately. | 132 // Disable delaying so that the sync starts immediately. |
| 134 file_system_->sync_client_for_testing()->set_delay_for_testing( | 133 file_system_->sync_client_for_testing()->set_delay_for_testing( |
| 135 base::TimeDelta::FromSeconds(0)); | 134 base::TimeDelta::FromSeconds(0)); |
| 136 } | 135 } |
| 137 | 136 |
| 138 // Loads the full resource list via FakeDriveService. | 137 // Loads the full resource list via FakeDriveService. |
| 139 bool LoadFullResourceList() { | 138 bool LoadFullResourceList() { |
| 140 FileError error = FILE_ERROR_FAILED; | 139 FileError error = FILE_ERROR_FAILED; |
| 141 file_system_->change_list_loader_for_testing()->LoadIfNeeded( | 140 file_system_->change_list_loader_for_testing()->LoadForTesting( |
| 142 internal::DirectoryFetchInfo(), | |
| 143 google_apis::test_util::CreateCopyResultCallback(&error)); | 141 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 144 test_util::RunBlockingPoolTask(); | 142 test_util::RunBlockingPoolTask(); |
| 145 return error == FILE_ERROR_OK; | 143 return error == FILE_ERROR_OK; |
| 146 } | 144 } |
| 147 | 145 |
| 148 // Gets resource entry by path synchronously. | 146 // Gets resource entry by path synchronously. |
| 149 scoped_ptr<ResourceEntry> GetResourceEntrySync( | 147 scoped_ptr<ResourceEntry> GetResourceEntrySync( |
| 150 const base::FilePath& file_path) { | 148 const base::FilePath& file_path) { |
| 151 FileError error = FILE_ERROR_FAILED; | 149 FileError error = FILE_ERROR_FAILED; |
| 152 scoped_ptr<ResourceEntry> entry; | 150 scoped_ptr<ResourceEntry> entry; |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 kEmbedOrigin, | 737 kEmbedOrigin, |
| 740 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); | 738 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); |
| 741 test_util::RunBlockingPoolTask(); | 739 test_util::RunBlockingPoolTask(); |
| 742 | 740 |
| 743 // Verify the error and the share url, which should be empty. | 741 // Verify the error and the share url, which should be empty. |
| 744 EXPECT_EQ(FILE_ERROR_FAILED, error); | 742 EXPECT_EQ(FILE_ERROR_FAILED, error); |
| 745 EXPECT_TRUE(share_url.is_empty()); | 743 EXPECT_TRUE(share_url.is_empty()); |
| 746 } | 744 } |
| 747 | 745 |
| 748 } // namespace drive | 746 } // namespace drive |
| OLD | NEW |