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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h"
10 #include "chrome/browser/component_updater/component_updater_service.h"
13 class DictionaryValue;
16 // A TestInstaller is an installer that does nothing for installation except
17 // increment a counter.
18 class TestInstaller : public ComponentInstaller {
20 explicit TestInstaller();
22 virtual void OnUpdateError(int error) OVERRIDE;
24 virtual bool Install(const base::DictionaryValue& manifest,
25 const base::FilePath& unpack_path) OVERRIDE;
27 virtual bool GetInstalledFile(const std::string& file,
28 base::FilePath* installed_file) OVERRIDE;
32 int install_count() const;
39 // A ReadOnlyTestInstaller is an installer that knows about files in an existing
40 // directory. It will not write to the directory.
41 class ReadOnlyTestInstaller : public TestInstaller {
43 explicit ReadOnlyTestInstaller(const base::FilePath& installed_path);
45 virtual ~ReadOnlyTestInstaller();
47 virtual bool GetInstalledFile(const std::string& file,
48 base::FilePath* installed_file) OVERRIDE;
51 base::FilePath install_directory_;
54 // A VersionedTestInstaller is an installer that installs files into versioned
55 // directories (e.g. somedir/25.23.89.141/<files>).
56 class VersionedTestInstaller : public TestInstaller {
58 explicit VersionedTestInstaller();
60 virtual ~VersionedTestInstaller();
62 virtual bool Install(const base::DictionaryValue& manifest,
63 const base::FilePath& unpack_path) OVERRIDE;
65 virtual bool GetInstalledFile(const std::string& file,
66 base::FilePath* installed_file) OVERRIDE;
69 base::FilePath install_directory_;
70 Version current_version_;
73 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_