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 CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/chromeos/login/oobe_display.h" | 9 #include "chrome/browser/chromeos/login/oobe_display.h" |
10 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 10 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class MessageLoopRunner; | 13 class MessageLoopRunner; |
14 } | 14 } |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 // A waiter that blocks until the expected oobe screen is reached. | 18 // A waiter that blocks until the expected oobe screen is reached. |
19 class OobeScreenWaiter : public OobeUI::Observer { | 19 class OobeScreenWaiter : public OobeUI::Observer { |
20 public: | 20 public: |
21 explicit OobeScreenWaiter(OobeDisplay::Screen expected_screen); | 21 explicit OobeScreenWaiter(OobeDisplay::Screen expected_screen); |
22 virtual ~OobeScreenWaiter(); | 22 virtual ~OobeScreenWaiter(); |
23 | 23 |
| 24 // Run message loop to wait for the expected_screen. |
24 void Wait(); | 25 void Wait(); |
25 | 26 |
| 27 // Similar to Wait() but does not assert the current screen is |
| 28 // expected_screen on exit. Use this when there are multiple screen changes |
| 29 // during the wait and the screen to be waited is not the final one. |
| 30 void WaitNoAssertCurrentScreen(); |
| 31 |
26 // OobeUI::Observer implementation: | 32 // OobeUI::Observer implementation: |
27 virtual void OnCurrentScreenChanged( | 33 virtual void OnCurrentScreenChanged( |
28 OobeDisplay::Screen current_screen, | 34 OobeDisplay::Screen current_screen, |
29 OobeDisplay::Screen new_screen) OVERRIDE; | 35 OobeDisplay::Screen new_screen) OVERRIDE; |
30 | 36 |
31 private: | 37 private: |
32 OobeUI* GetOobeUI(); | 38 OobeUI* GetOobeUI(); |
33 | 39 |
34 bool waiting_for_screen_; | 40 bool waiting_for_screen_; |
35 OobeDisplay::Screen expected_screen_; | 41 OobeDisplay::Screen expected_screen_; |
36 scoped_refptr<content::MessageLoopRunner> runner_; | 42 scoped_refptr<content::MessageLoopRunner> runner_; |
37 | 43 |
38 DISALLOW_COPY_AND_ASSIGN(OobeScreenWaiter); | 44 DISALLOW_COPY_AND_ASSIGN(OobeScreenWaiter); |
39 }; | 45 }; |
40 | 46 |
41 | 47 |
42 } // namespace chromeos | 48 } // namespace chromeos |
43 | 49 |
44 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_ | 50 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_ |
OLD | NEW |