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

Side by Side Diff: net/test/embedded_test_server/simple_connection_listener.cc

Issue 2888043008: Revert of Allow use of Mojo/V8 ProxyResolvers with URLRequestContextBuilder. (Closed)
Patch Set: Created 3 years, 7 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/test/embedded_test_server/simple_connection_listener.h"
6
7 #include "base/location.h"
8 #include "base/sequenced_task_runner.h"
9 #include "base/threading/thread_task_runner_handle.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace net {
13 namespace test_server {
14
15 SimpleConnectionListener::SimpleConnectionListener(
16 int expected_connections,
17 AllowAdditionalConnections allow_additional_connections)
18 : expected_connections_(expected_connections),
19 allow_additional_connections_(allow_additional_connections),
20 run_loop_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
21
22 SimpleConnectionListener::~SimpleConnectionListener() {}
23
24 void SimpleConnectionListener::AcceptedSocket(const StreamSocket& socket) {
25 ++seen_connections_;
26 if (allow_additional_connections_ != ALLOW_ADDITIONAL_CONNECTIONS)
27 EXPECT_LE(seen_connections_, expected_connections_);
28 if (seen_connections_ == expected_connections_)
29 run_loop_task_runner_->PostTask(FROM_HERE, run_loop_.QuitClosure());
30 }
31
32 void SimpleConnectionListener::ReadFromSocket(const StreamSocket& socket,
33 int rv) {}
34
35 void SimpleConnectionListener::WaitForConnections() {
36 EXPECT_TRUE(run_loop_task_runner_->RunsTasksOnCurrentThread());
37 run_loop_.Run();
38 }
39
40 } // namespace test_server
41 } // namespace net
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/simple_connection_listener.h ('k') | net/url_request/url_request_context_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698