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

Side by Side Diff: chromeos/chromeos_paths.cc

Issue 2774673004: Add stub implementations for state keys and VPD (Closed)
Patch Set: Rebase Created 3 years, 8 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 | « chromeos/chromeos_paths.h ('k') | chromeos/dbus/session_manager_client.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chromeos/chromeos_paths.h" 5 #include "chromeos/chromeos_paths.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 14 matching lines...) Expand all
25 25
26 const base::FilePath::CharType kOwnerKeyFileName[] = 26 const base::FilePath::CharType kOwnerKeyFileName[] =
27 FILE_PATH_LITERAL("/var/lib/whitelist/owner.key"); 27 FILE_PATH_LITERAL("/var/lib/whitelist/owner.key");
28 28
29 const base::FilePath::CharType kInstallAttributesFileName[] = 29 const base::FilePath::CharType kInstallAttributesFileName[] =
30 FILE_PATH_LITERAL("/run/lockbox/install_attributes.pb"); 30 FILE_PATH_LITERAL("/run/lockbox/install_attributes.pb");
31 31
32 const base::FilePath::CharType kMachineHardwareInfoFileName[] = 32 const base::FilePath::CharType kMachineHardwareInfoFileName[] =
33 FILE_PATH_LITERAL("/tmp/machine-info"); 33 FILE_PATH_LITERAL("/tmp/machine-info");
34 34
35 const base::FilePath::CharType kVpdFileName[] =
36 FILE_PATH_LITERAL("/var/log/vpd_2.0.txt");
37
35 const base::FilePath::CharType kUptimeFileName[] = 38 const base::FilePath::CharType kUptimeFileName[] =
36 FILE_PATH_LITERAL("/proc/uptime"); 39 FILE_PATH_LITERAL("/proc/uptime");
37 40
38 const base::FilePath::CharType kUpdateRebootNeededUptimeFile[] = 41 const base::FilePath::CharType kUpdateRebootNeededUptimeFile[] =
39 FILE_PATH_LITERAL("/run/chrome/update_reboot_needed_uptime"); 42 FILE_PATH_LITERAL("/run/chrome/update_reboot_needed_uptime");
40 43
41 const base::FilePath::CharType kDeviceLocalAccountExtensionDir[] = 44 const base::FilePath::CharType kDeviceLocalAccountExtensionDir[] =
42 FILE_PATH_LITERAL("/var/cache/device_local_account_extensions"); 45 FILE_PATH_LITERAL("/var/cache/device_local_account_extensions");
43 46
44 const base::FilePath::CharType kDeviceLocalAccountExternalDataDir[] = 47 const base::FilePath::CharType kDeviceLocalAccountExternalDataDir[] =
(...skipping 21 matching lines...) Expand all
66 break; 69 break;
67 case FILE_OWNER_KEY: 70 case FILE_OWNER_KEY:
68 *result = base::FilePath(kOwnerKeyFileName); 71 *result = base::FilePath(kOwnerKeyFileName);
69 break; 72 break;
70 case FILE_INSTALL_ATTRIBUTES: 73 case FILE_INSTALL_ATTRIBUTES:
71 *result = base::FilePath(kInstallAttributesFileName); 74 *result = base::FilePath(kInstallAttributesFileName);
72 break; 75 break;
73 case FILE_MACHINE_INFO: 76 case FILE_MACHINE_INFO:
74 *result = base::FilePath(kMachineHardwareInfoFileName); 77 *result = base::FilePath(kMachineHardwareInfoFileName);
75 break; 78 break;
79 case FILE_VPD:
80 *result = base::FilePath(kVpdFileName);
81 break;
76 case FILE_UPTIME: 82 case FILE_UPTIME:
77 *result = base::FilePath(kUptimeFileName); 83 *result = base::FilePath(kUptimeFileName);
78 break; 84 break;
79 case FILE_UPDATE_REBOOT_NEEDED_UPTIME: 85 case FILE_UPDATE_REBOOT_NEEDED_UPTIME:
80 *result = base::FilePath(kUpdateRebootNeededUptimeFile); 86 *result = base::FilePath(kUpdateRebootNeededUptimeFile);
81 break; 87 break;
82 case DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS: 88 case DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS:
83 *result = base::FilePath(kDeviceLocalAccountExtensionDir); 89 *result = base::FilePath(kDeviceLocalAccountExtensionDir);
84 break; 90 break;
85 case DIR_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA: 91 case DIR_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA:
(...skipping 18 matching lines...) Expand all
104 } 110 }
105 111
106 } // namespace 112 } // namespace
107 113
108 void RegisterPathProvider() { 114 void RegisterPathProvider() {
109 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); 115 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
110 } 116 }
111 117
112 void RegisterStubPathOverrides(const base::FilePath& stubs_dir) { 118 void RegisterStubPathOverrides(const base::FilePath& stubs_dir) {
113 CHECK(!base::SysInfo::IsRunningOnChromeOS()); 119 CHECK(!base::SysInfo::IsRunningOnChromeOS());
114 // Override these paths on the desktop, so that enrollment and cloud 120 // Override these paths on the desktop, so that enrollment and cloud policy
115 // policy work and can be tested. 121 // work and can be tested.
116 base::FilePath parent = base::MakeAbsoluteFilePath(stubs_dir); 122 base::FilePath parent = base::MakeAbsoluteFilePath(stubs_dir);
117 PathService::Override( 123 PathService::Override(
118 DIR_USER_POLICY_KEYS, 124 DIR_USER_POLICY_KEYS,
119 parent.AppendASCII("stub_user_policy")); 125 parent.AppendASCII("stub_user_policy"));
120 const bool is_absolute = true; 126 const bool is_absolute = true;
121 const bool create = false; 127 const bool create = false;
122 PathService::OverrideAndCreateIfNeeded( 128 PathService::OverrideAndCreateIfNeeded(
123 FILE_OWNER_KEY, 129 FILE_OWNER_KEY,
124 parent.AppendASCII("stub_owner.key"), 130 parent.AppendASCII("stub_owner.key"),
125 is_absolute, 131 is_absolute,
126 create); 132 create);
127 PathService::OverrideAndCreateIfNeeded( 133 PathService::OverrideAndCreateIfNeeded(
128 FILE_INSTALL_ATTRIBUTES, 134 FILE_INSTALL_ATTRIBUTES,
129 parent.AppendASCII("stub_install_attributes.pb"), 135 parent.AppendASCII("stub_install_attributes.pb"),
130 is_absolute, 136 is_absolute,
131 create); 137 create);
132 PathService::OverrideAndCreateIfNeeded( 138 PathService::OverrideAndCreateIfNeeded(
133 FILE_MACHINE_INFO, 139 FILE_MACHINE_INFO,
134 parent.AppendASCII("stub_machine-info"), 140 parent.AppendASCII("stub_machine-info"),
135 is_absolute, 141 is_absolute,
136 create); 142 create);
143 PathService::OverrideAndCreateIfNeeded(
144 FILE_VPD,
145 parent.AppendASCII("stub_vpd"),
146 is_absolute,
147 create);
137 PathService::Override( 148 PathService::Override(
138 DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, 149 DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS,
139 parent.AppendASCII("stub_device_local_account_extensions")); 150 parent.AppendASCII("stub_device_local_account_extensions"));
140 PathService::Override( 151 PathService::Override(
141 DIR_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA, 152 DIR_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA,
142 parent.AppendASCII("stub_device_local_account_external_data")); 153 parent.AppendASCII("stub_device_local_account_external_data"));
143 PathService::Override( 154 PathService::Override(
144 DIR_DEVICE_LOCAL_ACCOUNT_COMPONENT_POLICY, 155 DIR_DEVICE_LOCAL_ACCOUNT_COMPONENT_POLICY,
145 parent.AppendASCII("stub_device_local_account_component_policy")); 156 parent.AppendASCII("stub_device_local_account_component_policy"));
146 PathService::Override( 157 PathService::Override(
147 DIR_DEVICE_EXTENSION_LOCAL_CACHE, 158 DIR_DEVICE_EXTENSION_LOCAL_CACHE,
148 parent.AppendASCII("stub_device_local_extension_cache")); 159 parent.AppendASCII("stub_device_local_extension_cache"));
149 PathService::Override( 160 PathService::Override(
150 DIR_SIGNIN_PROFILE_COMPONENT_POLICY, 161 DIR_SIGNIN_PROFILE_COMPONENT_POLICY,
151 parent.AppendASCII("stub_signin_profile_component_policy")); 162 parent.AppendASCII("stub_signin_profile_component_policy"));
152 } 163 }
153 164
154 } // namespace chromeos 165 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/chromeos_paths.h ('k') | chromeos/dbus/session_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698