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 namespace component_updater
{
18 // A TestInstaller is an installer that does nothing for installation except
19 // increment a counter.
20 class TestInstaller
: public ComponentInstaller
{
22 explicit TestInstaller();
24 virtual void OnUpdateError(int error
) OVERRIDE
;
26 virtual bool Install(const base::DictionaryValue
& manifest
,
27 const base::FilePath
& unpack_path
) OVERRIDE
;
29 virtual bool GetInstalledFile(const std::string
& file
,
30 base::FilePath
* installed_file
) OVERRIDE
;
34 int install_count() const;
41 // A ReadOnlyTestInstaller is an installer that knows about files in an existing
42 // directory. It will not write to the directory.
43 class ReadOnlyTestInstaller
: public TestInstaller
{
45 explicit ReadOnlyTestInstaller(const base::FilePath
& installed_path
);
47 virtual ~ReadOnlyTestInstaller();
49 virtual bool GetInstalledFile(const std::string
& file
,
50 base::FilePath
* installed_file
) OVERRIDE
;
53 base::FilePath install_directory_
;
56 // A VersionedTestInstaller is an installer that installs files into versioned
57 // directories (e.g. somedir/25.23.89.141/<files>).
58 class VersionedTestInstaller
: public TestInstaller
{
60 explicit VersionedTestInstaller();
62 virtual ~VersionedTestInstaller();
64 virtual bool Install(const base::DictionaryValue
& manifest
,
65 const base::FilePath
& unpack_path
) OVERRIDE
;
67 virtual bool GetInstalledFile(const std::string
& file
,
68 base::FilePath
* installed_file
) OVERRIDE
;
71 base::FilePath install_directory_
;
72 Version current_version_
;
75 } // namespace component_updater
77 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_