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

Unified Diff: chrome/browser/chromeos/gdata/gdata.h

Issue 9582037: Make document service an interface (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding mock for DocumentsService Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/gdata/gdata.h
diff --git a/chrome/browser/chromeos/gdata/gdata.h b/chrome/browser/chromeos/gdata/gdata.h
index 96fa5bac6dad3fb256de0d5767c50eb4f3f6ccd9..7a611860de2a1f732810231fe4bc1173c91da9ea 100644
--- a/chrome/browser/chromeos/gdata/gdata.h
+++ b/chrome/browser/chromeos/gdata/gdata.h
@@ -183,8 +183,67 @@ class GDataAuthService : public content::NotificationObserver {
DISALLOW_COPY_AND_ASSIGN(GDataAuthService);
};
+// This defines an interface for sharing by DocumentService and
+// MockDocumentService so that we can do testing of clients of DocumentService.
+class DocumentsServiceInterface {
+ public:
+ DocumentsServiceInterface();
+ virtual ~DocumentsServiceInterface();
+
+ // Initializes the documents service tied with |profile|.
+ virtual void Initialize(Profile* profile) = 0;
+
+ // Cancels all in-flight operations.
+ virtual void CancelAll() = 0;
+
+ // needed. |callback| will be run with the error code and the auth
zel 2012/03/08 00:02:03 bad cat and paste, make sure this matches the corr
Greg Spencer (Chromium) 2012/03/08 01:10:39 Done.
+ // token, on the thread this function is run.
+ virtual void Authenticate(const AuthStatusCallback& callback) = 0;
+
+ // Gets the document feed from |feed_url|. If this URL is empty, the
+ // call will fetch the default ('root') document feed. Upon
+ // completion, invokes |callback| with results.
+ virtual void GetDocuments(const GURL& feed_url,
+ const GetDataCallback& callback) = 0;
+
+ // Delete a document identified by its 'self' |url| and |etag|.
+ // Upon completion, invokes |callback| with results.
+ virtual void DeleteDocument(const GURL& document_url,
+ const EntryActionCallback& callback) = 0;
+
+ // Downloads a document identified by its |content_url| in a given
+ // |format|. Upon completion, invokes |callback| with results.
+ virtual void DownloadDocument(const GURL& content_url,
+ DocumentExportFormat format,
+ const DownloadActionCallback& callback) = 0;
+
+ // Creates new collection with |directory_name| under parent
+ // directory identified with |parent_content_url|. If
+ // |parent_content_url| is empty, the new collection will be created
+ // in the root. Upon completion, invokes |callback| and passes newly
+ // created entry.
+ virtual void CreateDirectory(const GURL& parent_content_url,
+ const FilePath::StringType& directory_name,
+ const GetDataCallback& callback) = 0;
+
+ // Downloads a file identified by its |content_url|. Upon
+ // completion, invokes |callback| with results.
+ virtual void DownloadFile(const GURL& content_url,
+ const DownloadActionCallback& callback) = 0;
+
+ // Initiate uploading of a document/file.
+ virtual void InitiateUpload(const InitiateUploadParams& upload_file_info,
+ const InitiateUploadCallback& callback) = 0;
+
+ // Resume uploading of a document/file.
+ virtual void ResumeUpload(const ResumeUploadParams& upload_file_info,
+ const ResumeUploadCallback& callback) = 0;
+};
+
// This class provides documents feed service calls.
-class DocumentsService : public GDataAuthService::Observer {
+class DocumentsService
+ : public DocumentsServiceInterface,
+ public GDataAuthService::Observer {
public:
// DocumentsService is usually owned and created by GDataFileSystem.
DocumentsService();
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata.cc » ('j') | chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698