Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/test/remoting/remote_desktop_browsertest.h

Issue 771003002: Add support for deferring app initialization when testing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 // Install the unpacked chromoting extension. 80 // Install the unpacked chromoting extension.
81 void InstallChromotingAppUnpacked(); 81 void InstallChromotingAppUnpacked();
82 82
83 // Uninstall the chromoting extension. 83 // Uninstall the chromoting extension.
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. 89 // Launch the Chromoting app. If |defer_start| is true, an additional URL
90 void LaunchChromotingApp(); 90 // parameter is passed to the application, causing it to defer start-up
91 // until StartChromotingApp is invoked. Test code can execute arbitrary
92 // JavaScript in the context of the app between these two calls, for example
93 // to set up appropriate mocks.
94 void LaunchChromotingApp(bool defer_start);
95
96 // If the Chromoting app was launched in deferred mode, tell it to continue
97 // its regular start-up sequence.
98 void StartChromotingApp();
91 99
92 // Authorize: grant extended access permission to the user's computer. 100 // Authorize: grant extended access permission to the user's computer.
93 void Authorize(); 101 void Authorize();
94 102
95 // Authenticate: sign in to google using the credentials provided. 103 // Authenticate: sign in to google using the credentials provided.
96 void Authenticate(); 104 void Authenticate();
97 105
98 // Approve: grant the chromoting app necessary permissions. 106 // Approve: grant the chromoting app necessary permissions.
99 void Approve(); 107 void Approve();
100 108
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Whether to perform the cleanup tasks (uninstalling chromoting, etc). 224 // Whether to perform the cleanup tasks (uninstalling chromoting, etc).
217 // This is useful for diagnostic purposes. 225 // This is useful for diagnostic purposes.
218 bool NoCleanup() { return no_cleanup_; } 226 bool NoCleanup() { return no_cleanup_; }
219 227
220 // Whether to install the chromoting extension before running the test cases. 228 // Whether to install the chromoting extension before running the test cases.
221 // This is useful for diagnostic purposes. 229 // This is useful for diagnostic purposes.
222 bool NoInstall() { return no_install_; } 230 bool NoInstall() { return no_install_; }
223 231
224 // Helper to construct the starting URL of the installed chromoting webapp. 232 // Helper to construct the starting URL of the installed chromoting webapp.
225 GURL Chromoting_Main_URL() { 233 GURL Chromoting_Main_URL() {
226 if (is_platform_app()) 234 return GURL("chrome-extension://" + ChromotingID() + "/main.html");
weitao 2014/12/12 22:49:52 Does the V2 app no longer include isKioskSession i
Jamie 2014/12/13 01:03:43 Yes it does, but I've modified the URL matcher to
227 // The v2 remoting app recently (M38 at the latest) started adding a
228 // query-string parameter to the main extension page. So we'll create a
229 // different expected URL for it.
230 return GURL("chrome-extension://" + ChromotingID() +
231 "/main.html?isKioskSession=false");
232 else
233 return GURL("chrome-extension://" + ChromotingID() + "/main.html");
234 } 235 }
235 236
236 // Helper to retrieve the current URL in the active WebContents. 237 // Helper to retrieve the current URL in the active WebContents. This function
238 // strips all query parameters from the URL.
237 GURL GetCurrentURL() { 239 GURL GetCurrentURL() {
238 return active_web_contents()->GetURL(); 240 GURL current_url = active_web_contents()->GetURL();
241 GURL::Replacements strip_query;
242 strip_query.ClearQuery();
243 return current_url.ReplaceComponents(strip_query);
239 } 244 }
240 245
241 // Helpers to execute JavaScript code on a web page. 246 // Helpers to execute JavaScript code on a web page.
242 247
243 // Helper to execute a JavaScript code snippet in the active WebContents. 248 // Helper to execute a JavaScript code snippet in the active WebContents.
244 void ExecuteScript(const std::string& script); 249 void ExecuteScript(const std::string& script);
245 250
246 // Helper to execute a JavaScript code snippet in the active WebContents 251 // Helper to execute a JavaScript code snippet in the active WebContents
247 // and wait for page load to complete. 252 // and wait for page load to complete.
248 void ExecuteScriptAndWaitForAnyPageLoad(const std::string& script); 253 void ExecuteScriptAndWaitForAnyPageLoad(const std::string& script);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 std::string password_; 387 std::string password_;
383 std::string me2me_pin_; 388 std::string me2me_pin_;
384 std::string remote_host_name_; 389 std::string remote_host_name_;
385 std::string extension_name_; 390 std::string extension_name_;
386 std::string http_server_; 391 std::string http_server_;
387 }; 392 };
388 393
389 } // namespace remoting 394 } // namespace remoting
390 395
391 #endif // CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_ 396 #endif // CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698