| 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 |
| 37 OobeBaseTest(); | 46 OobeBaseTest(); |
| 38 ~OobeBaseTest() override; | 47 ~OobeBaseTest() override; |
| 39 | 48 |
| 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 |
| 40 protected: | 53 protected: |
| 41 // InProcessBrowserTest overrides. | 54 // InProcessBrowserTest overrides. |
| 42 void SetUp() override; | 55 void SetUp() override; |
| 43 void SetUpInProcessBrowserTestFixture() override; | 56 void SetUpInProcessBrowserTestFixture() override; |
| 44 bool SetUpUserDataDirectory() override; | 57 bool SetUpUserDataDirectory() override; |
| 45 void SetUpOnMainThread() override; | 58 void SetUpOnMainThread() override; |
| 46 void TearDownOnMainThread() override; | 59 void TearDownOnMainThread() override; |
| 47 void SetUpCommandLine(base::CommandLine* command_line) override; | 60 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 48 | 61 |
| 49 virtual void InitHttpsForwarders(); | 62 virtual void InitHttpsForwarders(); |
| 50 | 63 |
| 51 // Network status control functions. | 64 // Network status control functions. |
| 52 void SimulateNetworkOffline(); | 65 void SimulateNetworkOffline(); |
| 53 void SimulateNetworkOnline(); | 66 void SimulateNetworkOnline(); |
| 54 void SimulateNetworkPortal(); | 67 void SimulateNetworkPortal(); |
| 55 | 68 |
| 56 base::Closure SimulateNetworkOfflineClosure(); | 69 base::Closure SimulateNetworkOfflineClosure(); |
| 57 base::Closure SimulateNetworkOnlineClosure(); | 70 base::Closure SimulateNetworkOnlineClosure(); |
| 58 base::Closure SimulateNetworkPortalClosure(); | 71 base::Closure SimulateNetworkPortalClosure(); |
| 59 | 72 |
| 60 // Checks JavaScript |expression| in login screen. | 73 // Checks JavaScript |expression| in login screen. |
| 61 void JsExpect(const std::string& expression); | 74 void JsExpect(const std::string& expression); |
| 62 | 75 |
| 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 |
| 63 // Returns chrome://oobe WebUI. | 86 // Returns chrome://oobe WebUI. |
| 64 content::WebUI* GetLoginUI(); | 87 content::WebUI* GetLoginUI(); |
| 65 | 88 |
| 66 // Returns login display. | 89 // Returns login display. |
| 67 WebUILoginDisplay* GetLoginDisplay(); | 90 WebUILoginDisplay* GetLoginDisplay(); |
| 68 | 91 |
| 92 void WaitForGaiaPageLoad(); |
| 69 void WaitForSigninScreen(); | 93 void WaitForSigninScreen(); |
| 70 void ExecuteJsInSigninFrame(const std::string& js); | 94 void ExecuteJsInSigninFrame(const std::string& js); |
| 71 void SetSignFormField(const std::string& field_id, | 95 void SetSignFormField(const std::string& field_id, |
| 72 const std::string& field_value); | 96 const std::string& field_value); |
| 73 | 97 |
| 74 scoped_ptr<FakeGaia> fake_gaia_; | 98 scoped_ptr<FakeGaia> fake_gaia_; |
| 75 NetworkPortalDetectorTestImpl* network_portal_detector_; | 99 NetworkPortalDetectorTestImpl* network_portal_detector_; |
| 76 | 100 |
| 77 // Whether to use background networking. Note this is only effective when it | 101 // Whether to use background networking. Note this is only effective when it |
| 78 // is set before SetUpCommandLine is invoked. | 102 // is set before SetUpCommandLine is invoked. |
| 79 bool needs_background_networking_; | 103 bool needs_background_networking_; |
| 80 | 104 |
| 81 scoped_ptr<content::WindowedNotificationObserver> login_screen_load_observer_; | 105 scoped_ptr<content::WindowedNotificationObserver> login_screen_load_observer_; |
| 82 scoped_ptr<extensions::ScopedCurrentChannel> scoped_channel_; | 106 scoped_ptr<extensions::ScopedCurrentChannel> scoped_channel_; |
| 83 scoped_ptr<HTTPSForwarder> gaia_https_forwarder_; | 107 scoped_ptr<HTTPSForwarder> gaia_https_forwarder_; |
| 84 std::string gaia_frame_parent_; | 108 std::string gaia_frame_parent_; |
| 85 bool use_webview_; | 109 bool use_webview_; |
| 110 bool initialize_fake_merge_session_; |
| 86 | 111 |
| 87 DISALLOW_COPY_AND_ASSIGN(OobeBaseTest); | 112 DISALLOW_COPY_AND_ASSIGN(OobeBaseTest); |
| 88 }; | 113 }; |
| 89 | 114 |
| 90 } // namespace chromeos | 115 } // namespace chromeos |
| 91 | 116 |
| 92 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ | 117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ |
| OLD | NEW |