BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / sync_file_system / drive_backend / fake_drive_uploader.h
blobda79223cf359382830ac0affd25ad97bf8cd6a23
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_DRIVE_UPLOADER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_DRIVE_UPLOADER_H_
8 #include <string>
10 #include "base/files/file_util.h"
11 #include "base/strings/stringprintf.h"
12 #include "base/values.h"
13 #include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.h"
14 #include "components/drive/drive_uploader.h"
15 #include "components/drive/service/fake_drive_service.h"
16 #include "google_apis/drive/drive_api_error_codes.h"
17 #include "google_apis/drive/test_util.h"
18 #include "net/base/escape.h"
20 namespace sync_file_system {
21 namespace drive_backend {
23 class FakeDriveServiceWrapper : public drive::FakeDriveService {
24 public:
25 FakeDriveServiceWrapper();
26 ~FakeDriveServiceWrapper() override;
28 // DriveServiceInterface overrides.
29 google_apis::CancelCallback AddNewDirectory(
30 const std::string& parent_resource_id,
31 const std::string& directory_name,
32 const drive::AddNewDirectoryOptions& options,
33 const google_apis::FileResourceCallback& callback) override;
35 void set_make_directory_conflict(bool enable) {
36 make_directory_conflict_ = enable;
39 private:
40 bool make_directory_conflict_;
42 DISALLOW_COPY_AND_ASSIGN(FakeDriveServiceWrapper);
45 // A fake implementation of DriveUploaderInterface, which provides fake
46 // behaviors for file uploading.
47 class FakeDriveUploader : public drive::DriveUploaderInterface {
48 public:
49 explicit FakeDriveUploader(FakeDriveServiceWrapper* fake_drive_service);
50 ~FakeDriveUploader() override;
52 // DriveUploaderInterface overrides.
53 void StartBatchProcessing() override;
54 void StopBatchProcessing() override;
55 google_apis::CancelCallback UploadNewFile(
56 const std::string& parent_resource_id,
57 const base::FilePath& local_file_path,
58 const std::string& title,
59 const std::string& content_type,
60 const drive::UploadNewFileOptions& options,
61 const drive::UploadCompletionCallback& callback,
62 const google_apis::ProgressCallback& progress_callback) override;
63 google_apis::CancelCallback UploadExistingFile(
64 const std::string& resource_id,
65 const base::FilePath& local_file_path,
66 const std::string& content_type,
67 const drive::UploadExistingFileOptions& options,
68 const drive::UploadCompletionCallback& callback,
69 const google_apis::ProgressCallback& progress_callback) override;
70 google_apis::CancelCallback ResumeUploadFile(
71 const GURL& upload_location,
72 const base::FilePath& local_file_path,
73 const std::string& content_type,
74 const drive::UploadCompletionCallback& callback,
75 const google_apis::ProgressCallback& progress_callback) override;
77 void set_make_file_conflict(bool enable) {
78 make_file_conflict_ = enable;
81 private:
82 FakeDriveServiceWrapper* fake_drive_service_;
83 bool make_file_conflict_;
85 DISALLOW_COPY_AND_ASSIGN(FakeDriveUploader);
88 } // namespace drive_backend
89 } // namespace sync_file_system
91 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_DRIVE_UPLOADER_H_