Chromium Code Reviews| Index: ui/views/test/widget_test.h |
| diff --git a/ui/views/test/widget_test.h b/ui/views/test/widget_test.h |
| index fe04891ec8648d1d735c5df4fd84a656257d21b3..5b02be7805dc395d01d73f464c26e7902963a0b4 100644 |
| --- a/ui/views/test/widget_test.h |
| +++ b/ui/views/test/widget_test.h |
| @@ -6,10 +6,12 @@ |
| #define UI_VIEWS_TEST_WIDGET_TEST_H_ |
| #include "base/macros.h" |
| +#include "base/run_loop.h" |
| #include "build/build_config.h" |
| #include "ui/gfx/native_widget_types.h" |
| #include "ui/views/test/views_test_base.h" |
| #include "ui/views/widget/widget_delegate.h" |
| +#include "ui/views/widget/widget_observer.h" |
| namespace ui { |
| namespace internal { |
| @@ -153,6 +155,25 @@ class TestInitialFocusWidgetDelegate : public TestDesktopWidgetDelegate { |
| DISALLOW_COPY_AND_ASSIGN(TestInitialFocusWidgetDelegate); |
| }; |
| +// Spins a run loop until a Widget's activation reaches the desired state. |
| +class WidgetActivationWaiter : public WidgetObserver { |
| + public: |
| + WidgetActivationWaiter(Widget* widget, bool active); |
| + ~WidgetActivationWaiter() override; |
| + |
| + void Wait(); |
|
sky
2016/10/12 16:05:43
Document what this does.
Qiang(Joe) Xu
2016/10/12 16:55:58
Done.
|
| + |
| + private: |
| + // views::WidgetObserver override: |
| + void OnWidgetActivationChanged(Widget* widget, bool active) override; |
| + |
| + base::RunLoop run_loop_; |
| + bool observed_; |
| + bool active_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WidgetActivationWaiter); |
| +}; |
| + |
| } // namespace test |
| } // namespace views |