Commit 31f8df48 authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Commit Bot

Win Native Notifications: Don't abort if AllowSetForegroundWindow fails.

It may have unwanted side-effects in the Action Center and is really
a benign failure.

Bug: 841475, 837796, 734095
Change-Id: I61cc2736742a50de72fd5a5b9c87ae233ff9a5f0
Reviewed-on: https://chromium-review.googlesource.com/1061414
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559508}
parent 3c9be59d
...@@ -241,14 +241,7 @@ class NotificationHelperLaunchesChrome : public testing::Test { ...@@ -241,14 +241,7 @@ class NotificationHelperLaunchesChrome : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(NotificationHelperLaunchesChrome); DISALLOW_COPY_AND_ASSIGN(NotificationHelperLaunchesChrome);
}; };
// TODO(https://crbug.com/841475): Test is flaky on Win10. Re-enable after TEST_F(NotificationHelperLaunchesChrome, ChromeLaunchTest) {
// unflaking.
#if defined(OS_WIN)
#define MAYBE_ChromeLaunchTest DISABLED_ChromeLaunchTest
#else
#define MAYBE_ChromeLaunchTest ChromeLaunchTest
#endif
TEST_F(NotificationHelperLaunchesChrome, MAYBE_ChromeLaunchTest) {
// This test requires WinRT core functions, which are not available in // This test requires WinRT core functions, which are not available in
// older versions of Windows. // older versions of Windows.
if (base::win::GetVersion() < base::win::VERSION_WIN8) if (base::win::GetVersion() < base::win::VERSION_WIN8)
...@@ -267,7 +260,7 @@ TEST_F(NotificationHelperLaunchesChrome, MAYBE_ChromeLaunchTest) { ...@@ -267,7 +260,7 @@ TEST_F(NotificationHelperLaunchesChrome, MAYBE_ChromeLaunchTest) {
IID_PPV_ARGS(&notification_activator))); IID_PPV_ARGS(&notification_activator)));
ASSERT_TRUE(notification_activator); ASSERT_TRUE(notification_activator);
ASSERT_HRESULT_SUCCEEDED( EXPECT_HRESULT_SUCCEEDED(
::CoAllowSetForegroundWindow(notification_activator.Get(), nullptr)); ::CoAllowSetForegroundWindow(notification_activator.Get(), nullptr));
// The notification_helper server is now invoked upon the request of creating // The notification_helper server is now invoked upon the request of creating
......
...@@ -94,10 +94,14 @@ HRESULT NotificationActivator::Activate( ...@@ -94,10 +94,14 @@ HRESULT NotificationActivator::Activate(
base::Process process(info.hProcess); base::Process process(info.hProcess);
DWORD pid = ::GetProcessId(process.Handle()); DWORD pid = ::GetProcessId(process.Handle());
if (!::AllowSetForegroundWindow(pid)) { if (!::AllowSetForegroundWindow(pid)) {
#if !defined(NDEBUG)
DWORD error_code = ::GetLastError(); DWORD error_code = ::GetLastError();
Trace(L"Unable to forward activation privilege; error: 0x%08X\n", Trace(L"Unable to forward activation privilege; error: 0x%08X\n",
error_code); error_code);
return HRESULT_FROM_WIN32(error_code); #endif
// The lack of ability to set the window to foreground is not reason
// enough to fail the activation call. The user will see the Chrome icon
// flash in the task bar if this happens, which is a graceful failure.
} }
} }
......
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