#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/path_service.h"
+#include "base/strings/string_number_conversions.h"
#include "base/synchronization/cancellation_flag.h"
#include "base/synchronization/waitable_event.h"
#include "base/sys_info.h"
const char kHardwareClassCrosSystemKey[] = "hwid";
const char kUnknownHardwareClass[] = "unknown";
+const char kSerialNumber[] = "sn";
// File to get machine hardware info from, and key/value delimiters of
// the file.
oem_manifest_loaded_ = true;
}
+ if (!base::SysInfo::IsRunningOnChromeOS() &&
+ machine_info_.find(kSerialNumber) == machine_info_.end()) {
+ // Set stub value for testing. A time value is appended to avoid clashes of
+ // the same serial for the same domain, which would invalidate earlier
+ // enrollments. A fake /tmp/machine-info file should be used instead if
+ // a stable serial is needed, e.g. to test re-enrollment.
+ base::TimeDelta time = base::Time::Now() - base::Time::UnixEpoch();
+ machine_info_[kSerialNumber] =
+ "stub_serial_number_" + base::Int64ToString(time.InSeconds());
+ }
+
// Finished loading the statistics.
on_statistics_loaded_.Signal();
VLOG(1) << "Finished loading statistics.";