Try to work around that clang/win bug in another file.
[chromium-blink-merge.git] / components / update_client / test_installer.h
blob44a6f280346ff9b1465bef080a56d6c95e45e287
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_INSTALLER_H_
6 #define COMPONENTS_UPDATE_CLIENT_TEST_INSTALLER_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "components/update_client/update_client.h"
14 namespace base {
15 class DictionaryValue;
18 namespace update_client {
20 // TODO(sorin): consider reducing the number of the installer mocks.
21 // A TestInstaller is an installer that does nothing for installation except
22 // increment a counter.
23 class TestInstaller : public CrxInstaller {
24 public:
25 TestInstaller();
27 void OnUpdateError(int error) override;
29 bool Install(const base::DictionaryValue& manifest,
30 const base::FilePath& unpack_path) override;
32 bool GetInstalledFile(const std::string& file,
33 base::FilePath* installed_file) override;
35 bool Uninstall() override;
37 int error() const { return error_; }
39 int install_count() const { return install_count_; }
41 protected:
42 ~TestInstaller() override;
44 int error_;
45 int install_count_;
48 // A ReadOnlyTestInstaller is an installer that knows about files in an existing
49 // directory. It will not write to the directory.
50 class ReadOnlyTestInstaller : public TestInstaller {
51 public:
52 explicit ReadOnlyTestInstaller(const base::FilePath& installed_path);
54 bool GetInstalledFile(const std::string& file,
55 base::FilePath* installed_file) override;
57 private:
58 ~ReadOnlyTestInstaller() override;
60 base::FilePath install_directory_;
63 // A VersionedTestInstaller is an installer that installs files into versioned
64 // directories (e.g. somedir/25.23.89.141/<files>).
65 class VersionedTestInstaller : public TestInstaller {
66 public:
67 VersionedTestInstaller();
69 bool Install(const base::DictionaryValue& manifest,
70 const base::FilePath& unpack_path) override;
72 bool GetInstalledFile(const std::string& file,
73 base::FilePath* installed_file) override;
75 private:
76 ~VersionedTestInstaller() override;
78 base::FilePath install_directory_;
79 Version current_version_;
82 } // namespace update_client
84 #endif // COMPONENTS_UPDATE_CLIENT_TEST_INSTALLER_H_