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 COMPONENTS_UPDATE_CLIENT_TEST_TEST_INSTALLER_H_
6 #define COMPONENTS_UPDATE_CLIENT_TEST_TEST_INSTALLER_H_
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "components/update_client/update_client.h"
15 class DictionaryValue
;
18 namespace update_client
{
20 // A TestInstaller is an installer that does nothing for installation except
21 // increment a counter.
22 class TestInstaller
: public ComponentInstaller
{
26 void OnUpdateError(int error
) override
;
28 bool Install(const base::DictionaryValue
& manifest
,
29 const base::FilePath
& unpack_path
) override
;
31 bool GetInstalledFile(const std::string
& file
,
32 base::FilePath
* installed_file
) override
;
34 bool Uninstall() override
;
40 int install_count() const {
41 return install_count_
;
45 ~TestInstaller() override
;
51 // A ReadOnlyTestInstaller is an installer that knows about files in an existing
52 // directory. It will not write to the directory.
53 class ReadOnlyTestInstaller
: public TestInstaller
{
55 explicit ReadOnlyTestInstaller(const base::FilePath
& installed_path
);
57 bool GetInstalledFile(const std::string
& file
,
58 base::FilePath
* installed_file
) override
;
61 ~ReadOnlyTestInstaller() override
;
63 base::FilePath install_directory_
;
66 // A VersionedTestInstaller is an installer that installs files into versioned
67 // directories (e.g. somedir/25.23.89.141/<files>).
68 class VersionedTestInstaller
: public TestInstaller
{
70 VersionedTestInstaller();
72 bool Install(const base::DictionaryValue
& manifest
,
73 const base::FilePath
& unpack_path
) override
;
75 bool GetInstalledFile(const std::string
& file
,
76 base::FilePath
* installed_file
) override
;
79 ~VersionedTestInstaller() override
;
81 base::FilePath install_directory_
;
82 Version current_version_
;
85 } // namespace update_client
87 #endif // COMPONENTS_UPDATE_CLIENT_TEST_TEST_INSTALLER_H_