OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BASE_TEST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 class HTTPSForwarder; | 31 class HTTPSForwarder; |
32 class NetworkPortalDetectorTestImpl; | 32 class NetworkPortalDetectorTestImpl; |
33 | 33 |
34 // Base class for OOBE, login, SAML and Kiosk tests. | 34 // Base class for OOBE, login, SAML and Kiosk tests. |
35 class OobeBaseTest : public ExtensionApiTest { | 35 class OobeBaseTest : public ExtensionApiTest { |
36 public: | 36 public: |
37 OobeBaseTest(); | 37 OobeBaseTest(); |
38 ~OobeBaseTest() override; | 38 ~OobeBaseTest() override; |
39 | 39 |
| 40 // Subclasses may register their own custom request handlers that will |
| 41 // process requests prior it gets handled by FakeGaia instance. |
| 42 virtual void RegisterAdditionalRequestHandlers(); |
| 43 |
40 protected: | 44 protected: |
41 // InProcessBrowserTest overrides. | 45 // InProcessBrowserTest overrides. |
42 void SetUp() override; | 46 void SetUp() override; |
43 void SetUpInProcessBrowserTestFixture() override; | 47 void SetUpInProcessBrowserTestFixture() override; |
44 bool SetUpUserDataDirectory() override; | 48 bool SetUpUserDataDirectory() override; |
45 void SetUpOnMainThread() override; | 49 void SetUpOnMainThread() override; |
46 void TearDownOnMainThread() override; | 50 void TearDownOnMainThread() override; |
47 void SetUpCommandLine(base::CommandLine* command_line) override; | 51 void SetUpCommandLine(base::CommandLine* command_line) override; |
48 | 52 |
49 virtual void InitHttpsForwarders(); | 53 virtual void InitHttpsForwarders(); |
50 | 54 |
51 // Network status control functions. | 55 // Network status control functions. |
52 void SimulateNetworkOffline(); | 56 void SimulateNetworkOffline(); |
53 void SimulateNetworkOnline(); | 57 void SimulateNetworkOnline(); |
54 void SimulateNetworkPortal(); | 58 void SimulateNetworkPortal(); |
55 | 59 |
56 base::Closure SimulateNetworkOfflineClosure(); | 60 base::Closure SimulateNetworkOfflineClosure(); |
57 base::Closure SimulateNetworkOnlineClosure(); | 61 base::Closure SimulateNetworkOnlineClosure(); |
58 base::Closure SimulateNetworkPortalClosure(); | 62 base::Closure SimulateNetworkPortalClosure(); |
59 | 63 |
60 // Checks JavaScript |expression| in login screen. | 64 // Checks JavaScript |expression| in login screen. |
61 void JsExpect(const std::string& expression); | 65 void JsExpect(const std::string& expression); |
62 | 66 |
63 // Returns chrome://oobe WebUI. | 67 // Returns chrome://oobe WebUI. |
64 content::WebUI* GetLoginUI(); | 68 content::WebUI* GetLoginUI(); |
65 | 69 |
66 // Returns login display. | 70 // Returns login display. |
67 WebUILoginDisplay* GetLoginDisplay(); | 71 WebUILoginDisplay* GetLoginDisplay(); |
68 | 72 |
| 73 void WaitForGaiaPageLoad(); |
69 void WaitForSigninScreen(); | 74 void WaitForSigninScreen(); |
70 void ExecuteJsInSigninFrame(const std::string& js); | 75 void ExecuteJsInSigninFrame(const std::string& js); |
71 void SetSignFormField(const std::string& field_id, | 76 void SetSignFormField(const std::string& field_id, |
72 const std::string& field_value); | 77 const std::string& field_value); |
73 | 78 |
74 scoped_ptr<FakeGaia> fake_gaia_; | 79 scoped_ptr<FakeGaia> fake_gaia_; |
75 NetworkPortalDetectorTestImpl* network_portal_detector_; | 80 NetworkPortalDetectorTestImpl* network_portal_detector_; |
76 | 81 |
77 // Whether to use background networking. Note this is only effective when it | 82 // Whether to use background networking. Note this is only effective when it |
78 // is set before SetUpCommandLine is invoked. | 83 // is set before SetUpCommandLine is invoked. |
79 bool needs_background_networking_; | 84 bool needs_background_networking_; |
80 | 85 |
81 scoped_ptr<content::WindowedNotificationObserver> login_screen_load_observer_; | 86 scoped_ptr<content::WindowedNotificationObserver> login_screen_load_observer_; |
82 scoped_ptr<extensions::ScopedCurrentChannel> scoped_channel_; | 87 scoped_ptr<extensions::ScopedCurrentChannel> scoped_channel_; |
83 scoped_ptr<HTTPSForwarder> gaia_https_forwarder_; | 88 scoped_ptr<HTTPSForwarder> gaia_https_forwarder_; |
84 std::string gaia_frame_parent_; | 89 std::string gaia_frame_parent_; |
85 bool use_webview_; | 90 bool use_webview_; |
86 | 91 |
87 DISALLOW_COPY_AND_ASSIGN(OobeBaseTest); | 92 DISALLOW_COPY_AND_ASSIGN(OobeBaseTest); |
88 }; | 93 }; |
89 | 94 |
90 } // namespace chromeos | 95 } // namespace chromeos |
91 | 96 |
92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ | 97 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ |
OLD | NEW |