| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/chromeos/drive/file_task_executor.h" | 5 #include "chrome/browser/chromeos/drive/file_task_executor.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 public: | 25 public: |
| 26 explicit TestDelegate(std::set<std::string>* opend_urls) | 26 explicit TestDelegate(std::set<std::string>* opend_urls) |
| 27 : opend_urls_(opend_urls), | 27 : opend_urls_(opend_urls), |
| 28 fake_drive_service_(new FakeDriveService), | 28 fake_drive_service_(new FakeDriveService), |
| 29 fake_file_system_(new test_util::FakeFileSystem( | 29 fake_file_system_(new test_util::FakeFileSystem( |
| 30 fake_drive_service_.get())) { | 30 fake_drive_service_.get())) { |
| 31 fake_drive_service_->set_open_url_format("http://openlink/%s/%s"); | 31 fake_drive_service_->set_open_url_format("http://openlink/%s/%s"); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // FileTaskExecutorDelegate overrides. | 34 // FileTaskExecutorDelegate overrides. |
| 35 virtual FileSystemInterface* GetFileSystem() OVERRIDE { | 35 virtual FileSystemInterface* GetFileSystem() override { |
| 36 return fake_file_system_.get(); | 36 return fake_file_system_.get(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual DriveServiceInterface* GetDriveService() OVERRIDE { | 39 virtual DriveServiceInterface* GetDriveService() override { |
| 40 return fake_drive_service_.get(); | 40 return fake_drive_service_.get(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual void OpenBrowserWindow(const GURL& open_link) OVERRIDE { | 43 virtual void OpenBrowserWindow(const GURL& open_link) override { |
| 44 opend_urls_->insert(open_link.spec()); | 44 opend_urls_->insert(open_link.spec()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Sets up files on the fake Drive service. | 47 // Sets up files on the fake Drive service. |
| 48 bool SetUpTestFiles() { | 48 bool SetUpTestFiles() { |
| 49 { | 49 { |
| 50 google_apis::GDataErrorCode result = google_apis::GDATA_OTHER_ERROR; | 50 google_apis::GDataErrorCode result = google_apis::GDATA_OTHER_ERROR; |
| 51 scoped_ptr<google_apis::FileResource> file; | 51 scoped_ptr<google_apis::FileResource> file; |
| 52 fake_drive_service_->AddNewFileWithResourceId( | 52 fake_drive_service_->AddNewFileWithResourceId( |
| 53 "id1", | 53 "id1", |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 extensions::api::file_manager_private::TASK_RESULT_NONE; | 143 extensions::api::file_manager_private::TASK_RESULT_NONE; |
| 144 executor->Execute(urls, | 144 executor->Execute(urls, |
| 145 google_apis::test_util::CreateCopyResultCallback(&result)); | 145 google_apis::test_util::CreateCopyResultCallback(&result)); |
| 146 base::RunLoop().RunUntilIdle(); | 146 base::RunLoop().RunUntilIdle(); |
| 147 | 147 |
| 148 EXPECT_EQ(extensions::api::file_manager_private::TASK_RESULT_FAILED, result); | 148 EXPECT_EQ(extensions::api::file_manager_private::TASK_RESULT_FAILED, result); |
| 149 ASSERT_TRUE(opend_urls.empty()); | 149 ASSERT_TRUE(opend_urls.empty()); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace drive | 152 } // namespace drive |
| OLD | NEW |