| 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 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace chromeos { | 29 namespace chromeos { |
| 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 // Default fake user email and password, may be used by tests. | |
| 38 | |
| 39 static const char kFakeUserEmail[]; | |
| 40 static const char kFakeUserPassword[]; | |
| 41 | |
| 42 // FakeGaia is configured to return these cookies for kFakeUserEmail. | |
| 43 static const char kFakeSIDCookie[]; | |
| 44 static const char kFakeLSIDCookie[]; | |
| 45 | |
| 46 OobeBaseTest(); | 37 OobeBaseTest(); |
| 47 ~OobeBaseTest() override; | 38 ~OobeBaseTest() override; |
| 48 | 39 |
| 49 // Subclasses may register their own custom request handlers that will | |
| 50 // process requests prior it gets handled by FakeGaia instance. | |
| 51 virtual void RegisterAdditionalRequestHandlers(); | |
| 52 | |
| 53 protected: | 40 protected: |
| 54 // InProcessBrowserTest overrides. | 41 // InProcessBrowserTest overrides. |
| 55 void SetUp() override; | 42 void SetUp() override; |
| 56 void SetUpInProcessBrowserTestFixture() override; | 43 void SetUpInProcessBrowserTestFixture() override; |
| 57 bool SetUpUserDataDirectory() override; | 44 bool SetUpUserDataDirectory() override; |
| 58 void SetUpOnMainThread() override; | 45 void SetUpOnMainThread() override; |
| 59 void TearDownOnMainThread() override; | 46 void TearDownOnMainThread() override; |
| 60 void SetUpCommandLine(base::CommandLine* command_line) override; | 47 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 61 | 48 |
| 62 virtual void InitHttpsForwarders(); | 49 virtual void InitHttpsForwarders(); |
| 63 | 50 |
| 64 // Network status control functions. | 51 // Network status control functions. |
| 65 void SimulateNetworkOffline(); | 52 void SimulateNetworkOffline(); |
| 66 void SimulateNetworkOnline(); | 53 void SimulateNetworkOnline(); |
| 67 void SimulateNetworkPortal(); | 54 void SimulateNetworkPortal(); |
| 68 | 55 |
| 69 base::Closure SimulateNetworkOfflineClosure(); | 56 base::Closure SimulateNetworkOfflineClosure(); |
| 70 base::Closure SimulateNetworkOnlineClosure(); | 57 base::Closure SimulateNetworkOnlineClosure(); |
| 71 base::Closure SimulateNetworkPortalClosure(); | 58 base::Closure SimulateNetworkPortalClosure(); |
| 72 | 59 |
| 73 // Checks JavaScript |expression| in login screen. | 60 // Checks JavaScript |expression| in login screen. |
| 74 void JsExpect(const std::string& expression); | 61 void JsExpect(const std::string& expression); |
| 75 | 62 |
| 76 bool use_webview() { return use_webview_; } | |
| 77 void set_use_webview(bool use_webview) { use_webview_ = use_webview; } | |
| 78 | |
| 79 bool initialize_fake_merge_session() { | |
| 80 return initialize_fake_merge_session_; | |
| 81 } | |
| 82 void set_initialize_fake_merge_session(bool value) { | |
| 83 initialize_fake_merge_session_ = value; | |
| 84 } | |
| 85 | |
| 86 // Returns chrome://oobe WebUI. | 63 // Returns chrome://oobe WebUI. |
| 87 content::WebUI* GetLoginUI(); | 64 content::WebUI* GetLoginUI(); |
| 88 | 65 |
| 89 // Returns login display. | 66 // Returns login display. |
| 90 WebUILoginDisplay* GetLoginDisplay(); | 67 WebUILoginDisplay* GetLoginDisplay(); |
| 91 | 68 |
| 92 void WaitForGaiaPageLoad(); | |
| 93 void WaitForSigninScreen(); | 69 void WaitForSigninScreen(); |
| 94 void ExecuteJsInSigninFrame(const std::string& js); | 70 void ExecuteJsInSigninFrame(const std::string& js); |
| 95 void SetSignFormField(const std::string& field_id, | 71 void SetSignFormField(const std::string& field_id, |
| 96 const std::string& field_value); | 72 const std::string& field_value); |
| 97 | 73 |
| 98 scoped_ptr<FakeGaia> fake_gaia_; | 74 scoped_ptr<FakeGaia> fake_gaia_; |
| 99 NetworkPortalDetectorTestImpl* network_portal_detector_; | 75 NetworkPortalDetectorTestImpl* network_portal_detector_; |
| 100 | 76 |
| 101 // Whether to use background networking. Note this is only effective when it | 77 // Whether to use background networking. Note this is only effective when it |
| 102 // is set before SetUpCommandLine is invoked. | 78 // is set before SetUpCommandLine is invoked. |
| 103 bool needs_background_networking_; | 79 bool needs_background_networking_; |
| 104 | 80 |
| 105 scoped_ptr<content::WindowedNotificationObserver> login_screen_load_observer_; | 81 scoped_ptr<content::WindowedNotificationObserver> login_screen_load_observer_; |
| 106 scoped_ptr<extensions::ScopedCurrentChannel> scoped_channel_; | 82 scoped_ptr<extensions::ScopedCurrentChannel> scoped_channel_; |
| 107 scoped_ptr<HTTPSForwarder> gaia_https_forwarder_; | 83 scoped_ptr<HTTPSForwarder> gaia_https_forwarder_; |
| 108 std::string gaia_frame_parent_; | 84 std::string gaia_frame_parent_; |
| 109 bool use_webview_; | 85 bool use_webview_; |
| 110 bool initialize_fake_merge_session_; | |
| 111 | 86 |
| 112 DISALLOW_COPY_AND_ASSIGN(OobeBaseTest); | 87 DISALLOW_COPY_AND_ASSIGN(OobeBaseTest); |
| 113 }; | 88 }; |
| 114 | 89 |
| 115 } // namespace chromeos | 90 } // namespace chromeos |
| 116 | 91 |
| 117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ | 92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ |
| OLD | NEW |