| 
    
      
  | 
  
 Chromium Code Reviews
        
  DescriptionReenable Tabdragging tests failing because of IsWindowPositionManaged()
It used to be exiting the move loop and clearing the move_loop_widget_ before
EndDrag() had a chance to set the window position to manageable again.
This CL adds a maximized browser window waiter, and moves setting the window
position managed logic to ash.
BUG=626761, 331924
TEST=interactive_ui_tests --gtest_filter=TabDragging*
Committed: https://crrev.com/c813d7634e5c6ba6c808e326778b0cdb4f6e773c
Cr-Commit-Position: refs/heads/master@{#435638}
   
  Patch Set 1 #Patch Set 2 : Fix tests failing at IsMaximized in Chrome desktop Linux #Patch Set 3 : Test what's happening on bot! #Patch Set 4 : run test on bot #Patch Set 5 : run test on bot 3 #Patch Set 6 : I know now why the test is failing but I'll keep it disabled until we make a decision #
      Total comments: 8
      
     
  
  Patch Set 7 : pkasting comments #
      Total comments: 3
      
     
  
  Patch Set 8 : moving to ash #
      Total comments: 4
      
     
  
  Patch Set 9 : Test window position auto managed setting in ash #
      Total comments: 4
      
     
  
  Patch Set 10 : Adding a better ash test. #
 Messages
    Total messages: 82 (47 generated)
     
  
  
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) 
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 Description was changed from ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. BUG=626761 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== to ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) 
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 Patchset #6 (id:100001) has been deleted 
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...) 
 afakhry@chromium.org changed reviewers: + pkasting@chromium.org 
 pkasting, please review. Thank you! 
 I don't really know the tab_drag_controller.cc code, so I don't actually know what the change there does. You should probably have sky review that. https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller.cc:1118: move_loop_widget_ = NULL; Hmm. This block of code looks similar to code in the destructor (which calls RemoveObserver(), but only if |added_observer_to_move_loop_widget_| -- should we be checking that elsewhere too?), as well as DragBrowserToNewTabStrip() (which does all these things, but has some of them in an earlier #if ASH block -- should they indeed be ifdefed?). This makes me wonder if these sorts of things should be pulled into some kind of common "reset move loop widget" function that does the right magic voodoo. https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:814: base::Unretained(this))); Optional nit: We can save the repeated ugly PostTask() by doing something like this: if (!CheckMaximized()) { // Relies on |quit_| not being set yet quit_ = run_loop.QuitClosure(); run_loop.Run(); } ... bool CheckMaximized() { const bool maximized = window_->IsMaximized(); if (maximized) { if (!quit_.is_null()) quit_.Run(); } else { base::MessageLoop::current()->task_runner()->PostTask(... } return maximized; } This only breaks if Wait() can be called repeatedly for the same object. To avoid this, you could eliminate Wait() and move its code into the constructor body, so callers cannot wait more than once. (Or you could fix it, but that's not actually necessary today.) https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:816: CHECK(window_->IsMaximized()); Nit: CHECK in test code can causes tests to shut down uncleanly, which can leave the bot in a bad state. Generally something like ASSERT() is preferred, though in this case I'd simply omit this line entirely, since you EXPECT it in the callers already. 
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 afakhry@chromium.org changed reviewers: + sky@chromium.org 
 https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller.cc:1118: move_loop_widget_ = NULL; On 2016/11/17 01:32:49, Peter Kasting wrote: > Hmm. This block of code looks similar to code in the destructor (which calls > RemoveObserver(), but only if |added_observer_to_move_loop_widget_| -- should we > be checking that elsewhere too?), as well as DragBrowserToNewTabStrip() (which > does all these things, but has some of them in an earlier #if ASH block -- > should they indeed be ifdefed?). > > This makes me wonder if these sorts of things should be pulled into some kind of > common "reset move loop widget" function that does the right magic voodoo. I'm also not very familiar with this code. So I agree we should involve +sky@ to take a look at this. I like your suggestion of having one function that does the magic. But I'm not sure if it can be used everywhere instead of the current code that seemingly does similar things (i.e. Not all of them do exactly the same thing. For example, some depends on |added_observer_to_move_loop_widget_| some not. Some set the WindowPositionManaged to true, some not. That #if ASH you mentioned). So I think it would be better to defer to sky@ with this question. https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:814: base::Unretained(this))); On 2016/11/17 01:32:49, Peter Kasting wrote: > Optional nit: We can save the repeated ugly PostTask() by doing something like > this: > > if (!CheckMaximized()) { // Relies on |quit_| not being set yet > quit_ = run_loop.QuitClosure(); > run_loop.Run(); > } > > ... > > bool CheckMaximized() { > const bool maximized = window_->IsMaximized(); > if (maximized) { > if (!quit_.is_null()) > quit_.Run(); > } else { > base::MessageLoop::current()->task_runner()->PostTask(... > } > return maximized; > } > > This only breaks if Wait() can be called repeatedly for the same object. To > avoid this, you could eliminate Wait() and move its code into the constructor > body, so callers cannot wait more than once. (Or you could fix it, but that's > not actually necessary today.) This is a great suggestion! Thanks! Done. I'm not quite clear on why calling Wait() on the same object breaks it? Can you please clarify? https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:816: CHECK(window_->IsMaximized()); On 2016/11/17 01:32:49, Peter Kasting wrote: > Nit: CHECK in test code can causes tests to shut down uncleanly, which can leave > the bot in a bad state. Generally something like ASSERT() is preferred, though > in this case I'd simply omit this line entirely, since you EXPECT it in the > callers already. Done. Removed. 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:814: base::Unretained(this))); On 2016/11/17 22:51:05, afakhry wrote: > On 2016/11/17 01:32:49, Peter Kasting wrote: > > Optional nit: We can save the repeated ugly PostTask() by doing something like > > this: > > > > if (!CheckMaximized()) { // Relies on |quit_| not being set yet > > quit_ = run_loop.QuitClosure(); > > run_loop.Run(); > > } > > > > ... > > > > bool CheckMaximized() { > > const bool maximized = window_->IsMaximized(); > > if (maximized) { > > if (!quit_.is_null()) > > quit_.Run(); > > } else { > > base::MessageLoop::current()->task_runner()->PostTask(... > > } > > return maximized; > > } > > > > This only breaks if Wait() can be called repeatedly for the same object. To > > avoid this, you could eliminate Wait() and move its code into the constructor > > body, so callers cannot wait more than once. (Or you could fix it, but that's > > not actually necessary today.) > > This is a great suggestion! Thanks! > Done. > I'm not quite clear on why calling Wait() on the same object breaks it? Can you > please clarify? After the first Wait(), |quit_| will remain initialized. If Wait() is then called a second time, when the window is already maximized, CheckMaximized() will call quit_.Run() when the message loop is not running. This seems bad (reading the code, I think this causes the loop to immediately quit the next time someone tries to run it). 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: linux_chromium_chromeos_compile_dbg_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) 
 https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/2494713003/diff/120001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:814: base::Unretained(this))); On 2016/11/17 23:05:24, Peter Kasting wrote: > On 2016/11/17 22:51:05, afakhry wrote: > > On 2016/11/17 01:32:49, Peter Kasting wrote: > > > Optional nit: We can save the repeated ugly PostTask() by doing something > like > > > this: > > > > > > if (!CheckMaximized()) { // Relies on |quit_| not being set yet > > > quit_ = run_loop.QuitClosure(); > > > run_loop.Run(); > > > } > > > > > > ... > > > > > > bool CheckMaximized() { > > > const bool maximized = window_->IsMaximized(); > > > if (maximized) { > > > if (!quit_.is_null()) > > > quit_.Run(); > > > } else { > > > base::MessageLoop::current()->task_runner()->PostTask(... > > > } > > > return maximized; > > > } > > > > > > This only breaks if Wait() can be called repeatedly for the same object. To > > > avoid this, you could eliminate Wait() and move its code into the > constructor > > > body, so callers cannot wait more than once. (Or you could fix it, but > that's > > > not actually necessary today.) > > > > This is a great suggestion! Thanks! > > Done. > > I'm not quite clear on why calling Wait() on the same object breaks it? Can > you > > please clarify? > > After the first Wait(), |quit_| will remain initialized. If Wait() is then > called a second time, when the window is already maximized, CheckMaximized() > will call quit_.Run() when the message loop is not running. This seems bad > (reading the code, I think this causes the loop to immediately quit the next > time someone tries to run it). Yes, I also thought that's what you meant. I attempted to fix this in the new patch by: if (!quit_.is_null()) base::ResetAndReturn(&quit_).Run(); 
 The unittest LGTM. I'll leave sky to answer the questions we had about refactoring the implementation. https://codereview.chromium.org/2494713003/diff/140001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/2494713003/diff/140001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:832: base::ResetAndReturn(&quit_).Run(); Nit: Consider commenting about why ResetAndReturn() is useful here. 
 https://codereview.chromium.org/2494713003/diff/140001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/2494713003/diff/140001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller.cc:1117: SetWindowPositionManaged(move_loop_widget_->GetNativeWindow(), true); Can you clarify why tab dragging code needs to explicitly call SetWindowPositionManaged (anywhere in ths file)? It seems like this code should be entirely isolated in ash. Ash knows the drag is happening by way of RunMoveLoop() and if ash needs to disable anything at this point ash should key of RunMoveLoop. 
 https://codereview.chromium.org/2494713003/diff/140001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/2494713003/diff/140001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller.cc:1117: SetWindowPositionManaged(move_loop_widget_->GetNativeWindow(), true); On 2016/11/19 14:55:03, sky wrote: > Can you clarify why tab dragging code needs to explicitly call > SetWindowPositionManaged (anywhere in ths file)? It seems like this code should > be entirely isolated in ash. Ash knows the drag is happening by way of > RunMoveLoop() and if ash needs to disable anything at this point ash should key > of RunMoveLoop. I was hoping that you would answer this question as I'm not familiar with this code. I don't know why SetWindowPositionManaged() is called from several places in this file. As you said, SetWindowPositionManaged() seems ASH specific ... it's a no-op for non-ASH: (https://cs.chromium.org/chromium/src/chrome/browser/ui/views/tabs/tab_drag_co...). The question is, can we unify things? There are many places where we remove the observer from |move_loop_widget_| and clear it, but they're not all exactly the same. Sometimes we do that only when |added_observer_to_move_loop_widget_| is true, sometimes we call SetWindowPositionManaged(), and sometimes only #if USE_ASH. See: https://cs.chromium.org/search/?q=f:+tab_drag_controller.cc+move_loop_widget_... 
 sky@chromium.org changed reviewers: + skuhne@chromium.org 
 +skuhne Stefan added the code here: https://chromiumcodereview.appspot.com/11085053 . Stefan, the question is can we move manipulating the window position managed property from TabDragController into ash when ash starts the move loop? 
 From glancing at the code I would say yes. On Tue, Nov 22, 2016 at 12:58 PM, <sky@chromium.org> wrote: > +skuhne > Stefan added the code here: https://chromiumcodereview. > appspot.com/11085053 . > Stefan, the question is can we move manipulating the window position > managed > property from TabDragController into ash when ash starts the move loop? > > https://codereview.chromium.org/2494713003/ > -- You received this message because you are subscribed to the Google Groups "Chromium-reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org. 
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: blimp_linux_dbg on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) chromeos_daisy_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) chromium_presubmit on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_clobber_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) 
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 sky and Mr4D, PTAL. Thanks! 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: This issue passed the CQ dry run. 
 https://codereview.chromium.org/2494713003/diff/160001/ash/wm/toplevel_window... File ash/wm/toplevel_window_event_handler.cc (right): https://codereview.chromium.org/2494713003/diff/160001/ash/wm/toplevel_window... ash/wm/toplevel_window_event_handler.cc:96: window_state->set_window_position_managed(false); How about adding test coverage of this to ash? https://codereview.chromium.org/2494713003/diff/160001/ash/wm/toplevel_window... ash/wm/toplevel_window_event_handler.cc:100: window_state->set_window_position_managed(window_position_managed); I think you should assume that if 'this' has been deleted the window_state is also no longer valid. In other words, move this after line 102. 
 Description was changed from ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== to ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. This CL adds a maximized browser window waiter, and moves the setting the window position managed logic to ash. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== 
 Description was changed from ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. This CL adds a maximized browser window waiter, and moves the setting the window position managed logic to ash. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== to ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. This CL adds a maximized browser window waiter, and moves setting the window position managed logic to ash. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== 
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 https://codereview.chromium.org/2494713003/diff/160001/ash/wm/toplevel_window... File ash/wm/toplevel_window_event_handler.cc (right): https://codereview.chromium.org/2494713003/diff/160001/ash/wm/toplevel_window... ash/wm/toplevel_window_event_handler.cc:96: window_state->set_window_position_managed(false); On 2016/11/28 18:30:42, sky wrote: > How about adding test coverage of this to ash? Done. Please check if what I added is enough or more is needed. https://codereview.chromium.org/2494713003/diff/160001/ash/wm/toplevel_window... ash/wm/toplevel_window_event_handler.cc:100: window_state->set_window_position_managed(window_position_managed); On 2016/11/28 18:30:42, sky wrote: > I think you should assume that if 'this' has been deleted the window_state is > also no longer valid. In other words, move this after line 102. Done. 
 Please see comment. beside that lgtm https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... File ash/wm/toplevel_window_event_handler_unittest.cc (right): https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... ash/wm/toplevel_window_event_handler_unittest.cc:83: window_state->window_position_managed(); I might be mistaken, but is there any case where this returns true? You might want to add a unit test which adds a case where this could be tested. 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: This issue passed the CQ dry run. 
 https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:823: base::MessageLoop::current()->task_runner()->PostTask( It's generally preferable to install a listener that is notified when the change happens rather than polling. Is there a way to observer the change? 
 The CQ bit was checked by afakhry@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... File ash/wm/toplevel_window_event_handler_unittest.cc (right): https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... ash/wm/toplevel_window_event_handler_unittest.cc:83: window_state->window_position_managed(); On 2016/11/28 19:32:56, Mr4D wrote: > I might be mistaken, but is there any case where this returns true? You might > want to add a unit test which adds a case where this could be tested. Thanks for this note. Actually this test is not very accurate. I need to verify that window position auto management is disabled inside the move run loop. Please take a look at the new test I added. https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc (right): https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:823: base::MessageLoop::current()->task_runner()->PostTask( On 2016/11/28 21:31:50, sky wrote: > It's generally preferable to install a listener that is notified when the change > happens rather than polling. Is there a way to observer the change? Yes, that's the first thing I tried. I wasn't however able to find a platform-independent way to observe changes in this property. There is for example WMStateWaiter (https://cs.chromium.org/chromium/src/ui/views/widget/desktop_aura/desktop_win...), but it's only for X11. 
 sky@chromium.org changed reviewers: + erg@chromium.org 
 On 2016/11/28 22:54:25, afakhry wrote: > https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... > File ash/wm/toplevel_window_event_handler_unittest.cc (right): > > https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... > ash/wm/toplevel_window_event_handler_unittest.cc:83: > window_state->window_position_managed(); > On 2016/11/28 19:32:56, Mr4D wrote: > > I might be mistaken, but is there any case where this returns true? You might > > want to add a unit test which adds a case where this could be tested. > > Thanks for this note. Actually this test is not very accurate. I need to verify > that window position auto management is disabled inside the move run loop. > Please take a look at the new test I added. > > https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... > File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc > (right): > > https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... > chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:823: > base::MessageLoop::current()->task_runner()->PostTask( > On 2016/11/28 21:31:50, sky wrote: > > It's generally preferable to install a listener that is notified when the > change > > happens rather than polling. Is there a way to observer the change? > > Yes, that's the first thing I tried. I wasn't however able to find a > platform-independent way to observe changes in this property. > There is for example WMStateWaiter > (https://cs.chromium.org/chromium/src/ui/views/widget/desktop_aura/desktop_win...), > but it's only for X11. Is there something that is called after the minimize that makes it way to DesktopNativeWidgetAura and then widget? Perhaps the visibility or something like? +erg in case he has ideas. We're looking for a way to observe when the X11 window has become restored from a minimize. 
 On 2016/11/28 23:34:45, sky wrote: > On 2016/11/28 22:54:25, afakhry wrote: > > > https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... > > File ash/wm/toplevel_window_event_handler_unittest.cc (right): > > > > > https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... > > ash/wm/toplevel_window_event_handler_unittest.cc:83: > > window_state->window_position_managed(); > > On 2016/11/28 19:32:56, Mr4D wrote: > > > I might be mistaken, but is there any case where this returns true? You > might > > > want to add a unit test which adds a case where this could be tested. > > > > Thanks for this note. Actually this test is not very accurate. I need to > verify > > that window position auto management is disabled inside the move run loop. > > Please take a look at the new test I added. > > > > > https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... > > File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc > > (right): > > > > > https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... > > chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:823: > > base::MessageLoop::current()->task_runner()->PostTask( > > On 2016/11/28 21:31:50, sky wrote: > > > It's generally preferable to install a listener that is notified when the > > change > > > happens rather than polling. Is there a way to observer the change? > > > > Yes, that's the first thing I tried. I wasn't however able to find a > > platform-independent way to observe changes in this property. > > There is for example WMStateWaiter > > > (https://cs.chromium.org/chromium/src/ui/views/widget/desktop_aura/desktop_win...), > > but it's only for X11. > > Is there something that is called after the minimize that makes it way to > DesktopNativeWidgetAura and then widget? Perhaps the visibility or something > like? > +erg in case he has ideas. We're looking for a way to observe when the X11 > window has become restored from a minimize. Most desktop environments implement the _NET_WM standard. There is a property on windows called "_NET_WM_STATE" and we listen for x11 events relating to that in DesktopWindowTreeHostX11::DispatchEvent(). (See "case PropertyNotify:".) DWTHX11::OnWMStateUpdated() takes that value and theoretically propagates it, but it doesn't look like there's an observer that gets dispatched. 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: This issue passed the CQ dry run. 
 On 2016/11/28 23:43:19, Elliot Glaysher wrote: > On 2016/11/28 23:34:45, sky wrote: > > On 2016/11/28 22:54:25, afakhry wrote: > > > > > > https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... > > > File ash/wm/toplevel_window_event_handler_unittest.cc (right): > > > > > > > > > https://codereview.chromium.org/2494713003/diff/180001/ash/wm/toplevel_window... > > > ash/wm/toplevel_window_event_handler_unittest.cc:83: > > > window_state->window_position_managed(); > > > On 2016/11/28 19:32:56, Mr4D wrote: > > > > I might be mistaken, but is there any case where this returns true? You > > might > > > > want to add a unit test which adds a case where this could be tested. > > > > > > Thanks for this note. Actually this test is not very accurate. I need to > > verify > > > that window position auto management is disabled inside the move run loop. > > > Please take a look at the new test I added. > > > > > > > > > https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... > > > File chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc > > > (right): > > > > > > > > > https://codereview.chromium.org/2494713003/diff/180001/chrome/browser/ui/view... > > > chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc:823: > > > base::MessageLoop::current()->task_runner()->PostTask( > > > On 2016/11/28 21:31:50, sky wrote: > > > > It's generally preferable to install a listener that is notified when the > > > change > > > > happens rather than polling. Is there a way to observer the change? > > > > > > Yes, that's the first thing I tried. I wasn't however able to find a > > > platform-independent way to observe changes in this property. > > > There is for example WMStateWaiter > > > > > > (https://cs.chromium.org/chromium/src/ui/views/widget/desktop_aura/desktop_win...), > > > but it's only for X11. > > > > Is there something that is called after the minimize that makes it way to > > DesktopNativeWidgetAura and then widget? Perhaps the visibility or something > > like? > > +erg in case he has ideas. We're looking for a way to observe when the X11 > > window has become restored from a minimize. > > Most desktop environments implement the _NET_WM standard. There is a property on > windows called "_NET_WM_STATE" and we listen for x11 events relating to that in > DesktopWindowTreeHostX11::DispatchEvent(). (See "case PropertyNotify:".) > DWTHX11::OnWMStateUpdated() takes that value and theoretically propagates it, > but it doesn't look like there's an observer that gets dispatched. Just to clarify, we're looking for a way to observe when the window becomes maximized on all platforms not just X11. For X11, we have the WMStateWaiter mentioned earlier (https://cs.chromium.org/chromium/src/ui/views/widget/desktop_aura/desktop_win...). We also have WindowStateObserver::OnPostWindowStateTypeChange(), but that's only ash. 
 Friendly ping. 
 To be clear, you're pining erg here, right? On Wed, Nov 30, 2016 at 12:49 PM, <afakhry@chromium.org> wrote: > Friendly ping. > > https://codereview.chromium.org/2494713003/ -- You received this message because you are subscribed to the Google Groups "Chromium-reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org. 
 On 2016/11/30 22:03:57, sky wrote: > To be clear, you're pining erg here, right? > > On Wed, Nov 30, 2016 at 12:49 PM, <mailto:afakhry@chromium.org> wrote: > > Friendly ping. > > > > https://codereview.chromium.org/2494713003/ > > -- > You received this message because you are subscribed to the Google Groups > "Chromium-reviews" group. > To unsubscribe from this group and stop receiving emails from it, send an email > to mailto:chromium-reviews+unsubscribe@chromium.org. > (It was not clear that I was being pinged; I'm not sure what I'm supposed to be responding too.) 
 On 2016/11/30 22:15:00, Elliot Glaysher wrote: > On 2016/11/30 22:03:57, sky wrote: > > To be clear, you're pining erg here, right? > > > > On Wed, Nov 30, 2016 at 12:49 PM, <mailto:afakhry@chromium.org> wrote: > > > Friendly ping. > > > > > > https://codereview.chromium.org/2494713003/ > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Chromium-reviews" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email > > to mailto:chromium-reviews+unsubscribe@chromium.org. > > > > (It was not clear that I was being pinged; I'm not sure what I'm supposed to be > responding too.) Sorry. To clarify, I just need feedback on the new test I added in toplevel_window_event_handler_unittest.cc, as well as a suggestion on how to replace polling for a window getting maximized with a platform-independent observer that works on ash, Windows, and cocoa. I found the X11-specific WMStateWaiter [https://cs.chromium.org/chromium/src/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc?q=WMStateWaiter&sq=package:chromium&l=48&dr=CSs], and the ash-specific WindowStateObserver [https://cs.chromium.org/chromium/src/ash/common/wm/window_state_observer.h?dr=CSs&q=WindowStateObserver::OnPostWindowStateTypeChange&sq=package:chromium&l=35]. Is there something else that works in all platforms? 
 On 2016/11/30 23:40:34, afakhry wrote: > On 2016/11/30 22:15:00, Elliot Glaysher wrote: > > On 2016/11/30 22:03:57, sky wrote: > > > To be clear, you're pining erg here, right? > > > > > > On Wed, Nov 30, 2016 at 12:49 PM, <mailto:afakhry@chromium.org> wrote: > > > > Friendly ping. > > > > > > > > https://codereview.chromium.org/2494713003/ > > > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Chromium-reviews" group. > > > To unsubscribe from this group and stop receiving emails from it, send an > > email > > > to mailto:chromium-reviews+unsubscribe@chromium.org. > > > > > > > (It was not clear that I was being pinged; I'm not sure what I'm supposed to > be > > responding too.) > > Sorry. To clarify, I just need feedback on the new test I added in > toplevel_window_event_handler_unittest.cc, as well as a suggestion on how to > replace polling for a window getting maximized with a platform-independent > observer that works on ash, Windows, and cocoa. I found the X11-specific > WMStateWaiter > [https://cs.chromium.org/chromium/src/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc?q=WMStateWaiter&sq=package:chromium&l=48&dr=CSs], > and the ash-specific WindowStateObserver > [https://cs.chromium.org/chromium/src/ash/common/wm/window_state_observer.h?dr=CSs&q=WindowStateObserver::OnPostWindowStateTypeChange&sq=package:chromium&l=35]. > Is there something else that works in all platforms? I'm unaware of anyway to do this in a cross-platform way. (As you've found, WMStateWaiter will do what you want on X11, but only on X11). And the code where that's handled (DWTHX11::OnWMStateUpdated()) isn't sending an observer message when these state changes. You could add an observer interface, but to do this in a cross platform way would require adding it to the rest of the window tree hosts. As for the WindowPositionAutoManagement test, assuming you've spammed the test over and over again to check for flakiness, I don't see anything obviously wrong with it. (I'm a bit nervous about the spinning up a nested runloop multiple times in a test, but it probably doesn't matter since that should only run in an ash environment. Just do the repeated test to check for flakiness; I'm probably just over pattern matching.) 
 On 2016/11/30 23:59:28, Elliot Glaysher wrote: > On 2016/11/30 23:40:34, afakhry wrote: > > On 2016/11/30 22:15:00, Elliot Glaysher wrote: > > > On 2016/11/30 22:03:57, sky wrote: > > > > To be clear, you're pining erg here, right? > > > > > > > > On Wed, Nov 30, 2016 at 12:49 PM, <mailto:afakhry@chromium.org> wrote: > > > > > Friendly ping. > > > > > > > > > > https://codereview.chromium.org/2494713003/ > > > > > > > > -- > > > > You received this message because you are subscribed to the Google Groups > > > > "Chromium-reviews" group. > > > > To unsubscribe from this group and stop receiving emails from it, send an > > > email > > > > to mailto:chromium-reviews+unsubscribe@chromium.org. > > > > > > > > > > (It was not clear that I was being pinged; I'm not sure what I'm supposed to > > be > > > responding too.) > > > > Sorry. To clarify, I just need feedback on the new test I added in > > toplevel_window_event_handler_unittest.cc, as well as a suggestion on how to > > replace polling for a window getting maximized with a platform-independent > > observer that works on ash, Windows, and cocoa. I found the X11-specific > > WMStateWaiter > > > [https://cs.chromium.org/chromium/src/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc?q=WMStateWaiter&sq=package:chromium&l=48&dr=CSs], > > and the ash-specific WindowStateObserver > > > [https://cs.chromium.org/chromium/src/ash/common/wm/window_state_observer.h?dr=CSs&q=WindowStateObserver::OnPostWindowStateTypeChange&sq=package:chromium&l=35]. > > Is there something else that works in all platforms? > > I'm unaware of anyway to do this in a cross-platform way. (As you've found, > WMStateWaiter will do what you want on X11, but only on X11). And the code where > that's handled (DWTHX11::OnWMStateUpdated()) isn't sending an observer message > when these state changes. You could add an observer interface, but to do this in > a cross platform way would require adding it to the rest of the window tree > hosts. > > As for the WindowPositionAutoManagement test, assuming you've spammed the test > over and over again to check for flakiness, I don't see anything obviously wrong > with it. (I'm a bit nervous about the spinning up a nested runloop multiple > times in a test, but it probably doesn't matter since that should only run in an > ash environment. Just do the repeated test to check for flakiness; I'm probably > just over pattern matching.) Thanks for your feedback. The MaximizedBrowserWindowWaiter that polls the window's IsMaximized() state is only used in the file tab_drag_controller_interactive_uitest.cc. We just needed a way to wait for the window to become maximized as it happens asynchronously. The other newly added test WindowPositionAutoManagement is a separate issue testing that during the drag, the window's auto position management is disabled and restored to what it was previously when the drag completes. @sky, what do you think the way forward should be? Thanks! 
 Ok, LGTM 
 The CQ bit was checked by afakhry@chromium.org 
 The patchset sent to the CQ was uploaded after l-g-t-m from pkasting@chromium.org, skuhne@chromium.org Link to the patchset: https://codereview.chromium.org/2494713003/#ps200001 (title: "Adding a better ash test.") 
 CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 CQ is committing da patch.
Bot data: {"patchset_id": 200001, "attempt_start_ts": 1480611227364710,
"parent_rev": "d70d7bdcb3ad783076cb32b8147f7d748c716123", "commit_rev":
"4542c6b48c558e881770d487e0b765834dc87c23"}
          
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Description was changed from ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. This CL adds a maximized browser window waiter, and moves setting the window position managed logic to ash. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== to ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. This CL adds a maximized browser window waiter, and moves setting the window position managed logic to ash. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Committed patchset #10 (id:200001) 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Description was changed from ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. This CL adds a maximized browser window waiter, and moves setting the window position managed logic to ash. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* ========== to ========== Reenable Tabdragging tests failing because of IsWindowPositionManaged() It used to be exiting the move loop and clearing the move_loop_widget_ before EndDrag() had a chance to set the window position to manageable again. This CL adds a maximized browser window waiter, and moves setting the window position managed logic to ash. BUG=626761, 331924 TEST=interactive_ui_tests --gtest_filter=TabDragging* Committed: https://crrev.com/c813d7634e5c6ba6c808e326778b0cdb4f6e773c Cr-Commit-Position: refs/heads/master@{#435638} ========== 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Patchset 10 (id:??) landed as https://crrev.com/c813d7634e5c6ba6c808e326778b0cdb4f6e773c Cr-Commit-Position: refs/heads/master@{#435638} 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        On 2016/12/01 at 17:37:55, commit-bot wrote: > Patchset 10 (id:??) landed as https://crrev.com/c813d7634e5c6ba6c808e326778b0cdb4f6e773c > Cr-Commit-Position: refs/heads/master@{#435638} Any chance this is causing ash_unittests failures? https://uberchromegw.corp.google.com/i/chromium.chromiumos/builders/Linux%20C... 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        FYI: Findit identified this CL at revision 435638 as the culprit for failures in the build cycles as shown on: https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3Itb... 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        On 2016/12/01 20:31:45, findit-for-me wrote: > FYI: Findit identified this CL at revision 435638 as the culprit for > failures in the build cycles as shown on: > https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3Itb... I will land a follow-up fix to track the window deletion. Feel free to revert if it's urgent. 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        On 2016/12/01 20:43:00, afakhry wrote: > On 2016/12/01 20:31:45, findit-for-me wrote: > > FYI: Findit identified this CL at revision 435638 as the culprit for > > failures in the build cycles as shown on: > > > https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3Itb... > > I will land a follow-up fix to track the window deletion. Feel free to revert if > it's urgent. CL with fix is here: https://codereview.chromium.org/2540143004 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        On 2016/12/01 at 20:58:55, afakhry wrote: > On 2016/12/01 20:43:00, afakhry wrote: > > On 2016/12/01 20:31:45, findit-for-me wrote: > > > FYI: Findit identified this CL at revision 435638 as the culprit for > > > failures in the build cycles as shown on: > > > > > https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3Itb... > > > > I will land a follow-up fix to track the window deletion. Feel free to revert if > > it's urgent. > > CL with fix is here: https://codereview.chromium.org/2540143004 If you can't land the fix very soon, can we please revert this? That is typically how we deal with offending CLs. 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        A revert of this CL (patchset #10 id:200001) has been created in https://codereview.chromium.org/2550533002/ by rockot@chromium.org. The reason for reverting is: Causing failures in ash_unittests. See CL comments for details. If you have a fix, please reland with the fix applied..  | 
    ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
