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

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

Issue 285293004: Allow browser tests to run with dynamic CLD data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cld_uma
Patch Set: Remove unnecessary OVERRIDE directive from Init() 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
« no previous file with comments | « no previous file | chrome/browser/translate/translate_browser_test_utils.h » ('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 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "chrome/browser/component_updater/default_component_installer.h" 13 #include "chrome/browser/component_updater/default_component_installer.h"
14 14
15 namespace test {
16 class ScopedCLDDynamicDataHarness;
17 } // namespace test
18
15 namespace component_updater { 19 namespace component_updater {
16 20
17 class ComponentUpdateService; 21 class ComponentUpdateService;
18 22
19 // Visible for testing. No need to instantiate this class directly. 23 // Visible for testing. No need to instantiate this class directly.
20 class CldComponentInstallerTraits : public ComponentInstallerTraits { 24 class CldComponentInstallerTraits : public ComponentInstallerTraits {
21 public: 25 public:
22 CldComponentInstallerTraits(); 26 CldComponentInstallerTraits();
23 virtual ~CldComponentInstallerTraits() {} 27 virtual ~CldComponentInstallerTraits() {}
24 28
25 private: 29 private:
26 friend class CldComponentInstallerTest; // For access within SetUp() 30 friend class CldComponentInstallerTest; // For access within SetUp()
31 friend class test::ScopedCLDDynamicDataHarness; // For browser tests only
27 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, ComponentReady); 32 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, ComponentReady);
28 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetBaseDirectory); 33 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetBaseDirectory);
29 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetHash); 34 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetHash);
30 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetInstalledPath); 35 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetInstalledPath);
31 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetName); 36 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, GetName);
32 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, OnCustomInstall); 37 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, OnCustomInstall);
33 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, SetLatestCldDataFile); 38 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, SetLatestCldDataFile);
34 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, VerifyInstallation); 39 FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, VerifyInstallation);
35 40
36 // The following methods override ComponentInstallerTraits. 41 // The following methods override ComponentInstallerTraits.
37 virtual bool CanAutoUpdate() const OVERRIDE; 42 virtual bool CanAutoUpdate() const OVERRIDE;
38 virtual bool OnCustomInstall(const base::DictionaryValue& manifest, 43 virtual bool OnCustomInstall(const base::DictionaryValue& manifest,
39 const base::FilePath& install_dir) OVERRIDE; 44 const base::FilePath& install_dir) OVERRIDE;
40 virtual bool VerifyInstallation( 45 virtual bool VerifyInstallation(
41 const base::FilePath& install_dir) const OVERRIDE; 46 const base::FilePath& install_dir) const OVERRIDE;
42 virtual void ComponentReady( 47 virtual void ComponentReady(
43 const base::Version& version, 48 const base::Version& version,
44 const base::FilePath& path, 49 const base::FilePath& path,
45 scoped_ptr<base::DictionaryValue> manifest) OVERRIDE; 50 scoped_ptr<base::DictionaryValue> manifest) OVERRIDE;
46 virtual base::FilePath GetBaseDirectory() const OVERRIDE; 51 virtual base::FilePath GetBaseDirectory() const OVERRIDE;
47 virtual void GetHash(std::vector<uint8>* hash) const OVERRIDE; 52 virtual void GetHash(std::vector<uint8>* hash) const OVERRIDE;
48 virtual std::string GetName() const OVERRIDE; 53 virtual std::string GetName() const OVERRIDE;
49 54
50 base::FilePath GetInstalledPath(const base::FilePath& base) const; 55 base::FilePath GetInstalledPath(const base::FilePath& base) const;
51 void SetLatestCldDataFile(const base::FilePath& path); 56 static void SetLatestCldDataFile(const base::FilePath& path);
Takashi Toyoshima 2014/05/20 00:33:04 I asked about this line before, but didn't get an
Andrew Hayden (chromium.org) 2014/05/20 10:20:02 Sorry for missing this one. GetInstalledPath could
52 DISALLOW_COPY_AND_ASSIGN(CldComponentInstallerTraits); 57 DISALLOW_COPY_AND_ASSIGN(CldComponentInstallerTraits);
53 }; 58 };
54 59
55 // Call once during startup to make the component update service aware of 60 // Call once during startup to make the component update service aware of
56 // the CLD component. 61 // the CLD component.
57 void RegisterCldComponent(ComponentUpdateService* cus); 62 void RegisterCldComponent(ComponentUpdateService* cus);
58 63
59 // Returns the path to the latest CLD data file into the specified path object, 64 // Returns the path to the latest CLD data file into the specified path object,
60 // or an empty path if the CLD data file has not been observed yet. 65 // or an empty path if the CLD data file has not been observed yet.
61 // This function is threadsafe. 66 // This function is threadsafe.
62 base::FilePath GetLatestCldDataFile(); 67 base::FilePath GetLatestCldDataFile();
63 68
64 } // namespace component_updater 69 } // namespace component_updater
65 70
66 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CLD_COMPONENT_INSTALLER_H_ 71 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CLD_COMPONENT_INSTALLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/translate/translate_browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698