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

Unified Diff: net/proxy/proxy_resolver_factory_mojo_unittest.cc

Issue 2083463002: Replace //net TypeConverters with StructTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@type-converter-cleanup--gurl
Patch Set: Created 4 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« net/proxy/OWNERS ('K') | « net/proxy/proxy_resolver_factory_mojo.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_resolver_factory_mojo_unittest.cc
diff --git a/net/proxy/proxy_resolver_factory_mojo_unittest.cc b/net/proxy/proxy_resolver_factory_mojo_unittest.cc
index 364462a8330caa187edca2154fe38e948adea731..28b52cd810a703814f0ff7e0d5b4babba5bb6886 100644
--- a/net/proxy/proxy_resolver_factory_mojo_unittest.cc
+++ b/net/proxy/proxy_resolver_factory_mojo_unittest.cc
@@ -25,7 +25,6 @@
#include "net/dns/host_resolver.h"
#include "net/log/test_net_log.h"
#include "net/proxy/mojo_proxy_resolver_factory.h"
-#include "net/proxy/mojo_proxy_type_converters.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_resolver.h"
#include "net/proxy/proxy_resolver_error_observer.h"
@@ -119,12 +118,7 @@ struct GetProxyForUrlAction {
};
GetProxyForUrlAction() {}
- GetProxyForUrlAction(const GetProxyForUrlAction& old) {
- action = old.action;
- error = old.error;
- expected_url = old.expected_url;
- proxy_servers = old.proxy_servers.Clone();
- }
+ GetProxyForUrlAction(const GetProxyForUrlAction& other) = default;
static GetProxyForUrlAction ReturnError(const GURL& url, Error error) {
GetProxyForUrlAction result;
@@ -133,12 +127,11 @@ struct GetProxyForUrlAction {
return result;
}
- static GetProxyForUrlAction ReturnServers(
- const GURL& url,
- const mojo::Array<interfaces::ProxyServerPtr>& proxy_servers) {
+ static GetProxyForUrlAction ReturnServers(const GURL& url,
+ const ProxyInfo& proxy_info) {
GetProxyForUrlAction result;
result.expected_url = url;
- result.proxy_servers = proxy_servers.Clone();
+ result.proxy_info = proxy_info;
return result;
}
@@ -172,7 +165,7 @@ struct GetProxyForUrlAction {
Action action = COMPLETE;
Error error = OK;
- mojo::Array<interfaces::ProxyServerPtr> proxy_servers;
+ ProxyInfo proxy_info;
GURL expected_url;
};
@@ -255,7 +248,7 @@ void MockMojoProxyResolver::GetProxyForUrl(
client->OnError(12345, url.spec());
switch (action.action) {
case GetProxyForUrlAction::COMPLETE: {
- client->ReportResult(action.error, std::move(action.proxy_servers));
+ client->ReportResult(action.error, action.proxy_info);
break;
}
case GetProxyForUrlAction::DROP: {
@@ -271,10 +264,8 @@ void MockMojoProxyResolver::GetProxyForUrl(
break;
}
case GetProxyForUrlAction::MAKE_DNS_REQUEST: {
- interfaces::HostResolverRequestInfoPtr request(
- interfaces::HostResolverRequestInfo::New());
- request->host = url.spec();
- request->port = 12345;
+ auto request = base::MakeUnique<HostResolver::RequestInfo>(
+ HostPortPair(url.spec(), 12345));
interfaces::HostResolverRequestClientPtr dns_client;
mojo::GetProxy(&dns_client);
client->ResolveDns(std::move(request), std::move(dns_client));
@@ -434,10 +425,8 @@ void MockMojoProxyResolverFactory::CreateResolver(
break;
}
case CreateProxyResolverAction::MAKE_DNS_REQUEST: {
- interfaces::HostResolverRequestInfoPtr request(
- interfaces::HostResolverRequestInfo::New());
- request->host = pac_script;
- request->port = 12345;
+ auto request = base::MakeUnique<HostResolver::RequestInfo>(
+ HostPortPair(pac_script, 12345));
interfaces::HostResolverRequestClientPtr dns_client;
mojo::GetProxy(&dns_client);
client->ResolveDns(std::move(request), std::move(dns_client));
@@ -534,13 +523,10 @@ class ProxyResolverFactoryMojoTest : public testing::Test,
new base::ScopedClosureRunner(on_delete_callback_.closure()));
}
- mojo::Array<interfaces::ProxyServerPtr> ProxyServersFromPacString(
- const std::string& pac_string) {
+ ProxyInfo ProxyServersFromPacString(const std::string& pac_string) {
ProxyInfo proxy_info;
proxy_info.UsePacString(pac_string);
-
- return mojo::Array<interfaces::ProxyServerPtr>::From(
- proxy_info.proxy_list().GetAll());
+ return proxy_info;
}
void CreateProxyResolver() {
« net/proxy/OWNERS ('K') | « net/proxy/proxy_resolver_factory_mojo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698