Reland "Add a new Android.ArmCpuPart UMA."
This is a reland of 11748b2acf74a263435ac02ed42d00c5b808696a
Disables an expectation on CrOS because it fails for unknown
reasons (https://crbug.com/1166533). Also addresses one
comment from the initial CL.
Original change's description:
> Add a new Android.ArmCpuPart UMA.
>
> This will record the ARM CPU's implementer and part number values.
>
> Bug: 1164549
> Change-Id: I09ea0d852fda6b05c50a16b64bfcde6f4f5f62b6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2615326
> Commit-Queue: Robert Sesek <[email protected]>
> Reviewed-by: Nico Weber <[email protected]>
> Reviewed-by: Daniel Cheng <[email protected]>
> Reviewed-by: Jesse Doherty <[email protected]>
> Reviewed-by: Andrew Grieve <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#843243}
Bug: 1164549
Change-Id: I95d6788d62bb859bf8a71fe0e6410993f6da02f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627761
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: Jesse Doherty <[email protected]>
Commit-Queue: Robert Sesek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#843631}
diff --git a/base/cpu_unittest.cc b/base/cpu_unittest.cc
index 468debefd..988135d 100644
--- a/base/cpu_unittest.cc
+++ b/base/cpu_unittest.cc
@@ -5,6 +5,7 @@
#include "base/cpu.h"
#include "base/containers/contains.h"
#include "base/logging.h"
+#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -190,3 +191,21 @@
EXPECT_EQ(ext_model, 7);
}
#endif // defined(ARCH_CPU_X86_FAMILY)
+
+#if defined(ARCH_CPU_ARM_FAMILY) && \
+ (defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_CHROMEOS))
+TEST(CPU, ARMImplementerAndPartNumber) {
+ base::CPU cpu;
+
+ const std::string& cpu_brand = cpu.cpu_brand();
+
+ // Some CrOS CQ bots do not report a cpu_brand https://crbug.com/1166533.
+#if !defined(OS_CHROMEOS)
+ EXPECT_FALSE(cpu_brand.empty());
+#endif
+ EXPECT_EQ(cpu_brand, base::TrimWhitespaceASCII(cpu_brand, base::TRIM_ALL));
+ EXPECT_GT(cpu.implementer(), 0u);
+ EXPECT_GT(cpu.part_number(), 0u);
+}
+#endif // defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_LINUX) ||
+ // defined(OS_ANDROID) || defined(OS_CHROMEOS))