| 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 // This file contains mocks for classes in gdata_documents_service.h | 5 // This file contains mocks for classes in gdata_documents_service.h |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_MOCK_GDATA_DOCUMENTS_SERVICE_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_MOCK_DOCUMENTS_SERVICE_H_ |
| 8 #define CHROME_BROWSER_CHROMEOS_GDATA_MOCK_GDATA_DOCUMENTS_SERVICE_H_ | 8 #define CHROME_BROWSER_CHROMEOS_GDATA_MOCK_DOCUMENTS_SERVICE_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" | 14 #include "chrome/browser/chromeos/gdata/documents_service_interface.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 | 16 |
| 17 class FilePath; | 17 class FilePath; |
| 18 | 18 |
| 19 namespace gdata { | 19 namespace gdata { |
| 20 | 20 |
| 21 class MockDocumentsService : public DocumentsServiceInterface { | 21 class MockDocumentsService : public DocumentsServiceInterface { |
| 22 public: | 22 public: |
| 23 // DocumentsService is usually owned and created by GDataFileSystem. | 23 // DocumentsService is usually owned and created by GDataFileSystem. |
| 24 MockDocumentsService(); | 24 MockDocumentsService(); |
| 25 virtual ~MockDocumentsService(); | 25 virtual ~MockDocumentsService(); |
| 26 | 26 |
| 27 // DocumentServiceInterface overrides. | 27 // DocumentServiceInterface overrides. |
| 28 MOCK_METHOD1(Initialize, void(Profile* profile)); | 28 MOCK_METHOD1(Initialize, void(Profile* profile)); |
| 29 MOCK_CONST_METHOD0(operation_registry, GDataOperationRegistry*()); | 29 MOCK_CONST_METHOD0(operation_registry, GDataOperationRegistry*()); |
| 30 MOCK_METHOD0(CancelAll, void(void)); | 30 MOCK_METHOD0(CancelAll, void(void)); |
| 31 MOCK_METHOD1(Authenticate, void(const AuthStatusCallback& callback)); | 31 MOCK_METHOD1(Authenticate, void(const AuthStatusCallback& callback)); |
| 32 MOCK_METHOD5(GetDocuments, void(const GURL& feed_url, | 32 MOCK_METHOD5(GetDocuments, void(const GURL& feed_url, |
| 33 int start_changestamp, | 33 int64 start_changestamp, |
| 34 const std::string& search_string, | 34 const std::string& search_string, |
| 35 const std::string& directory_resource_id, | 35 const std::string& directory_resource_id, |
| 36 const GetDataCallback& callback)); | 36 const GetDataCallback& callback)); |
| 37 MOCK_METHOD3(GetFilelist, void(const GURL& feed_url, | |
| 38 const std::string& search_string, | |
| 39 const GetDataCallback& callback)); | |
| 40 MOCK_METHOD3(GetChangelist, void(const GURL& feed_url, | |
| 41 int64 start_changestamp, | |
| 42 const GetDataCallback& callback)); | |
| 43 MOCK_METHOD2(GetDocumentEntry, void(const std::string& resource_id, | 37 MOCK_METHOD2(GetDocumentEntry, void(const std::string& resource_id, |
| 44 const GetDataCallback& callback)); | 38 const GetDataCallback& callback)); |
| 45 MOCK_METHOD2(GetFile, void(const std::string& file_id, | |
| 46 const GetDataCallback& callback)); | |
| 47 MOCK_METHOD1(GetAccountMetadata, void(const GetDataCallback& callback)); | 39 MOCK_METHOD1(GetAccountMetadata, void(const GetDataCallback& callback)); |
| 48 MOCK_METHOD1(GetAboutResource, void(const GetDataCallback& callback)); | 40 MOCK_METHOD1(GetApplicationInfo, void(const GetDataCallback& callback)); |
| 49 MOCK_METHOD1(GetApplicationList, void(const GetDataCallback& callback)); | |
| 50 MOCK_METHOD2(DeleteDocument, void(const GURL& document_url, | 41 MOCK_METHOD2(DeleteDocument, void(const GURL& document_url, |
| 51 const EntryActionCallback& callback)); | 42 const EntryActionCallback& callback)); |
| 52 MOCK_METHOD5(DownloadDocument, void(const FilePath& virtual_path, | 43 MOCK_METHOD5(DownloadDocument, void(const FilePath& virtual_path, |
| 53 const FilePath& local_cache_path, | 44 const FilePath& local_cache_path, |
| 54 const GURL& content_url, | 45 const GURL& content_url, |
| 55 DocumentExportFormat format, | 46 DocumentExportFormat format, |
| 56 const DownloadActionCallback& callback)); | 47 const DownloadActionCallback& callback)); |
| 57 MOCK_METHOD3(CopyDocument, void(const std::string& resource_id, | 48 MOCK_METHOD3(CopyDocument, void(const std::string& resource_id, |
| 58 const FilePath::StringType& new_name, | 49 const FilePath::StringType& new_name, |
| 59 const GetDataCallback& callback)); | 50 const GetDataCallback& callback)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Helper stub methods for functions which take callbacks, so that | 103 // Helper stub methods for functions which take callbacks, so that |
| 113 // the callbacks get called with testable results. | 104 // the callbacks get called with testable results. |
| 114 | 105 |
| 115 // Will call |callback| with HTTP_SUCCESS and the token "test_auth_token" | 106 // Will call |callback| with HTTP_SUCCESS and the token "test_auth_token" |
| 116 // as the token. | 107 // as the token. |
| 117 void AuthenticateStub(const AuthStatusCallback& callback); | 108 void AuthenticateStub(const AuthStatusCallback& callback); |
| 118 | 109 |
| 119 // Will call |callback| with HTTP_SUCCESS and a StringValue with the current | 110 // Will call |callback| with HTTP_SUCCESS and a StringValue with the current |
| 120 // value of |feed_data_|. | 111 // value of |feed_data_|. |
| 121 void GetDocumentsStub(const GURL& feed_url, | 112 void GetDocumentsStub(const GURL& feed_url, |
| 122 int start_changestamp, | 113 int64 start_changestamp, |
| 123 const std::string& search_string, | 114 const std::string& search_string, |
| 124 const std::string& directory_resource_id, | 115 const std::string& directory_resource_id, |
| 125 const GetDataCallback& callback); | 116 const GetDataCallback& callback); |
| 126 | 117 |
| 127 // Will call |callback| with HTTP_SUCCESS and a StringValue with the current | 118 // Will call |callback| with HTTP_SUCCESS and a StringValue with the current |
| 128 // value of |account_metadata_|. | 119 // value of |account_metadata_|. |
| 129 void GetAccountMetadataStub(const GetDataCallback& callback); | 120 void GetAccountMetadataStub(const GetDataCallback& callback); |
| 130 | 121 |
| 131 // Will call |callback| with HTTP_SUCCESS and the |document_url|. | 122 // Will call |callback| with HTTP_SUCCESS and the |document_url|. |
| 132 void DeleteDocumentStub(const GURL& document_url, | 123 void DeleteDocumentStub(const GURL& document_url, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // The feed contains subset of the root_feed. | 185 // The feed contains subset of the root_feed. |
| 195 scoped_ptr<base::Value> search_result_; | 186 scoped_ptr<base::Value> search_result_; |
| 196 | 187 |
| 197 // File data to be written to the local temporary file when | 188 // File data to be written to the local temporary file when |
| 198 // DownloadDocumentStub is called. | 189 // DownloadDocumentStub is called. |
| 199 scoped_ptr<std::string> file_data_; | 190 scoped_ptr<std::string> file_data_; |
| 200 }; | 191 }; |
| 201 | 192 |
| 202 } // namespace gdata | 193 } // namespace gdata |
| 203 | 194 |
| 204 #endif // CHROME_BROWSER_CHROMEOS_GDATA_MOCK_GDATA_DOCUMENTS_SERVICE_H_ | 195 #endif // CHROME_BROWSER_CHROMEOS_GDATA_MOCK_DOCUMENTS_SERVICE_H_ |
| OLD | NEW |