Use machine-info stub with serial number for CHROMEOS=1 builds.
The current practice is reading the serial number from
/tmp/machine-info if it exists and generating a random one
otherwise. This makes re-enrollment testing (which requires a
stable serial number) somewhat cumbersome.
This CL creates a machine-info stub in the profile directory so
that re-enrollment can be tested without the need of manually
creating a stub file and without interference between multiple
profiles on the same machine.
BUG=none
Review URL: https://codereview.chromium.org/790673003
Cr-Commit-Position: refs/heads/master@{#308852}
diff --git a/chromeos/chromeos_paths.cc b/chromeos/chromeos_paths.cc
index 659c240..07b7f9f 100644
--- a/chromeos/chromeos_paths.cc
+++ b/chromeos/chromeos_paths.cc
@@ -29,6 +29,9 @@
const base::FilePath::CharType kInstallAttributesFileName[] =
FILE_PATH_LITERAL("/var/run/lockbox/install_attributes.pb");
+const base::FilePath::CharType kMachineHardwareInfoFileName[] =
+ FILE_PATH_LITERAL("/tmp/machine-info");
+
const base::FilePath::CharType kUptimeFileName[] =
FILE_PATH_LITERAL("/proc/uptime");
@@ -58,6 +61,9 @@
case FILE_INSTALL_ATTRIBUTES:
*result = base::FilePath(kInstallAttributesFileName);
break;
+ case FILE_MACHINE_INFO:
+ *result = base::FilePath(kMachineHardwareInfoFileName);
+ break;
case FILE_UPTIME:
*result = base::FilePath(kUptimeFileName);
break;
@@ -105,6 +111,11 @@
parent.AppendASCII("stub_install_attributes.pb"),
is_absolute,
create);
+ PathService::OverrideAndCreateIfNeeded(
+ FILE_MACHINE_INFO,
+ parent.AppendASCII("stub_machine-info"),
+ is_absolute,
+ create);
PathService::Override(
DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS,
parent.AppendASCII("stub_device_local_account_extensions"));