Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / component_updater / test / test_installer.h
blobe93eeba9c40f9832067239ed8acbaeec4a136c20
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"
12 namespace base {
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 {
21 public:
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;
32 int error() const;
34 int install_count() const;
36 protected:
37 int error_;
38 int install_count_;
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 {
44 public:
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;
52 private:
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 {
59 public :
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;
70 private:
71 base::FilePath install_directory_;
72 Version current_version_;
75 } // namespace component_updater
77 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_TEST_INSTALLER_H_