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

Side by Side Diff: chrome/browser/component_updater/cld_component_installer.h

Issue 280753003: Add unit tests for the CLD component installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused import Created 6 years, 7 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_COMPONENT_UPDATER_CLD_COMPONENT_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_CLD_COMPONENT_INSTALLER_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_CLD_COMPONENT_INSTALLER_H_ 6 #define CHROME_BROWSER_COMPONENT_UPDATER_CLD_COMPONENT_INSTALLER_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/gtest_prod_util.h"
10 #include "chrome/browser/component_updater/default_component_installer.h"
9 11
10 namespace component_updater { 12 namespace component_updater {
11 13
12 class ComponentUpdateService; 14 class ComponentUpdateService;
13 15
16 // Visible for testing. No need to instantiate this class directly.
17 class CldComponentInstallerTraits : public ComponentInstallerTraits {
18 public:
19 CldComponentInstallerTraits();
20 virtual ~CldComponentInstallerTraits() {}
21
22 private:
23 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, ComponentReady);
24 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetBaseDirectory);
25 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetHash);
26 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetInstalledPath);
27 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetName);
28 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, OnCustomInstall);
29 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, SetLatestCldDataFile);
30 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, VerifyInstallation);
31
32 // The following methods override ComponentInstallerTraits.
33 virtual bool CanAutoUpdate() const OVERRIDE;
34 virtual bool OnCustomInstall(const base::DictionaryValue& manifest,
35 const base::FilePath& install_dir) OVERRIDE;
36 virtual bool VerifyInstallation(
37 const base::FilePath& install_dir) const OVERRIDE;
38 virtual void ComponentReady(
39 const base::Version& version,
40 const base::FilePath& path,
41 scoped_ptr<base::DictionaryValue> manifest) OVERRIDE;
42 virtual base::FilePath GetBaseDirectory() const OVERRIDE;
43 virtual void GetHash(std::vector<uint8>* hash) const OVERRIDE;
44 virtual std::string GetName() const OVERRIDE;
45
46 base::FilePath GetInstalledPath(const base::FilePath& base) const;
47 void SetLatestCldDataFile(const base::FilePath& path);
48 DISALLOW_COPY_AND_ASSIGN(CldComponentInstallerTraits);
49 };
50
51 // Call once during startup to make the component update service aware of
52 // the CLD component.
14 void RegisterCldComponent(ComponentUpdateService* cus); 53 void RegisterCldComponent(ComponentUpdateService* cus);
15 54
16 // Places the path to the latest CLD data file into the specified path object. 55 // Places the path to the latest CLD data file into the specified path object.
17 // Returns true if and only if the file has been observed to exist at least 56 // Returns true if and only if the file has been observed to exist at least
18 // once and was valid when it was observed; if the function returns false, the 57 // once and was valid when it was observed; if the function returns false, the
19 // path parameter is not modified. This function is threadsafe. 58 // path parameter is not modified. This function is threadsafe.
20 bool GetLatestCldDataFile(base::FilePath* path); 59 bool GetLatestCldDataFile(base::FilePath* path);
21 60
22 } // namespace component_updater 61 } // namespace component_updater
23 62
24 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CLD_COMPONENT_INSTALLER_H_ 63 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CLD_COMPONENT_INSTALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698