Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc

Issue 881403003: Rename gdata_errorcode.h to drive_api_error_codes.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos in BUILD.gn Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 const std::string& resource_id, 167 const std::string& resource_id,
168 const std::string& last_modified, 168 const std::string& last_modified,
169 const std::string& last_viewed_by_me) { 169 const std::string& last_viewed_by_me) {
170 base::Time last_modified_time, last_viewed_by_me_time; 170 base::Time last_modified_time, last_viewed_by_me_time;
171 if (!google_apis::util::GetTimeFromString(last_modified, 171 if (!google_apis::util::GetTimeFromString(last_modified,
172 &last_modified_time) || 172 &last_modified_time) ||
173 !google_apis::util::GetTimeFromString(last_viewed_by_me, 173 !google_apis::util::GetTimeFromString(last_viewed_by_me,
174 &last_viewed_by_me_time)) 174 &last_viewed_by_me_time))
175 return scoped_ptr<google_apis::FileResource>(); 175 return scoped_ptr<google_apis::FileResource>();
176 176
177 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 177 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
178 scoped_ptr<google_apis::FileResource> entry; 178 scoped_ptr<google_apis::FileResource> entry;
179 fake_drive_service->UpdateResource( 179 fake_drive_service->UpdateResource(
180 resource_id, 180 resource_id,
181 std::string(), // parent_resource_id 181 std::string(), // parent_resource_id
182 std::string(), // title 182 std::string(), // title
183 last_modified_time, 183 last_modified_time,
184 last_viewed_by_me_time, 184 last_viewed_by_me_time,
185 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 185 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
186 base::RunLoop().RunUntilIdle(); 186 base::RunLoop().RunUntilIdle();
187 if (error != google_apis::HTTP_SUCCESS) 187 if (error != google_apis::HTTP_SUCCESS)
188 return scoped_ptr<google_apis::FileResource>(); 188 return scoped_ptr<google_apis::FileResource>();
189 189
190 return entry.Pass(); 190 return entry.Pass();
191 } 191 }
192 192
193 scoped_ptr<google_apis::FileResource> AddFileToDriveService( 193 scoped_ptr<google_apis::FileResource> AddFileToDriveService(
194 drive::FakeDriveService* fake_drive_service, 194 drive::FakeDriveService* fake_drive_service,
195 const std::string& mime_type, 195 const std::string& mime_type,
196 const std::string& content, 196 const std::string& content,
197 const std::string& parent_resource_id, 197 const std::string& parent_resource_id,
198 const std::string& title, 198 const std::string& title,
199 const std::string& last_modified, 199 const std::string& last_modified,
200 const std::string& last_viewed_by_me) { 200 const std::string& last_viewed_by_me) {
201 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 201 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
202 scoped_ptr<google_apis::FileResource> entry; 202 scoped_ptr<google_apis::FileResource> entry;
203 fake_drive_service->AddNewFile( 203 fake_drive_service->AddNewFile(
204 mime_type, 204 mime_type,
205 content, 205 content,
206 parent_resource_id, 206 parent_resource_id,
207 title, 207 title,
208 false, // shared_with_me 208 false, // shared_with_me
209 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 209 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
210 base::RunLoop().RunUntilIdle(); 210 base::RunLoop().RunUntilIdle();
211 if (error != google_apis::HTTP_CREATED) 211 if (error != google_apis::HTTP_CREATED)
212 return scoped_ptr<google_apis::FileResource>(); 212 return scoped_ptr<google_apis::FileResource>();
213 213
214 return UpdateDriveEntryTime(fake_drive_service, entry->file_id(), 214 return UpdateDriveEntryTime(fake_drive_service, entry->file_id(),
215 last_modified, last_viewed_by_me); 215 last_modified, last_viewed_by_me);
216 } 216 }
217 217
218 scoped_ptr<google_apis::FileResource> AddDirectoryToDriveService( 218 scoped_ptr<google_apis::FileResource> AddDirectoryToDriveService(
219 drive::FakeDriveService* fake_drive_service, 219 drive::FakeDriveService* fake_drive_service,
220 const std::string& parent_resource_id, 220 const std::string& parent_resource_id,
221 const std::string& title, 221 const std::string& title,
222 const std::string& last_modified, 222 const std::string& last_modified,
223 const std::string& last_viewed_by_me) { 223 const std::string& last_viewed_by_me) {
224 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 224 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
225 scoped_ptr<google_apis::FileResource> entry; 225 scoped_ptr<google_apis::FileResource> entry;
226 fake_drive_service->AddNewDirectory( 226 fake_drive_service->AddNewDirectory(
227 parent_resource_id, 227 parent_resource_id,
228 title, 228 title,
229 drive::DriveServiceInterface::AddNewDirectoryOptions(), 229 drive::DriveServiceInterface::AddNewDirectoryOptions(),
230 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 230 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
231 base::RunLoop().RunUntilIdle(); 231 base::RunLoop().RunUntilIdle();
232 if (error != google_apis::HTTP_CREATED) 232 if (error != google_apis::HTTP_CREATED)
233 return scoped_ptr<google_apis::FileResource>(); 233 return scoped_ptr<google_apis::FileResource>();
234 234
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 bool AddTestHostedDocuments() { 604 bool AddTestHostedDocuments() {
605 const char kResourceId[] = "unique-id-for-multiprofile-copy-test"; 605 const char kResourceId[] = "unique-id-for-multiprofile-copy-test";
606 drive::FakeDriveService* const main_service = 606 drive::FakeDriveService* const main_service =
607 static_cast<drive::FakeDriveService*>( 607 static_cast<drive::FakeDriveService*>(
608 drive::util::GetDriveServiceByProfile(browser()->profile())); 608 drive::util::GetDriveServiceByProfile(browser()->profile()));
609 drive::FakeDriveService* const sub_service = 609 drive::FakeDriveService* const sub_service =
610 static_cast<drive::FakeDriveService*>( 610 static_cast<drive::FakeDriveService*>(
611 drive::util::GetDriveServiceByProfile(second_profile)); 611 drive::util::GetDriveServiceByProfile(second_profile));
612 612
613 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 613 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
614 scoped_ptr<google_apis::FileResource> entry; 614 scoped_ptr<google_apis::FileResource> entry;
615 615
616 // Place a hosted document under root/test_dir of the sub profile. 616 // Place a hosted document under root/test_dir of the sub profile.
617 sub_service->AddNewFileWithResourceId( 617 sub_service->AddNewFileWithResourceId(
618 kResourceId, 618 kResourceId,
619 "application/vnd.google-apps.document", "", 619 "application/vnd.google-apps.document", "",
620 resource_ids_["test_dir"], "hosted_doc", true, 620 resource_ids_["test_dir"], "hosted_doc", true,
621 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 621 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
622 content::RunAllBlockingPoolTasksUntilIdle(); 622 content::RunAllBlockingPoolTasksUntilIdle();
623 if (error != google_apis::HTTP_CREATED) 623 if (error != google_apis::HTTP_CREATED)
624 return false; 624 return false;
625 625
626 // Place the hosted document with no parent in the main profile, for 626 // Place the hosted document with no parent in the main profile, for
627 // simulating the situation that the document is shared to the main profile. 627 // simulating the situation that the document is shared to the main profile.
628 error = google_apis::GDATA_OTHER_ERROR; 628 error = google_apis::DRIVE_OTHER_ERROR;
629 main_service->AddNewFileWithResourceId( 629 main_service->AddNewFileWithResourceId(
630 kResourceId, 630 kResourceId,
631 "application/vnd.google-apps.document", "", "", "hosted_doc", true, 631 "application/vnd.google-apps.document", "", "", "hosted_doc", true,
632 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 632 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
633 content::RunAllBlockingPoolTasksUntilIdle(); 633 content::RunAllBlockingPoolTasksUntilIdle();
634 return (error == google_apis::HTTP_CREATED); 634 return (error == google_apis::HTTP_CREATED);
635 } 635 }
636 636
637 DriveIntegrationServiceFactory::FactoryCallback 637 DriveIntegrationServiceFactory::FactoryCallback
638 create_drive_integration_service_; 638 create_drive_integration_service_;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 AppFileHandlerMulti) { 843 AppFileHandlerMulti) {
844 EXPECT_TRUE( 844 EXPECT_TRUE(
845 RunFileSystemExtensionApiTest("file_browser/app_file_handler_multi", 845 RunFileSystemExtensionApiTest("file_browser/app_file_handler_multi",
846 FILE_PATH_LITERAL("manifest.json"), 846 FILE_PATH_LITERAL("manifest.json"),
847 "", 847 "",
848 FLAGS_NONE)) 848 FLAGS_NONE))
849 << message_; 849 << message_;
850 } 850 }
851 } // namespace 851 } // namespace
852 } // namespace file_manager 852 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698