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

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

Issue 1881463003: Add a browsertest suite for net predictor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor, disable preconnect + intercept request for determinism Created 4 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 void EmbeddedTestServer::OnReadCompleted(HttpConnection* connection, int rv) { 370 void EmbeddedTestServer::OnReadCompleted(HttpConnection* connection, int rv) {
371 DCHECK_NE(ERR_IO_PENDING, rv); 371 DCHECK_NE(ERR_IO_PENDING, rv);
372 if (HandleReadResult(connection, rv)) 372 if (HandleReadResult(connection, rv))
373 ReadData(connection); 373 ReadData(connection);
374 } 374 }
375 375
376 bool EmbeddedTestServer::HandleReadResult(HttpConnection* connection, int rv) { 376 bool EmbeddedTestServer::HandleReadResult(HttpConnection* connection, int rv) {
377 DCHECK(io_thread_->task_runner()->BelongsToCurrentThread()); 377 DCHECK(io_thread_->task_runner()->BelongsToCurrentThread());
378 if (connection_listener_) 378 if (connection_listener_)
379 connection_listener_->ReadFromSocket(*connection->socket_); 379 connection_listener_->ReadFromSocket(*connection->socket_, rv);
380 if (rv <= 0) { 380 if (rv <= 0) {
381 DidClose(connection); 381 DidClose(connection);
382 return false; 382 return false;
383 } 383 }
384 384
385 // Once a single complete request has been received, there is no further need 385 // Once a single complete request has been received, there is no further need
386 // for the connection and it may be destroyed once the response has been sent. 386 // for the connection and it may be destroyed once the response has been sent.
387 if (connection->ConsumeData(rv)) 387 if (connection->ConsumeData(rv))
388 return false; 388 return false;
389 389
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 run_loop.QuitClosure())) { 430 run_loop.QuitClosure())) {
431 return false; 431 return false;
432 } 432 }
433 run_loop.Run(); 433 run_loop.Run();
434 434
435 return true; 435 return true;
436 } 436 }
437 437
438 } // namespace test_server 438 } // namespace test_server
439 } // namespace net 439 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698