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_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ | 5 #ifndef CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ |
6 #define CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ | 6 #define CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ |
7 | 7 |
8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "chrome/browser/apps/app_browsertest_util.h" | 9 #include "chrome/browser/apps/app_browsertest_util.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 void UninstallChromotingApp(); | 71 void UninstallChromotingApp(); |
72 | 72 |
73 // Test whether the chromoting extension is installed. | 73 // Test whether the chromoting extension is installed. |
74 void VerifyChromotingLoaded(bool expected); | 74 void VerifyChromotingLoaded(bool expected); |
75 | 75 |
76 // Launch the Chromoting app. If |defer_start| is true, an additional URL | 76 // Launch the Chromoting app. If |defer_start| is true, an additional URL |
77 // parameter is passed to the application, causing it to defer start-up | 77 // parameter is passed to the application, causing it to defer start-up |
78 // until StartChromotingApp is invoked. Test code can execute arbitrary | 78 // until StartChromotingApp is invoked. Test code can execute arbitrary |
79 // JavaScript in the context of the app between these two calls, for example | 79 // JavaScript in the context of the app between these two calls, for example |
80 // to set up appropriate mocks. | 80 // to set up appropriate mocks. |
81 void LaunchChromotingApp(bool defer_start); | 81 // |window_open_disposition| controls where the app will be launched. For v2 |
| 82 // app, the value of |window_open_disposition| will always be NEW_WINDOW. |
| 83 // Returns the content::Webconetns of the launched app. The lifetime of the |
| 84 // returned value is managed by LaunchChromotingApp(). |
| 85 content::WebContents* LaunchChromotingApp(bool defer_start); |
| 86 content::WebContents* LaunchChromotingApp( |
| 87 bool defer_start, |
| 88 WindowOpenDisposition window_open_disposition); |
82 | 89 |
83 // If the Chromoting app was launched in deferred mode, tell it to continue | 90 // If the Chromoting app was launched in deferred mode, tell it to continue |
84 // its regular start-up sequence. | 91 // its regular start-up sequence. |
85 void StartChromotingApp(); | 92 void StartChromotingApp(); |
86 | 93 |
87 // Authorize: grant extended access permission to the user's computer. | 94 // Authorize: grant extended access permission to the user's computer. |
88 void Authorize(); | 95 void Authorize(); |
89 | 96 |
90 // Authenticate: sign in to google using the credentials provided. | 97 // Authenticate: sign in to google using the credentials provided. |
91 void Authenticate(); | 98 void Authenticate(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // The following helpers each perform a composite task. | 135 // The following helpers each perform a composite task. |
129 | 136 |
130 // Install the chromoting extension | 137 // Install the chromoting extension |
131 void Install(); | 138 void Install(); |
132 | 139 |
133 // Load the browser-test support JavaScript files, including helper functions | 140 // Load the browser-test support JavaScript files, including helper functions |
134 // and mocks. | 141 // and mocks. |
135 void LoadBrowserTestJavaScript(content::WebContents* content); | 142 void LoadBrowserTestJavaScript(content::WebContents* content); |
136 | 143 |
137 // Perform all necessary steps (installation, authorization, authentication, | 144 // Perform all necessary steps (installation, authorization, authentication, |
138 // expanding the me2me section) so that the app is ready for a me2me | 145 // expanding the me2me section) so that the app is ready for a connection. |
139 // connection. | 146 // Returns the content::WebContents instance of the Chromoting app. |
140 void SetUpTestForMe2Me(); | 147 content::WebContents* SetUpTest(); |
141 | 148 |
142 // Clean up after the test. | 149 // Clean up after the test. |
143 void Cleanup(); | 150 void Cleanup(); |
144 | 151 |
145 // Perform all the auth steps: authorization, authentication, etc. | 152 // Perform all the auth steps: authorization, authentication, etc. |
146 // It starts from the chromoting main page unauthenticated and ends up back | 153 // It starts from the chromoting main page unauthenticated and ends up back |
147 // on the chromoting main page authenticated and ready to go. | 154 // on the chromoting main page authenticated and ready to go. |
148 void Auth(); | 155 void Auth(); |
149 | 156 |
150 // Ensures that the host is started locally with |me2me_pin()|. | 157 // Ensures that the host is started locally with |me2me_pin()|. |
151 // Browser_test.js must be loaded before calling this function. | 158 // Browser_test.js must be loaded before calling this function. |
152 void EnsureRemoteConnectionEnabled(); | 159 void EnsureRemoteConnectionEnabled(content::WebContents* app_web_content); |
153 | 160 |
154 // Connect to the local host through Me2Me. | 161 // Connect to the local host through Me2Me. |
155 void ConnectToLocalHost(bool remember_pin); | 162 void ConnectToLocalHost(bool remember_pin); |
156 | 163 |
157 // Connect to a remote host through Me2Me. | 164 // Connect to a remote host through Me2Me. |
158 void ConnectToRemoteHost(const std::string& host_name, bool remember_pin); | 165 void ConnectToRemoteHost(const std::string& host_name, bool remember_pin); |
159 | 166 |
160 // Enter the pin number and connect. | 167 // Enter the pin number and connect. |
161 void EnterPin(const std::string& name, bool remember_pin); | 168 void EnterPin(const std::string& name, bool remember_pin); |
162 | 169 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 content::WebContents* active_web_contents() { | 208 content::WebContents* active_web_contents() { |
202 DCHECK(!web_contents_stack_.empty()); | 209 DCHECK(!web_contents_stack_.empty()); |
203 return web_contents_stack_.back(); | 210 return web_contents_stack_.back(); |
204 } | 211 } |
205 | 212 |
206 // The client WebContents instance the test needs to interact with. | 213 // The client WebContents instance the test needs to interact with. |
207 content::WebContents* client_web_content() { | 214 content::WebContents* client_web_content() { |
208 return client_web_content_; | 215 return client_web_content_; |
209 } | 216 } |
210 | 217 |
211 content::WebContents* app_web_content() { | |
212 return app_web_content_; | |
213 } | |
214 | |
215 RemoteTestHelper* remote_test_helper() const { | 218 RemoteTestHelper* remote_test_helper() const { |
216 return remote_test_helper_.get(); | 219 return remote_test_helper_.get(); |
217 } | 220 } |
218 | 221 |
219 // Whether to perform the cleanup tasks (uninstalling chromoting, etc). | 222 // Whether to perform the cleanup tasks (uninstalling chromoting, etc). |
220 // This is useful for diagnostic purposes. | 223 // This is useful for diagnostic purposes. |
221 bool NoCleanup() { return no_cleanup_; } | 224 bool NoCleanup() { return no_cleanup_; } |
222 | 225 |
223 // Whether to install the chromoting extension before running the test cases. | 226 // Whether to install the chromoting extension before running the test cases. |
224 // This is useful for diagnostic purposes. | 227 // This is useful for diagnostic purposes. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 std::vector<content::WebContents*> web_contents_stack_; | 360 std::vector<content::WebContents*> web_contents_stack_; |
358 | 361 |
359 // WebContent of the client page that facilitates communication with | 362 // WebContent of the client page that facilitates communication with |
360 // the HTTP server. This is how the remoting browser tests | 363 // the HTTP server. This is how the remoting browser tests |
361 // will get acknowledgments of actions completed on the host. | 364 // will get acknowledgments of actions completed on the host. |
362 content::WebContents* client_web_content_; | 365 content::WebContents* client_web_content_; |
363 | 366 |
364 // Helper class to assist in performing and verifying remote operations. | 367 // Helper class to assist in performing and verifying remote operations. |
365 scoped_ptr<RemoteTestHelper> remote_test_helper_; | 368 scoped_ptr<RemoteTestHelper> remote_test_helper_; |
366 | 369 |
367 // WebContent of the landing page in the chromoting app. | |
368 content::WebContents* app_web_content_; | |
369 | |
370 bool no_cleanup_; | 370 bool no_cleanup_; |
371 bool no_install_; | 371 bool no_install_; |
372 const Extension* extension_; | 372 const Extension* extension_; |
373 base::FilePath webapp_crx_; | 373 base::FilePath webapp_crx_; |
374 base::FilePath webapp_unpacked_; | 374 base::FilePath webapp_unpacked_; |
375 std::string username_; | 375 std::string username_; |
376 std::string password_; | 376 std::string password_; |
377 std::string me2me_pin_; | 377 std::string me2me_pin_; |
378 std::string remote_host_name_; | 378 std::string remote_host_name_; |
379 std::string extension_name_; | 379 std::string extension_name_; |
380 std::string http_server_; | 380 std::string http_server_; |
381 }; | 381 }; |
382 | 382 |
383 } // namespace remoting | 383 } // namespace remoting |
384 | 384 |
385 #endif // CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ | 385 #endif // CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ |
OLD | NEW |