Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / login / test / oobe_screen_waiter.h
blob4f93790f10cd954bf8f3d8caf2da2661b7a5b4df
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_
8 #include "base/basictypes.h"
9 #include "chrome/browser/chromeos/login/ui/oobe_display.h"
10 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
12 namespace content {
13 class MessageLoopRunner;
16 namespace chromeos {
18 // A waiter that blocks until the expected oobe screen is reached.
19 class OobeScreenWaiter : public OobeUI::Observer {
20 public:
21 explicit OobeScreenWaiter(OobeDisplay::Screen expected_screen);
22 ~OobeScreenWaiter() override;
24 // Run message loop to wait for the expected_screen.
25 void Wait();
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();
32 // OobeUI::Observer implementation:
33 void OnCurrentScreenChanged(OobeDisplay::Screen current_screen,
34 OobeDisplay::Screen new_screen) override;
36 private:
37 OobeUI* GetOobeUI();
39 bool waiting_for_screen_;
40 OobeDisplay::Screen expected_screen_;
41 scoped_refptr<content::MessageLoopRunner> runner_;
43 DISALLOW_COPY_AND_ASSIGN(OobeScreenWaiter);
46 } // namespace chromeos
48 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_SCREEN_WAITER_H_