Commit f8e333f0 authored by Josh Nohle's avatar Josh Nohle Committed by Commit Bot

Revert "[Nearby] Use common default device name creation for Windows"

This reverts commit 45e983ef.

Reason for revert: Seeing a build breakage on Windows (https://ci.chromium.org/p/chromium/builders/ci/win-archive-rel/17509). Reverting just to be safe.

Original change's description:
> [Nearby] Use common default device name creation for Windows
> 
> We previously handled default device name creation for Windows
> differently than we did for other non-Chrome OS platforms. The
> underlying reason appears to be that the Nearby Share service unit tests
> were using base::RunLoop().RunUntilIdle() instead of
> task_environment_.RunUntilIdle(). Because the hardware info fetch takes
> longer on Windows than other platforms, I suspect that was the reason
> only Windows was having issues. The correct run loop behavior was fixed
> in a previous CL.
> 
> Fixed: 1127603
> Change-Id: I1f10027696fb47d30ccfe0aa7b2ceb7c85de1393
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2407856
> Auto-Submit: Josh Nohle <nohle@chromium.org>
> Commit-Queue: James Vecore <vecore@google.com>
> Reviewed-by: James Vecore <vecore@google.com>
> Cr-Commit-Position: refs/heads/master@{#806466}

TBR=nohle@chromium.org,vecore@google.com

Change-Id: Ieafb3f36869b1e2dc0a1db70a379d51f85a67b79
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2407335Reviewed-by: default avatarJosh Nohle <nohle@chromium.org>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806467}
parent 45e983ef
......@@ -39,7 +39,12 @@ base::Optional<std::string> GetNameFromProfile(Profile* profile) {
return base::nullopt;
name = base::UTF16ToUTF8(user->GetDisplayName());
#else // !defined(OS_CHROMEOS)
#elif defined(OS_WIN)
// TODO(https://crbug.com/1127603): The non-Chrome OS strategy below caused
// Nearby Share service unit tests to crash on Windows trybots when we tried
// to integrate this into the Nearby Share service.
name = "First Last";
#else // !defined(OS_CHROMEOS) && !defined(OS_WIN)
ProfileAttributesEntry* entry = nullptr;
if (!g_browser_process->profile_manager()
->GetProfileAttributesStorage()
......@@ -48,7 +53,7 @@ base::Optional<std::string> GetNameFromProfile(Profile* profile) {
}
name = base::UTF16ToUTF8(entry->GetLocalProfileName());
#endif // defined(OS_CHROMEOS)
#endif
return name.empty() ? base::nullopt : base::make_optional(name);
}
......
......@@ -83,7 +83,14 @@ TEST(NearbyShareDefaultDeviceNameTest, DefaultDeviceName) {
EXPECT_EQ(std::string(kFakeNameFromProfile) + "'s " +
base::UTF16ToUTF8(ui::GetChromeOSDeviceName()),
*device_name);
#else // !defined(OS_CHROMEOS)
#elif defined(OS_WIN)
std::string expected_model_name = GetModelNameBlocking();
if (expected_model_name.empty()) {
EXPECT_TRUE(device_name->rfind("First Last's ", 0) == 0);
} else {
EXPECT_EQ("First Last's " + expected_model_name, device_name);
}
#else // !defined(OS_CHROMEOS) && !defined(OS_WIN)
std::string expected_model_name = GetModelNameBlocking();
if (expected_model_name.empty()) {
EXPECT_TRUE(
......
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