Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: ui/views/test/widget_test.h

Issue 2875513003: cleanup: make WidgetClosingObserver as test support (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/passwords/password_dialog_view_browsertest.cc ('k') | ui/views/test/widget_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698