| Index: ui/views/widget/widget_interactive_uitest.cc
|
| diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
|
| index 141220c5fb59ca6d1b53a46dc32c4c8b24d056b1..230a720714384882c112f554ef67121b07f8f3a2 100644
|
| --- a/ui/views/widget/widget_interactive_uitest.cc
|
| +++ b/ui/views/widget/widget_interactive_uitest.cc
|
| @@ -156,49 +156,6 @@ class NestedLoopCaptureView : public View {
|
| DISALLOW_COPY_AND_ASSIGN(NestedLoopCaptureView);
|
| };
|
|
|
| -// Spins a run loop until a Widget's active state matches a desired state.
|
| -class WidgetActivationWaiter : public WidgetObserver {
|
| - public:
|
| - WidgetActivationWaiter(Widget* widget, bool active) : observed_(false) {
|
| -#if defined(OS_WIN)
|
| - // On Windows, a HWND can receive a WM_ACTIVATE message without the value
|
| - // of ::GetActiveWindow() updating to reflect that change. This can cause
|
| - // the active window reported by IsActive() to get out of sync. Usually this
|
| - // happens after a call to HWNDMessageHandler::Deactivate() which works by
|
| - // activating some other window, which might be in another application.
|
| - // Doing this can trigger the native OS activation-blocker, causing the
|
| - // taskbar icon to flash instead. But since activation of native widgets on
|
| - // Windows is synchronous, we never have to wait anyway, so it's safe to
|
| - // return here.
|
| - if (active == widget->IsActive()) {
|
| - observed_ = true;
|
| - return;
|
| - }
|
| -#endif
|
| - // Always expect a change for tests using this.
|
| - EXPECT_NE(active, widget->IsActive());
|
| - widget->AddObserver(this);
|
| - }
|
| -
|
| - void Wait() {
|
| - if (!observed_)
|
| - run_loop_.Run();
|
| - }
|
| -
|
| - void OnWidgetActivationChanged(Widget* widget, bool active) override {
|
| - observed_ = true;
|
| - widget->RemoveObserver(this);
|
| - if (run_loop_.running())
|
| - run_loop_.Quit();
|
| - }
|
| -
|
| - private:
|
| - base::RunLoop run_loop_;
|
| - bool observed_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(WidgetActivationWaiter);
|
| -};
|
| -
|
| ui::WindowShowState GetWidgetShowState(const Widget* widget) {
|
| // Use IsMaximized/IsMinimized/IsFullScreen instead of GetWindowPlacement
|
| // because the former is implemented on all platforms but the latter is not.
|
| @@ -225,7 +182,7 @@ void RunPendingMessagesForActiveStatusChange() {
|
| // this is just an activation. For other widgets, it means activating and then
|
| // spinning the run loop until the OS has activated the window.
|
| void ActivateSync(Widget* widget) {
|
| - WidgetActivationWaiter waiter(widget, true);
|
| + views::test::WidgetActivationWaiter waiter(widget, true);
|
| widget->Activate();
|
| waiter.Wait();
|
| }
|
| @@ -233,7 +190,7 @@ void ActivateSync(Widget* widget) {
|
| // Like for ActivateSync(), wait for a widget to become active, but Show() the
|
| // widget rather than calling Activate().
|
| void ShowSync(Widget* widget) {
|
| - WidgetActivationWaiter waiter(widget, true);
|
| + views::test::WidgetActivationWaiter waiter(widget, true);
|
| widget->Show();
|
| waiter.Wait();
|
| }
|
| @@ -252,7 +209,7 @@ void DeactivateSync(Widget* widget) {
|
| stealer->CloseNow();
|
| widget->widget_delegate()->set_can_activate(true);
|
| #else
|
| - WidgetActivationWaiter waiter(widget, false);
|
| + views::test::WidgetActivationWaiter waiter(widget, false);
|
| widget->Deactivate();
|
| waiter.Wait();
|
| #endif
|
| @@ -926,7 +883,7 @@ TEST_F(WidgetTestInteractive, WindowModalWindowDestroyedActivationTest) {
|
| #if defined(OS_MACOSX)
|
| // Window modal dialogs on Mac are "sheets", which animate to close before
|
| // activating their parent widget.
|
| - WidgetActivationWaiter waiter(&top_level_widget, true);
|
| + views::test::WidgetActivationWaiter waiter(&top_level_widget, true);
|
| modal_dialog_widget->Close();
|
| waiter.Wait();
|
| #else
|
|
|