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

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

Issue 418043002: Add test for showing confirmation dialog for unsecure signin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix isolate dependency Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/test/embedded_test_server/embedded_test_server.h" 5 #include "net/test/embedded_test_server/embedded_test_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 StreamListenSocket::Delegate* delegate) 88 StreamListenSocket::Delegate* delegate)
89 : TCPListenSocket(socket_descriptor, delegate) { 89 : TCPListenSocket(socket_descriptor, delegate) {
90 DCHECK(thread_checker_.CalledOnValidThread()); 90 DCHECK(thread_checker_.CalledOnValidThread());
91 } 91 }
92 92
93 void HttpListenSocket::Listen() { 93 void HttpListenSocket::Listen() {
94 DCHECK(thread_checker_.CalledOnValidThread()); 94 DCHECK(thread_checker_.CalledOnValidThread());
95 TCPListenSocket::Listen(); 95 TCPListenSocket::Listen();
96 } 96 }
97 97
98 void HttpListenSocket::ListenOnIOThread() {
99 DCHECK(thread_checker_.CalledOnValidThread());
100 #if !defined(OS_POSIX)
101 // This method may be called after the IO thread is changed, thus we need to
102 // call |WatchSocket| again to make sure it listens on the current IO thread.
103 // Only needed for non POSIX platforms, since on POSIX platforms
104 // StreamListenSocket::Listen already calls WatchSocket inside the function.
105 WatchSocket(WAITING_ACCEPT);
106 #endif
107 Listen();
108 }
109
98 HttpListenSocket::~HttpListenSocket() { 110 HttpListenSocket::~HttpListenSocket() {
99 DCHECK(thread_checker_.CalledOnValidThread()); 111 DCHECK(thread_checker_.CalledOnValidThread());
100 } 112 }
101 113
102 void HttpListenSocket::DetachFromThread() { 114 void HttpListenSocket::DetachFromThread() {
103 thread_checker_.DetachFromThread(); 115 thread_checker_.DetachFromThread();
104 } 116 }
105 117
106 EmbeddedTestServer::EmbeddedTestServer() 118 EmbeddedTestServer::EmbeddedTestServer()
107 : port_(-1), 119 : port_(-1),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (result == OK) { 203 if (result == OK) {
192 base_url_ = GURL(std::string("http://") + address.ToString()); 204 base_url_ = GURL(std::string("http://") + address.ToString());
193 } else { 205 } else {
194 LOG(ERROR) << "GetLocalAddress failed: " << ErrorToString(result); 206 LOG(ERROR) << "GetLocalAddress failed: " << ErrorToString(result);
195 } 207 }
196 } 208 }
197 209
198 void EmbeddedTestServer::ListenOnIOThread() { 210 void EmbeddedTestServer::ListenOnIOThread() {
199 DCHECK(io_thread_->message_loop_proxy()->BelongsToCurrentThread()); 211 DCHECK(io_thread_->message_loop_proxy()->BelongsToCurrentThread());
200 DCHECK(Started()); 212 DCHECK(Started());
201 listen_socket_->Listen(); 213 listen_socket_->ListenOnIOThread();
202 } 214 }
203 215
204 void EmbeddedTestServer::ShutdownOnIOThread() { 216 void EmbeddedTestServer::ShutdownOnIOThread() {
205 DCHECK(io_thread_->message_loop_proxy()->BelongsToCurrentThread()); 217 DCHECK(io_thread_->message_loop_proxy()->BelongsToCurrentThread());
206 218
207 listen_socket_.reset(); 219 listen_socket_.reset();
208 STLDeleteContainerPairSecondPointers(connections_.begin(), 220 STLDeleteContainerPairSecondPointers(connections_.begin(),
209 connections_.end()); 221 connections_.end());
210 connections_.clear(); 222 connections_.clear();
211 } 223 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 FROM_HERE, closure, run_loop.QuitClosure())) { 339 FROM_HERE, closure, run_loop.QuitClosure())) {
328 return false; 340 return false;
329 } 341 }
330 run_loop.Run(); 342 run_loop.Run();
331 343
332 return true; 344 return true;
333 } 345 }
334 346
335 } // namespace test_server 347 } // namespace test_server
336 } // namespace net 348 } // namespace net
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698