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

Side by Side Diff: net/proxy/mojo_proxy_resolver_impl_unittest.cc

Issue 2416483002: Use std::string instead of mojo::String in //net. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "net/proxy/mojo_proxy_resolver_impl.h" 5 #include "net/proxy/mojo_proxy_resolver_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 38
39 void WaitForResult(); 39 void WaitForResult();
40 40
41 Error error() { return error_; } 41 Error error() { return error_; }
42 const ProxyInfo& results() { return results_; } 42 const ProxyInfo& results() { return results_; }
43 EventWaiter<Event>& event_waiter() { return event_waiter_; } 43 EventWaiter<Event>& event_waiter() { return event_waiter_; }
44 44
45 private: 45 private:
46 // interfaces::ProxyResolverRequestClient override. 46 // interfaces::ProxyResolverRequestClient override.
47 void ReportResult(int32_t error, const ProxyInfo& results) override; 47 void ReportResult(int32_t error, const ProxyInfo& results) override;
48 void Alert(const mojo::String& message) override; 48 void Alert(const std::string& message) override;
49 void OnError(int32_t line_number, const mojo::String& message) override; 49 void OnError(int32_t line_number, const std::string& message) override;
50 void ResolveDns(std::unique_ptr<HostResolver::RequestInfo> request_info, 50 void ResolveDns(std::unique_ptr<HostResolver::RequestInfo> request_info,
51 interfaces::HostResolverRequestClientPtr client) override; 51 interfaces::HostResolverRequestClientPtr client) override;
52 52
53 // Mojo error handler. 53 // Mojo error handler.
54 void OnConnectionError(); 54 void OnConnectionError();
55 55
56 bool done_ = false; 56 bool done_ = false;
57 Error error_ = ERR_FAILED; 57 Error error_ = ERR_FAILED;
58 ProxyInfo results_; 58 ProxyInfo results_;
59 59
(...skipping 18 matching lines...) Expand all
78 } 78 }
79 79
80 void TestRequestClient::ReportResult(int32_t error, const ProxyInfo& results) { 80 void TestRequestClient::ReportResult(int32_t error, const ProxyInfo& results) {
81 event_waiter_.NotifyEvent(RESULT_RECEIVED); 81 event_waiter_.NotifyEvent(RESULT_RECEIVED);
82 ASSERT_FALSE(done_); 82 ASSERT_FALSE(done_);
83 error_ = static_cast<Error>(error); 83 error_ = static_cast<Error>(error);
84 results_ = results; 84 results_ = results;
85 done_ = true; 85 done_ = true;
86 } 86 }
87 87
88 void TestRequestClient::Alert(const mojo::String& message) { 88 void TestRequestClient::Alert(const std::string& message) {}
89 }
90 89
91 void TestRequestClient::OnError(int32_t line_number, 90 void TestRequestClient::OnError(int32_t line_number,
92 const mojo::String& message) { 91 const std::string& message) {}
93 }
94 92
95 void TestRequestClient::ResolveDns( 93 void TestRequestClient::ResolveDns(
96 std::unique_ptr<HostResolver::RequestInfo> request_info, 94 std::unique_ptr<HostResolver::RequestInfo> request_info,
97 interfaces::HostResolverRequestClientPtr client) {} 95 interfaces::HostResolverRequestClientPtr client) {}
98 96
99 void TestRequestClient::OnConnectionError() { 97 void TestRequestClient::OnConnectionError() {
100 event_waiter_.NotifyEvent(CONNECTION_ERROR); 98 event_waiter_.NotifyEvent(CONNECTION_ERROR);
101 } 99 }
102 100
103 class MockProxyResolverV8Tracing : public ProxyResolverV8Tracing { 101 class MockProxyResolverV8Tracing : public ProxyResolverV8Tracing {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 interfaces::ProxyResolverRequestClientPtr client_ptr; 311 interfaces::ProxyResolverRequestClientPtr client_ptr;
314 TestRequestClient client(mojo::GetProxy(&client_ptr)); 312 TestRequestClient client(mojo::GetProxy(&client_ptr));
315 313
316 resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr)); 314 resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr));
317 ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); 315 ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size());
318 resolver_impl_.reset(); 316 resolver_impl_.reset();
319 client.event_waiter().WaitForEvent(TestRequestClient::CONNECTION_ERROR); 317 client.event_waiter().WaitForEvent(TestRequestClient::CONNECTION_ERROR);
320 } 318 }
321 319
322 } // namespace net 320 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc ('k') | net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698