Index: remoting/test/chromoting_test_driver.cc |
diff --git a/remoting/test/chromoting_test_driver.cc b/remoting/test/chromoting_test_driver.cc |
index 1e7d73ef1736765bcb2b5433687d3e0a01cc1e10..b75ce580e25e11b416fa5c21331cddb6018b81d6 100644 |
--- a/remoting/test/chromoting_test_driver.cc |
+++ b/remoting/test/chromoting_test_driver.cc |
@@ -27,6 +27,7 @@ const char kLoggingLevelSwitchName[] = "verbosity"; |
const char kPinSwitchName[] = "pin"; |
const char kRefreshTokenPathSwitchName[] = "refresh-token-path"; |
const char kSingleProcessTestsSwitchName[] = "single-process-tests"; |
+const char kShowHostListSwitchName[] = "show-host-list"; |
const char kTestEnvironmentSwitchName[] = "use-test-env"; |
const char kUserNameSwitchName[] = "username"; |
} |
@@ -68,6 +69,10 @@ void PrintUsage() { |
switches::kUserNameSwitchName); |
printf(" %s: Specifies which host to connect to when running tests\n", |
switches::kHostNameSwitchName); |
+ printf( |
+ " %s: Retrieves and displays the connection status for all known " |
+ "hosts, no tests will be run\n", |
+ switches::kShowHostListSwitchName); |
printf("\nOptional Parameters:\n"); |
printf(" %s: Exchanged for a refresh and access token for authentication\n", |
switches::kAuthCodeSwitchName); |
@@ -220,11 +225,14 @@ int main(int argc, char* argv[]) { |
options.host_name = |
command_line->GetSwitchValueASCII(switches::kHostNameSwitchName); |
- if (options.host_name.empty()) { |
+ if (!options.host_name.empty()) { |
+ VLOG(1) << "host_name: '" << options.host_name << "'"; |
+ } else if (command_line->HasSwitch(switches::kShowHostListSwitchName)) { |
+ options.host_name = "unspecified"; |
+ } else { |
LOG(ERROR) << "No hostname passed in, connect to host requires hostname!"; |
return -1; |
} |
- VLOG(1) << "host_name: '" << options.host_name << "'"; |
options.host_jid = |
command_line->GetSwitchValueASCII(switches::kHostJidSwitchName); |
@@ -247,14 +255,25 @@ int main(int argc, char* argv[]) { |
return -1; |
} |
+ if (command_line->HasSwitch(switches::kShowHostListSwitchName)) { |
+ // When this flag is specified, we will show the host list and exit. |
+ shared_data->RefreshHostList(); |
+ shared_data->DisplayHostList(); |
+ return 0; |
+ } |
+ |
// This method is necessary as there are occasional propagation delays in the |
// backend and we don't want the test to fail because of that. |
- if (!shared_data->WaitForHostOnline(options.host_jid, options.host_name)) { |
+ if (!shared_data->WaitForHostOnline()) { |
VLOG(1) << "The expected host was not available for connections."; |
// Host is not online. No point running further tests. |
return -1; |
} |
+ if (options.pin.empty()) { |
+ LOG(WARNING) << "No PIN specified, tests may not run reliably."; |
+ } |
+ |
// Since we've successfully set up our shared_data object, we'll assign the |
// value to our global* and transfer ownership to the framework. |
remoting::test::g_chromoting_shared_data = shared_data.release(); |