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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 void UninstallChromotingApp(); | 84 void UninstallChromotingApp(); |
85 | 85 |
86 // Test whether the chromoting extension is installed. | 86 // Test whether the chromoting extension is installed. |
87 void VerifyChromotingLoaded(bool expected); | 87 void VerifyChromotingLoaded(bool expected); |
88 | 88 |
89 // Launch the Chromoting app. If |defer_start| is true, an additional URL | 89 // Launch the Chromoting app. If |defer_start| is true, an additional URL |
90 // parameter is passed to the application, causing it to defer start-up | 90 // parameter is passed to the application, causing it to defer start-up |
91 // until StartChromotingApp is invoked. Test code can execute arbitrary | 91 // until StartChromotingApp is invoked. Test code can execute arbitrary |
92 // JavaScript in the context of the app between these two calls, for example | 92 // JavaScript in the context of the app between these two calls, for example |
93 // to set up appropriate mocks. | 93 // to set up appropriate mocks. |
94 // |window_open_disposition| controls where the app will be launched. For v2 | |
95 // app, the value of |window_open_disposition| will always be NEW_WINDOW. | |
96 // Returns |app_web_content| that allow the caller to interact with the | |
97 // content::WebContents of the launched app. The lifetime of |app_web_content| | |
98 // is managed by LaunchChromotingApp(). | |
94 void LaunchChromotingApp(bool defer_start); | 99 void LaunchChromotingApp(bool defer_start); |
100 void LaunchChromotingApp(bool defer_start, | |
101 content::WebContents** app_web_content); | |
Jamie
2015/01/10 00:14:24
Why not just return the WebContents pointer? It wo
kelvinp
2015/01/12 21:15:24
LaunchChromotingApp uses the ASSERT_MACRO which us
| |
102 void LaunchChromotingApp(bool defer_start, | |
103 WindowOpenDisposition window_open_disposition, | |
104 content::WebContents** app_web_content); | |
95 | 105 |
96 // If the Chromoting app was launched in deferred mode, tell it to continue | 106 // If the Chromoting app was launched in deferred mode, tell it to continue |
97 // its regular start-up sequence. | 107 // its regular start-up sequence. |
98 void StartChromotingApp(); | 108 void StartChromotingApp(); |
99 | 109 |
100 // Authorize: grant extended access permission to the user's computer. | 110 // Authorize: grant extended access permission to the user's computer. |
101 void Authorize(); | 111 void Authorize(); |
102 | 112 |
103 // Authenticate: sign in to google using the credentials provided. | 113 // Authenticate: sign in to google using the credentials provided. |
104 void Authenticate(); | 114 void Authenticate(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 | 147 |
138 void SetUserNameAndPassword( | 148 void SetUserNameAndPassword( |
139 const base::FilePath &accounts_file, const std::string& account_type); | 149 const base::FilePath &accounts_file, const std::string& account_type); |
140 | 150 |
141 // The following helpers each perform a composite task. | 151 // The following helpers each perform a composite task. |
142 | 152 |
143 // Install the chromoting extension | 153 // Install the chromoting extension |
144 void Install(); | 154 void Install(); |
145 | 155 |
146 // Perform all necessary steps (installation, authorization, authentication, | 156 // Perform all necessary steps (installation, authorization, authentication, |
147 // expanding the me2me section) so that the app is ready for a me2me | 157 // expanding the me2me section) so that the app is ready for a connection. |
148 // connection. | 158 // Returns the content::WebContents instance of the Chromoting app. |
149 void SetUpTestForMe2Me(); | 159 content::WebContents* SetUpTest(); |
150 | 160 |
151 // Clean up after the test. | 161 // Clean up after the test. |
152 void Cleanup(); | 162 void Cleanup(); |
153 | 163 |
154 // Perform all the auth steps: authorization, authentication, etc. | 164 // Perform all the auth steps: authorization, authentication, etc. |
155 // It starts from the chromoting main page unauthenticated and ends up back | 165 // It starts from the chromoting main page unauthenticated and ends up back |
156 // on the chromoting main page authenticated and ready to go. | 166 // on the chromoting main page authenticated and ready to go. |
157 void Auth(); | 167 void Auth(); |
158 | 168 |
159 // Ensures that the host is started locally with |me2me_pin()|. | 169 // Ensures that the host is started locally with |me2me_pin()|. |
160 // Browser_test.js must be loaded before calling this function. | 170 // Browser_test.js must be loaded before calling this function. |
161 void EnsureRemoteConnectionEnabled(); | 171 void EnsureRemoteConnectionEnabled(content::WebContents* app_web_content); |
162 | 172 |
163 // Connect to the local host through Me2Me. | 173 // Connect to the local host through Me2Me. |
164 void ConnectToLocalHost(bool remember_pin); | 174 void ConnectToLocalHost(bool remember_pin); |
165 | 175 |
166 // Connect to a remote host through Me2Me. | 176 // Connect to a remote host through Me2Me. |
167 void ConnectToRemoteHost(const std::string& host_name, bool remember_pin); | 177 void ConnectToRemoteHost(const std::string& host_name, bool remember_pin); |
168 | 178 |
169 // Enter the pin number and connect. | 179 // Enter the pin number and connect. |
170 void EnterPin(const std::string& name, bool remember_pin); | 180 void EnterPin(const std::string& name, bool remember_pin); |
171 | 181 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 content::WebContents* active_web_contents() { | 220 content::WebContents* active_web_contents() { |
211 DCHECK(!web_contents_stack_.empty()); | 221 DCHECK(!web_contents_stack_.empty()); |
212 return web_contents_stack_.back(); | 222 return web_contents_stack_.back(); |
213 } | 223 } |
214 | 224 |
215 // The client WebContents instance the test needs to interact with. | 225 // The client WebContents instance the test needs to interact with. |
216 content::WebContents* client_web_content() { | 226 content::WebContents* client_web_content() { |
217 return client_web_content_; | 227 return client_web_content_; |
218 } | 228 } |
219 | 229 |
220 content::WebContents* app_web_content() { | |
221 return app_web_content_; | |
222 } | |
223 | |
224 // Whether to perform the cleanup tasks (uninstalling chromoting, etc). | 230 // Whether to perform the cleanup tasks (uninstalling chromoting, etc). |
225 // This is useful for diagnostic purposes. | 231 // This is useful for diagnostic purposes. |
226 bool NoCleanup() { return no_cleanup_; } | 232 bool NoCleanup() { return no_cleanup_; } |
227 | 233 |
228 // Whether to install the chromoting extension before running the test cases. | 234 // Whether to install the chromoting extension before running the test cases. |
229 // This is useful for diagnostic purposes. | 235 // This is useful for diagnostic purposes. |
230 bool NoInstall() { return no_install_; } | 236 bool NoInstall() { return no_install_; } |
231 | 237 |
232 // Helper to construct the starting URL of the installed chromoting webapp. | 238 // Helper to construct the starting URL of the installed chromoting webapp. |
233 GURL Chromoting_Main_URL() { | 239 GURL Chromoting_Main_URL() { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 // push it onto the stack and that becomes the active instance. | 374 // push it onto the stack and that becomes the active instance. |
369 // And once we are done with the current WebContents instance | 375 // And once we are done with the current WebContents instance |
370 // we pop it off the stack, returning to the previous instance. | 376 // we pop it off the stack, returning to the previous instance. |
371 std::vector<content::WebContents*> web_contents_stack_; | 377 std::vector<content::WebContents*> web_contents_stack_; |
372 | 378 |
373 // WebContent of the client page that facilitates communication with | 379 // WebContent of the client page that facilitates communication with |
374 // the HTTP server. This is how the remoting browser tests | 380 // the HTTP server. This is how the remoting browser tests |
375 // will get acknowledgments of actions completed on the host. | 381 // will get acknowledgments of actions completed on the host. |
376 content::WebContents* client_web_content_; | 382 content::WebContents* client_web_content_; |
377 | 383 |
378 // WebContent of the landing page in the chromoting app. | |
379 content::WebContents* app_web_content_; | |
380 | |
381 bool no_cleanup_; | 384 bool no_cleanup_; |
382 bool no_install_; | 385 bool no_install_; |
383 const Extension* extension_; | 386 const Extension* extension_; |
384 base::FilePath webapp_crx_; | 387 base::FilePath webapp_crx_; |
385 base::FilePath webapp_unpacked_; | 388 base::FilePath webapp_unpacked_; |
386 std::string username_; | 389 std::string username_; |
387 std::string password_; | 390 std::string password_; |
388 std::string me2me_pin_; | 391 std::string me2me_pin_; |
389 std::string remote_host_name_; | 392 std::string remote_host_name_; |
390 std::string extension_name_; | 393 std::string extension_name_; |
391 std::string http_server_; | 394 std::string http_server_; |
392 }; | 395 }; |
393 | 396 |
394 } // namespace remoting | 397 } // namespace remoting |
395 | 398 |
396 #endif // CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ | 399 #endif // CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ |
OLD | NEW |