Chromium Code Reviews| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 void LaunchChromotingApp(bool defer_start); | 94 void LaunchChromotingApp(bool defer_start); |
| 95 void LaunchChromotingApp(bool defer_start, | |
| 96 WindowOpenDisposition opt_window_open_disposition); | |
|
Jamie
2015/01/06 22:18:51
window_open_disposition is not optional, so the op
kelvinp
2015/01/09 22:21:30
Done.
| |
| 95 | 97 |
| 96 // If the Chromoting app was launched in deferred mode, tell it to continue | 98 // If the Chromoting app was launched in deferred mode, tell it to continue |
| 97 // its regular start-up sequence. | 99 // its regular start-up sequence. |
| 98 void StartChromotingApp(); | 100 void StartChromotingApp(); |
| 99 | 101 |
| 100 // Authorize: grant extended access permission to the user's computer. | 102 // Authorize: grant extended access permission to the user's computer. |
| 101 void Authorize(); | 103 void Authorize(); |
| 102 | 104 |
| 103 // Authenticate: sign in to google using the credentials provided. | 105 // Authenticate: sign in to google using the credentials provided. |
| 104 void Authenticate(); | 106 void Authenticate(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 // Helper to load a JavaScript file from |path| and inject it to | 287 // Helper to load a JavaScript file from |path| and inject it to |
| 286 // current web_content. The variable |path| is relative to the directory of | 288 // current web_content. The variable |path| is relative to the directory of |
| 287 // the |browsertest| executable. | 289 // the |browsertest| executable. |
| 288 static bool LoadScript(content::WebContents* web_contents, | 290 static bool LoadScript(content::WebContents* web_contents, |
| 289 const base::FilePath::StringType& path); | 291 const base::FilePath::StringType& path); |
| 290 | 292 |
| 291 // Helper to execute a JavaScript browser test. It creates an object using | 293 // Helper to execute a JavaScript browser test. It creates an object using |
| 292 // the |browserTest.testName| ctor and calls |run| on the created object with | 294 // the |browserTest.testName| ctor and calls |run| on the created object with |
| 293 // |testData|, which can be any arbitrary object literal. The script | 295 // |testData|, which can be any arbitrary object literal. The script |
| 294 // browser_test.js must be loaded (using LoadScript) before calling this | 296 // browser_test.js must be loaded (using LoadScript) before calling this |
| 295 // function. | 297 // function. The JavaScript browser test can optionally return a value when |
| 298 // the test finishes. The owner must take ownership of |opt_return_value|. | |
| 299 void RunJavaScriptTest(content::WebContents* web_contents, | |
| 300 const std::string& testName, | |
| 301 const std::string& testData, | |
| 302 base::Value** opt_return_value); | |
|
Jamie
2015/01/06 22:18:51
Similarly, opt_ is not appropriate here (although
kelvinp
2015/01/09 22:21:30
Done.
| |
| 296 void RunJavaScriptTest(content::WebContents* web_contents, | 303 void RunJavaScriptTest(content::WebContents* web_contents, |
| 297 const std::string& testName, | 304 const std::string& testName, |
| 298 const std::string& testData); | 305 const std::string& testData); |
| 299 | 306 |
| 300 // Helper to check whether an html element with the given name exists in | 307 // Helper to check whether an html element with the given name exists in |
| 301 // the active WebContents. | 308 // the active WebContents. |
| 302 bool HtmlElementExists(const std::string& name) { | 309 bool HtmlElementExists(const std::string& name) { |
| 303 return ExecuteScriptAndExtractBool( | 310 return ExecuteScriptAndExtractBool( |
| 304 "document.getElementById(\"" + name + "\") != null"); | 311 "document.getElementById(\"" + name + "\") != null"); |
| 305 } | 312 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 std::string password_; | 394 std::string password_; |
| 388 std::string me2me_pin_; | 395 std::string me2me_pin_; |
| 389 std::string remote_host_name_; | 396 std::string remote_host_name_; |
| 390 std::string extension_name_; | 397 std::string extension_name_; |
| 391 std::string http_server_; | 398 std::string http_server_; |
| 392 }; | 399 }; |
| 393 | 400 |
| 394 } // namespace remoting | 401 } // namespace remoting |
| 395 | 402 |
| 396 #endif // CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ | 403 #endif // CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ |
| OLD | NEW |