Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_TEST_WIDGET_TEST_H_ | 5 #ifndef UI_VIEWS_TEST_WIDGET_TEST_H_ |
| 6 #define UI_VIEWS_TEST_WIDGET_TEST_H_ | 6 #define UI_VIEWS_TEST_WIDGET_TEST_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/views/test/views_test_base.h" | 12 #include "ui/views/test/views_test_base.h" |
| 12 #include "ui/views/widget/widget_delegate.h" | 13 #include "ui/views/widget/widget_delegate.h" |
| 14 #include "ui/views/widget/widget_observer.h" | |
| 13 | 15 |
| 14 namespace ui { | 16 namespace ui { |
| 15 namespace internal { | 17 namespace internal { |
| 16 class InputMethodDelegate; | 18 class InputMethodDelegate; |
| 17 } | 19 } |
| 18 class EventProcessor; | 20 class EventProcessor; |
| 19 } | 21 } |
| 20 | 22 |
| 21 namespace views { | 23 namespace views { |
| 22 | 24 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 | 148 |
| 147 // WidgetDelegate override: | 149 // WidgetDelegate override: |
| 148 View* GetInitiallyFocusedView() override; | 150 View* GetInitiallyFocusedView() override; |
| 149 | 151 |
| 150 private: | 152 private: |
| 151 View* view_; | 153 View* view_; |
| 152 | 154 |
| 153 DISALLOW_COPY_AND_ASSIGN(TestInitialFocusWidgetDelegate); | 155 DISALLOW_COPY_AND_ASSIGN(TestInitialFocusWidgetDelegate); |
| 154 }; | 156 }; |
| 155 | 157 |
| 158 // Spins a run loop until a Widget's activation reaches the desired state. | |
| 159 class WidgetActivationWaiter : public WidgetObserver { | |
| 160 public: | |
| 161 WidgetActivationWaiter(Widget* widget, bool active); | |
| 162 ~WidgetActivationWaiter() override; | |
| 163 | |
| 164 void Wait(); | |
|
sky
2016/10/12 16:05:43
Document what this does.
Qiang(Joe) Xu
2016/10/12 16:55:58
Done.
| |
| 165 | |
| 166 private: | |
| 167 // views::WidgetObserver override: | |
| 168 void OnWidgetActivationChanged(Widget* widget, bool active) override; | |
| 169 | |
| 170 base::RunLoop run_loop_; | |
| 171 bool observed_; | |
| 172 bool active_; | |
| 173 | |
| 174 DISALLOW_COPY_AND_ASSIGN(WidgetActivationWaiter); | |
| 175 }; | |
| 176 | |
| 156 } // namespace test | 177 } // namespace test |
| 157 } // namespace views | 178 } // namespace views |
| 158 | 179 |
| 159 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_ | 180 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_ |
| OLD | NEW |