Commit 8f881f8c authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Add test for GuestOsRegistryService terminal pref/app merge

Bug introduced in crrev.com/c/2318945 / 86.0.4215.0
Fixed already in crrev.com/c/2326552 / 86.0.4218.0

This test verifies that even when Terminal has some pref values, it
correctly merges with app values and creates a valid registration.

Bug: 1113477
Change-Id: I3a51ae3713384284075677d2e531c28aa901e780
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340345Reviewed-by: default avatarDavid Munro <davidmunro@google.com>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795350}
parent 0fdb3281
......@@ -522,4 +522,26 @@ TEST_F(GuestOsRegistryServiceTest, MigrateTerminal) {
->HasKey(crostini::kCrostiniDeletedTerminalId));
}
// Validates crash fix from crbug.com/1113477.
TEST_F(GuestOsRegistryServiceTest, TerminalPrefsAppMerge) {
// Add prefs entry for terminal.
base::DictionaryValue registry;
registry.SetKey(crostini::kCrostiniTerminalSystemAppId,
base::DictionaryValue());
profile()->GetPrefs()->Set(guest_os::prefs::kGuestOsRegistry,
std::move(registry));
// Pref values should merge with app values, and reading Terminal VmName
// should not crash.
bool terminal_found = false;
for (const auto& pair : service()->GetAllRegisteredApps()) {
const auto& registration = pair.second;
if (registration.app_id() == crostini::kCrostiniTerminalSystemAppId) {
terminal_found = true;
EXPECT_EQ(crostini::kCrostiniDefaultVmName, registration.VmName());
}
}
EXPECT_TRUE(terminal_found);
}
} // namespace guest_os
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