New issue
Advanced search Search tips

Issue 777017 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Oct 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

wm::CanActivateWindow(window) returns true for a to-be-destroyed window in unittests.

Project Member Reported by x...@chromium.org, Oct 20 2017

Issue description

Chrome Version: (copy from chrome://version)
OS: Chrome

In tests environment, if a window is to be destroyed, it should not be regarded as activatable any more. 

However, currently in OnWindowDestroying(window), the to-be-destroyed window is still visible and is regarded as activatable,  i.e., wm::CanActivateWindow(window) still returns true in this case, which cause MRUWindowTracker not get a correct window list to cycle through.

NOTE: only happens in tests environment
 

Comment 1 by sky@chromium.org, Oct 20 2017

I wouldn't try to change CanActivateWindow() to deal with this, rather make the tests hide the windows.

Comment 2 by x...@chromium.org, Oct 20 2017

Description: Show this description

Comment 3 by x...@chromium.org, Oct 20 2017

Re sky: Thanks! 
Shall we change TestWindowDelegate to handle this? In Window destructor, it will call WindowDelegate::OnWindowDestroying() first and then notify its observers. Maybe we should the window first in TestWindowDelegate::OnWindowDestroying()? 
(Actually I tried to do this in TestWindowDelegate::OnWindowDestroying(), but it broke a lot of unittests which I could not figure out why. So instead to modify TestWindowDelegate, I created a customized subclass overriding TestWindowDelegate to handle my test cases as a workaround. But I don't know if it's an issue that we should fix it in a general place)

Comment 4 by sky@chromium.org, Oct 24 2017

What specific tests are failing? I'm inclined to make the test explicitly hide the window first. I suspect it isn't necessary to do this in TestWindowDelegate, rather from the test itself.

Comment 5 by x...@chromium.org, Oct 24 2017

Currently there is no test failing because of this. But with my CL https://chromium-review.googlesource.com/c/chromium/src/+/734809 in place, several unittests in split_view_controller_unittest.cc and window_selector_unittest.cc are failing. 

The reason is in SplitViewController::OnWindowDestroying(window), it's possible that it will start the overview mode. MRU window list is calculated here to decide which window should be put in overview window grid. The to-be-destroyed window should not put in the MRU window list otherwise it will cause crash when the overview window grid tries to access the window. 

As you suggested, I created a customized TestWindowDelegate and override OnWindowDestroying() to hide the window first to fix these tests. If it's unnecessary to (or should not) do this in TestWindowDelegate, I'll close this issue then.

Comment 6 by x...@chromium.org, Oct 27 2017

Status: WontFix (was: Assigned)
Close this.

Sign in to add a comment