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" |
19 #include "chrome/browser/chromeos/drive/drive.pb.h" | 20 #include "chrome/browser/chromeos/drive/drive.pb.h" |
20 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 21 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
21 #include "chrome/browser/chromeos/drive/file_system_observer.h" | 22 #include "chrome/browser/chromeos/drive/file_system_observer.h" |
22 #include "chrome/browser/chromeos/drive/file_system_util.h" | 23 #include "chrome/browser/chromeos/drive/file_system_util.h" |
23 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 24 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
24 #include "chrome/browser/chromeos/drive/sync_client.h" | 25 #include "chrome/browser/chromeos/drive/sync_client.h" |
25 #include "chrome/browser/chromeos/drive/test_util.h" | 26 #include "chrome/browser/chromeos/drive/test_util.h" |
26 #include "chrome/browser/drive/fake_drive_service.h" | 27 #include "chrome/browser/drive/fake_drive_service.h" |
27 #include "chrome/browser/google_apis/drive_api_parser.h" | 28 #include "chrome/browser/google_apis/drive_api_parser.h" |
28 #include "chrome/browser/google_apis/test_util.h" | 29 #include "chrome/browser/google_apis/test_util.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 file_system_->sync_client_for_testing()->set_delay_for_testing( | 144 file_system_->sync_client_for_testing()->set_delay_for_testing( |
144 base::TimeDelta::FromSeconds(0)); | 145 base::TimeDelta::FromSeconds(0)); |
145 | 146 |
146 ASSERT_EQ(FILE_ERROR_OK, resource_metadata_->Initialize()); | 147 ASSERT_EQ(FILE_ERROR_OK, resource_metadata_->Initialize()); |
147 } | 148 } |
148 | 149 |
149 // Loads the full resource list via FakeDriveService. | 150 // Loads the full resource list via FakeDriveService. |
150 bool LoadFullResourceList() { | 151 bool LoadFullResourceList() { |
151 FileError error = FILE_ERROR_FAILED; | 152 FileError error = FILE_ERROR_FAILED; |
152 file_system_->change_list_loader_for_testing()->LoadIfNeeded( | 153 file_system_->change_list_loader_for_testing()->LoadIfNeeded( |
153 DirectoryFetchInfo(), | 154 internal::DirectoryFetchInfo(), |
154 google_apis::test_util::CreateCopyResultCallback(&error)); | 155 google_apis::test_util::CreateCopyResultCallback(&error)); |
155 test_util::RunBlockingPoolTask(); | 156 test_util::RunBlockingPoolTask(); |
156 return error == FILE_ERROR_OK; | 157 return error == FILE_ERROR_OK; |
157 } | 158 } |
158 | 159 |
159 // Gets resource entry by path synchronously. | 160 // Gets resource entry by path synchronously. |
160 scoped_ptr<ResourceEntry> GetResourceEntryByPathSync( | 161 scoped_ptr<ResourceEntry> GetResourceEntryByPathSync( |
161 const base::FilePath& file_path) { | 162 const base::FilePath& file_path) { |
162 FileError error = FILE_ERROR_FAILED; | 163 FileError error = FILE_ERROR_FAILED; |
163 scoped_ptr<ResourceEntry> entry; | 164 scoped_ptr<ResourceEntry> entry; |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 kEmbedOrigin, | 879 kEmbedOrigin, |
879 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); | 880 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); |
880 test_util::RunBlockingPoolTask(); | 881 test_util::RunBlockingPoolTask(); |
881 | 882 |
882 // Verify the error and the share url, which should be empty. | 883 // Verify the error and the share url, which should be empty. |
883 EXPECT_EQ(FILE_ERROR_FAILED, error); | 884 EXPECT_EQ(FILE_ERROR_FAILED, error); |
884 EXPECT_TRUE(share_url.is_empty()); | 885 EXPECT_TRUE(share_url.is_empty()); |
885 } | 886 } |
886 | 887 |
887 } // namespace drive | 888 } // namespace drive |
OLD | NEW |