Commit 6bca3b0c authored by Kartik Hegde's avatar Kartik Hegde Committed by Commit Bot

network_diagnostics: Add GetRandomAndFixedHostsWithScheme

Add GetRandomAndFixedHostsWithScheme() which will be used by network
diagnostics routines.

TEST=none
BUG=chromium:956783

Change-Id: Ia5073701ce97786e8ce5676a3db3444ef36b72c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459513Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Kartik Hegde <khegde@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815282}
parent aef2496d
...@@ -90,6 +90,17 @@ std::vector<std::string> GetRandomHostsWithScheme(int num_hosts, ...@@ -90,6 +90,17 @@ std::vector<std::string> GetRandomHostsWithScheme(int num_hosts,
return hosts; return hosts;
} }
std::vector<std::string> GetRandomAndFixedHostsWithScheme(int num_random_hosts,
int prefix_length,
std::string scheme) {
std::vector<std::string> hosts =
GetRandomHostsWithFixedHosts(num_random_hosts, prefix_length);
for (auto& host : hosts) {
host = scheme + host;
}
return hosts;
}
std::vector<std::string> GetRandomHostsWithSchemeAndGenerate204Path( std::vector<std::string> GetRandomHostsWithSchemeAndGenerate204Path(
int num_hosts, int num_hosts,
int prefix_length, int prefix_length,
......
...@@ -43,6 +43,12 @@ std::vector<std::string> GetRandomHostsWithScheme(int num_hosts, ...@@ -43,6 +43,12 @@ std::vector<std::string> GetRandomHostsWithScheme(int num_hosts,
int prefix_length, int prefix_length,
std::string scheme); std::string scheme);
// Similar to GetRandomHostsWithFixedHosts, but with a |scheme| prepended to the
// hosts.
std::vector<std::string> GetRandomAndFixedHostsWithScheme(int num_random_hosts,
int prefix_length,
std::string scheme);
// Similar to GetRandomHostsWithScheme, but with the 204 path appended to hosts. // Similar to GetRandomHostsWithScheme, but with the 204 path appended to hosts.
std::vector<std::string> GetRandomHostsWithSchemeAndGenerate204Path( std::vector<std::string> GetRandomHostsWithSchemeAndGenerate204Path(
int num_hosts, int num_hosts,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment