| 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 "base/run_loop.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // views::WidgetObserver override: | 170 // views::WidgetObserver override: |
| 171 void OnWidgetActivationChanged(Widget* widget, bool active) override; | 171 void OnWidgetActivationChanged(Widget* widget, bool active) override; |
| 172 | 172 |
| 173 base::RunLoop run_loop_; | 173 base::RunLoop run_loop_; |
| 174 bool observed_; | 174 bool observed_; |
| 175 bool active_; | 175 bool active_; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(WidgetActivationWaiter); | 177 DISALLOW_COPY_AND_ASSIGN(WidgetActivationWaiter); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 // Use in tests to provide functionality to observe the widget passed in the |
| 181 // constructor for the widget closing event. |
| 182 class WidgetClosingObserver : public WidgetObserver { |
| 183 public: |
| 184 explicit WidgetClosingObserver(Widget* widget); |
| 185 ~WidgetClosingObserver() override; |
| 186 |
| 187 bool widget_closed() const { return !widget_; } |
| 188 |
| 189 private: |
| 190 // views::WidgetObserver override: |
| 191 void OnWidgetClosing(Widget* widget) override; |
| 192 |
| 193 Widget* widget_; |
| 194 |
| 195 DISALLOW_COPY_AND_ASSIGN(WidgetClosingObserver); |
| 196 }; |
| 197 |
| 180 } // namespace test | 198 } // namespace test |
| 181 } // namespace views | 199 } // namespace views |
| 182 | 200 |
| 183 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_ | 201 #endif // UI_VIEWS_TEST_WIDGET_TEST_H_ |
| OLD | NEW |