Commit 69a9f1a2 authored by James Cook's avatar James Cook Committed by Commit Bot

metrics: Report special OS name for Lacros browser binary

The Lacros browser runs on Chrome OS, but reports a special OS name to
differentiate itself from the built-in ash browser + window manager
binary.

See bug for link to discussion thread.

Bug: 1096268
Test: added to components_unittests
Change-Id: I37fd53c956b69c991732f58c69a20331addfcbc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2284228Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785955}
parent f4332f96
......@@ -143,6 +143,7 @@ jumbo_static_library("metrics") {
"//base",
"//base:base_static",
"//build:branding_buildflags",
"//build:lacros_buildflags",
"//components/prefs",
"//components/variations",
"//components/version_info:version_info",
......@@ -465,6 +466,7 @@ source_set("unit_tests") {
":test_support",
":ui",
"//base/test:test_support",
"//build:lacros_buildflags",
"//components/component_updater:test_support",
"//components/encrypted_messages:encrypted_message_proto",
"//components/prefs:test_support",
......
......@@ -24,6 +24,7 @@
#include "base/system/sys_info.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/lacros_buildflags.h"
#include "components/metrics/delegating_provider.h"
#include "components/metrics/environment_recorder.h"
#include "components/metrics/histogram_encoder.h"
......@@ -208,7 +209,13 @@ void MetricsLog::RecordCoreSystemProfile(
#endif
metrics::SystemProfileProto::OS* os = system_profile->mutable_os();
#if BUILDFLAG(IS_LACROS)
// The Lacros browser runs on Chrome OS, but reports a special OS name to
// differentiate itself from the built-in ash browser + window manager binary.
os->set_name("Lacros");
#else
os->set_name(base::SysInfo::OperatingSystemName());
#endif
os->set_version(base::SysInfo::OperatingSystemVersion());
// On ChromeOS, KernelVersion refers to the Linux kernel version and
......
......@@ -19,6 +19,7 @@
#include "base/system/sys_info.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/lacros_buildflags.h"
#include "components/metrics/cpu_metrics_provider.h"
#include "components/metrics/delegating_provider.h"
#include "components/metrics/environment_recorder.h"
......@@ -167,7 +168,11 @@ TEST_F(MetricsLogTest, BasicRecord) {
hardware->set_dll_base(reinterpret_cast<uint64_t>(CURRENT_MODULE()));
#endif
#if BUILDFLAG(IS_LACROS)
system_profile->mutable_os()->set_name("Lacros");
#else
system_profile->mutable_os()->set_name(base::SysInfo::OperatingSystemName());
#endif
system_profile->mutable_os()->set_version(
base::SysInfo::OperatingSystemVersion());
#if defined(OS_CHROMEOS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment