Commit 8747d18f authored by jamescook's avatar jamescook Committed by Commit bot

cros: Fix unit_tests crashes in GetBrand() on official builders

unit_tests do not have prefs, but branded builds on Chrome OS attempt to read
the brand code out of a null g_browser_process->local_state().

Instead, we now return an empty brand code in tests.

This reduces the number of crashing unit_tests on the official builders from
~300 to ~30.

BUG=430266

Review URL: https://codereview.chromium.org/703623005

Cr-Commit-Position: refs/heads/master@{#302733}
parent 25e2aae9
......@@ -59,7 +59,9 @@ std::string GetBrand() {
content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (g_brand_empty)
return std::string();
DCHECK(g_browser_process->local_state());
// Unit tests do not have prefs.
if (!g_browser_process->local_state())
return std::string();
return g_browser_process->local_state()->GetString(prefs::kRLZBrand);
}
......
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