Chromium Code Reviews| Index: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h |
| diff --git a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a7c37d674e3ae77555a071fb04bd3cfafc8c7bab |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H_ |
| +#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/files/file_path.h" |
| +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" |
| +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" |
| + |
| +class Profile; |
| + |
| +namespace chromeos { |
| +namespace file_system_provider { |
| + |
| +class RequestManager; |
| + |
| +// Fake provided file system implementation. Does not communicate with target |
| +// extensions. Used for unit tests. |
| +class FakeProvidedFileSystem : public ProvidedFileSystemInterface { |
| + public: |
| + FakeProvidedFileSystem(); |
| + explicit FakeProvidedFileSystem( |
| + const ProvidedFileSystemInfo& file_system_info); |
| + virtual ~FakeProvidedFileSystem(); |
| + |
| + // ProvidedFileSystemInterface overrides. |
| + virtual bool RequestUnmount( |
| + const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
| + virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; |
| + |
| + private: |
| + ProvidedFileSystemInfo file_system_info_; |
| + DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); |
| +}; |
| + |
| +// Factory creating fake provided file system instances. |
| +class FakeProvidedFileSystemFactory |
| + : public ProvidedFileSystemFactoryInterface { |
|
hashimoto
2014/04/11 06:01:50
Do we need an interface for this?
Can't this be re
mtomasz
2014/04/11 07:11:56
I just made it for consistency with other factorie
hashimoto
2014/04/14 10:43:42
How common do you think this pattern is?
There are
mtomasz
2014/04/15 02:46:40
I just took a look, and there is a lot of single-m
hashimoto
2014/04/15 07:22:45
I know, as I said, what I wanted to know is the ra
mtomasz
2014/04/15 09:42:12
I changed my mind. Let's go with SetFactoryForTest
|
| + public: |
| + FakeProvidedFileSystemFactory(); |
| + virtual ~FakeProvidedFileSystemFactory(); |
| + |
| + // ProvidedFileSystemFactoryInterface overrides. |
| + virtual ProvidedFileSystemInterface* Create( |
| + Profile* profile, |
| + RequestManager* request_manager, |
| + const ProvidedFileSystemInfo& file_system_info) OVERRIDE; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystemFactory); |
| +}; |
| + |
| +} // namespace file_system_provider |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H_ |