Commit 1695ba44 authored by proberge's avatar proberge Committed by Commit Bot

Settings hardening: add a test for empty legacy device ids

The test validates that empty legacy device ids properly validate prefs
as VALID_SECURE_LEGACY. The name and expectations will be changed in
https://chromium-review.googlesource.com/c/chromium/src/+/655929 which
disallows empty legacy device ids.

Bug: 500085
Change-Id: Id99434c6441928b0faaeb1d5f7357d99fe8ef9a6
Reviewed-on: https://chromium-review.googlesource.com/685483
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504480}
parent 6468d308
...@@ -196,3 +196,17 @@ TEST(PrefHashCalculatorTest, TestCompatibilityWithLegacyDeviceId) { ...@@ -196,3 +196,17 @@ TEST(PrefHashCalculatorTest, TestCompatibilityWithLegacyDeviceId) {
PrefHashCalculator(kSeed, kNewDeviceId, kLegacyDeviceId) PrefHashCalculator(kSeed, kNewDeviceId, kLegacyDeviceId)
.Validate("pref.path", &string_value, kExpectedValue)); .Validate("pref.path", &string_value, kExpectedValue));
} }
TEST(PrefHashCalculatorTest, TestCompatibleWithEmptyLegacyDeviceId) {
static const char kSeed[] = "0123456789ABCDEF0123456789ABCDEF";
static const char kNewDeviceId[] = "unused";
static const char kLegacyDeviceId[] = "";
const base::Value string_value("testing with special chars:\n<>{}:^^@#$\\/");
static const char kExpectedValue[] =
"F14F989B7CAABF3B36ECAE34492C4D8094D2500E7A86D9A3203E54B274C27CB5";
EXPECT_EQ(PrefHashCalculator::VALID_SECURE_LEGACY,
PrefHashCalculator(kSeed, kNewDeviceId, kLegacyDeviceId)
.Validate("pref.path", &string_value, kExpectedValue));
}
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