Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: components/update_client/test_installer.h

Issue 2479633003: Makes the component installers return a Result instead of a bool. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/update_client/action_update.cc ('k') | components/update_client/test_installer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_UPDATE_CLIENT_TEST_INSTALLER_H_ 5 #ifndef COMPONENTS_UPDATE_CLIENT_TEST_INSTALLER_H_
6 #define COMPONENTS_UPDATE_CLIENT_TEST_INSTALLER_H_ 6 #define COMPONENTS_UPDATE_CLIENT_TEST_INSTALLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "components/update_client/update_client.h" 11 #include "components/update_client/update_client.h"
12 12
13 namespace base { 13 namespace base {
14 class DictionaryValue; 14 class DictionaryValue;
15 } 15 }
16 16
17 namespace update_client { 17 namespace update_client {
18 18
19 // TODO(sorin): consider reducing the number of the installer mocks. 19 // TODO(sorin): consider reducing the number of the installer mocks.
20 // A TestInstaller is an installer that does nothing for installation except 20 // A TestInstaller is an installer that does nothing for installation except
21 // increment a counter. 21 // increment a counter.
22 class TestInstaller : public CrxInstaller { 22 class TestInstaller : public CrxInstaller {
23 public: 23 public:
24 TestInstaller(); 24 TestInstaller();
25 25
26 void OnUpdateError(int error) override; 26 void OnUpdateError(int error) override;
27 27
28 bool Install(const base::DictionaryValue& manifest, 28 Result Install(const base::DictionaryValue& manifest,
29 const base::FilePath& unpack_path) override; 29 const base::FilePath& unpack_path) override;
30 30
31 bool GetInstalledFile(const std::string& file, 31 bool GetInstalledFile(const std::string& file,
32 base::FilePath* installed_file) override; 32 base::FilePath* installed_file) override;
33 33
34 bool Uninstall() override; 34 bool Uninstall() override;
35 35
36 int error() const { return error_; } 36 int error() const { return error_; }
37 37
38 int install_count() const { return install_count_; } 38 int install_count() const { return install_count_; }
39 39
(...skipping 18 matching lines...) Expand all
58 58
59 base::FilePath install_directory_; 59 base::FilePath install_directory_;
60 }; 60 };
61 61
62 // A VersionedTestInstaller is an installer that installs files into versioned 62 // A VersionedTestInstaller is an installer that installs files into versioned
63 // directories (e.g. somedir/25.23.89.141/<files>). 63 // directories (e.g. somedir/25.23.89.141/<files>).
64 class VersionedTestInstaller : public TestInstaller { 64 class VersionedTestInstaller : public TestInstaller {
65 public: 65 public:
66 VersionedTestInstaller(); 66 VersionedTestInstaller();
67 67
68 bool Install(const base::DictionaryValue& manifest, 68 Result Install(const base::DictionaryValue& manifest,
69 const base::FilePath& unpack_path) override; 69 const base::FilePath& unpack_path) override;
70 70
71 bool GetInstalledFile(const std::string& file, 71 bool GetInstalledFile(const std::string& file,
72 base::FilePath* installed_file) override; 72 base::FilePath* installed_file) override;
73 73
74 private: 74 private:
75 ~VersionedTestInstaller() override; 75 ~VersionedTestInstaller() override;
76 76
77 base::FilePath install_directory_; 77 base::FilePath install_directory_;
78 base::Version current_version_; 78 base::Version current_version_;
79 }; 79 };
80 80
81 } // namespace update_client 81 } // namespace update_client
82 82
83 #endif // COMPONENTS_UPDATE_CLIENT_TEST_INSTALLER_H_ 83 #endif // COMPONENTS_UPDATE_CLIENT_TEST_INSTALLER_H_
OLDNEW
« no previous file with comments | « components/update_client/action_update.cc ('k') | components/update_client/test_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698