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

Unified Diff: chrome/browser/chromeos/drive/file_task_executor.h

Issue 391003006: Make FileTaskExecutor testable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments. Created 6 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_task_executor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_task_executor.h
diff --git a/chrome/browser/chromeos/drive/file_task_executor.h b/chrome/browser/chromeos/drive/file_task_executor.h
index 0bdf6bcae1e31986a735537397239e0290a61dbc..951b1a361260c2e67fdfbad1424ee7099f16a84e 100644
--- a/chrome/browser/chromeos/drive/file_task_executor.h
+++ b/chrome/browser/chromeos/drive/file_task_executor.h
@@ -16,8 +16,20 @@
namespace drive {
+class DriveServiceInterface;
+class FileSystemInterface;
class ResourceEntry;
+// Delegate class for hooking fake instances and behaviors for testing.
+class FileTaskExecutorDelegate {
+ public:
+ virtual ~FileTaskExecutorDelegate() {}
+
+ virtual FileSystemInterface* GetFileSystem() = 0;
+ virtual DriveServiceInterface* GetDriveService() = 0;
+ virtual void OpenBrowserWindow(const GURL& open_link) = 0;
+};
+
// This class implements an "executor" class that will execute tasks for
// third party Drive apps that store data in Drive itself. To do that, it
// needs to find the file resource IDs and pass them to a server-side function
@@ -25,12 +37,17 @@ class ResourceEntry;
// for opening the document in that app directly.
class FileTaskExecutor {
public:
+ // Creates FileTaskExecutor with delegate derived from |profile|. Used in
+ // product environment.
FileTaskExecutor(Profile* profile, const std::string& app_id);
+ // Creates FileTaskExecutor with a specific delegate.
+ FileTaskExecutor(scoped_ptr<FileTaskExecutorDelegate> delegate,
+ const std::string& app_id);
+
// Executes file tasks, runs |done| and deletes |this|.
- void Execute(
- const std::vector<fileapi::FileSystemURL>& file_urls,
- const file_manager::file_tasks::FileTaskFinishedCallback& done);
+ void Execute(const std::vector<fileapi::FileSystemURL>& file_urls,
+ const file_manager::file_tasks::FileTaskFinishedCallback& done);
private:
~FileTaskExecutor();
@@ -43,7 +60,7 @@ class FileTaskExecutor {
// Calls |done_| with |success| status and deletes |this|.
void Done(bool success);
- Profile* profile_;
+ scoped_ptr<FileTaskExecutorDelegate> delegate_;
std::string app_id_;
int current_index_;
file_manager::file_tasks::FileTaskFinishedCallback done_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_task_executor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698