| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "components/component_updater/component_updater_service.h" | 12 #include "components/component_updater/component_updater_service.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class DictionaryValue; | 15 class DictionaryValue; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace component_updater { | 18 namespace component_updater { |
| 19 | 19 |
| 20 // A TestInstaller is an installer that does nothing for installation except | 20 // A TestInstaller is an installer that does nothing for installation except |
| 21 // increment a counter. | 21 // increment a counter. |
| 22 class TestInstaller : public ComponentInstaller { | 22 class TestInstaller : public ComponentInstaller { |
| 23 public: | 23 public: |
| 24 TestInstaller(); | 24 TestInstaller(); |
| 25 | 25 |
| 26 virtual void OnUpdateError(int error) OVERRIDE; | 26 virtual void OnUpdateError(int error) override; |
| 27 | 27 |
| 28 virtual bool Install(const base::DictionaryValue& manifest, | 28 virtual bool Install(const base::DictionaryValue& manifest, |
| 29 const base::FilePath& unpack_path) OVERRIDE; | 29 const base::FilePath& unpack_path) override; |
| 30 | 30 |
| 31 virtual bool GetInstalledFile(const std::string& file, | 31 virtual bool GetInstalledFile(const std::string& file, |
| 32 base::FilePath* installed_file) OVERRIDE; | 32 base::FilePath* installed_file) override; |
| 33 | 33 |
| 34 int error() const; | 34 int error() const; |
| 35 | 35 |
| 36 int install_count() const; | 36 int install_count() const; |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 int error_; | 39 int error_; |
| 40 int install_count_; | 40 int install_count_; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // A ReadOnlyTestInstaller is an installer that knows about files in an existing | 43 // A ReadOnlyTestInstaller is an installer that knows about files in an existing |
| 44 // directory. It will not write to the directory. | 44 // directory. It will not write to the directory. |
| 45 class ReadOnlyTestInstaller : public TestInstaller { | 45 class ReadOnlyTestInstaller : public TestInstaller { |
| 46 public: | 46 public: |
| 47 explicit ReadOnlyTestInstaller(const base::FilePath& installed_path); | 47 explicit ReadOnlyTestInstaller(const base::FilePath& installed_path); |
| 48 | 48 |
| 49 virtual ~ReadOnlyTestInstaller(); | 49 virtual ~ReadOnlyTestInstaller(); |
| 50 | 50 |
| 51 virtual bool GetInstalledFile(const std::string& file, | 51 virtual bool GetInstalledFile(const std::string& file, |
| 52 base::FilePath* installed_file) OVERRIDE; | 52 base::FilePath* installed_file) override; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 base::FilePath install_directory_; | 55 base::FilePath install_directory_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // A VersionedTestInstaller is an installer that installs files into versioned | 58 // A VersionedTestInstaller is an installer that installs files into versioned |
| 59 // directories (e.g. somedir/25.23.89.141/<files>). | 59 // directories (e.g. somedir/25.23.89.141/<files>). |
| 60 class VersionedTestInstaller : public TestInstaller { | 60 class VersionedTestInstaller : public TestInstaller { |
| 61 public: | 61 public: |
| 62 VersionedTestInstaller(); | 62 VersionedTestInstaller(); |
| 63 | 63 |
| 64 virtual ~VersionedTestInstaller(); | 64 virtual ~VersionedTestInstaller(); |
| 65 | 65 |
| 66 virtual bool Install(const base::DictionaryValue& manifest, | 66 virtual bool Install(const base::DictionaryValue& manifest, |
| 67 const base::FilePath& unpack_path) OVERRIDE; | 67 const base::FilePath& unpack_path) override; |
| 68 | 68 |
| 69 virtual bool GetInstalledFile(const std::string& file, | 69 virtual bool GetInstalledFile(const std::string& file, |
| 70 base::FilePath* installed_file) OVERRIDE; | 70 base::FilePath* installed_file) override; |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 base::FilePath install_directory_; | 73 base::FilePath install_directory_; |
| 74 Version current_version_; | 74 Version current_version_; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } // namespace component_updater | 77 } // namespace component_updater |
| 78 | 78 |
| 79 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_ | 79 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_ |
| OLD | NEW |