OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 5 #include <algorithm> |
6 #include <utility> | 6 #include <utility> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 414 |
415 private: | 415 private: |
416 base::Closure quit_loop_func_; | 416 base::Closure quit_loop_func_; |
417 }; | 417 }; |
418 | 418 |
419 base::RunLoop run_loop; | 419 base::RunLoop run_loop; |
420 TestURLFetcherDelegate delegate(run_loop.QuitClosure()); | 420 TestURLFetcherDelegate delegate(run_loop.QuitClosure()); |
421 | 421 |
422 scoped_refptr<URLRequestContextGetter> request_context_getter( | 422 scoped_refptr<URLRequestContextGetter> request_context_getter( |
423 new TestURLRequestContextGetter(base::MessageLoopProxy::current())); | 423 new TestURLRequestContextGetter(base::MessageLoopProxy::current())); |
424 scoped_ptr<URLFetcher> fetcher( | 424 scoped_ptr<URLFetcher> fetcher = |
425 URLFetcher::Create(GURL(base::StringPrintf("http://127.0.0.1:%d/test", | 425 URLFetcher::Create(GURL(base::StringPrintf("http://127.0.0.1:%d/test", |
426 server_address_.port())), | 426 server_address_.port())), |
427 URLFetcher::GET, | 427 URLFetcher::GET, &delegate); |
428 &delegate)); | |
429 fetcher->SetRequestContext(request_context_getter.get()); | 428 fetcher->SetRequestContext(request_context_getter.get()); |
430 fetcher->AddExtraRequestHeader( | 429 fetcher->AddExtraRequestHeader( |
431 base::StringPrintf("content-length:%d", 1 << 30)); | 430 base::StringPrintf("content-length:%d", 1 << 30)); |
432 fetcher->Start(); | 431 fetcher->Start(); |
433 | 432 |
434 ASSERT_TRUE(RunLoopWithTimeout(&run_loop)); | 433 ASSERT_TRUE(RunLoopWithTimeout(&run_loop)); |
435 ASSERT_EQ(0u, requests_.size()); | 434 ASSERT_EQ(0u, requests_.size()); |
436 } | 435 } |
437 | 436 |
438 TEST_F(HttpServerTest, Send200) { | 437 TEST_F(HttpServerTest, Send200) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); | 628 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); |
630 client.Send("GET / HTTP/1.1\r\n\r\n"); | 629 client.Send("GET / HTTP/1.1\r\n\r\n"); |
631 ASSERT_FALSE(RunUntilRequestsReceived(1)); | 630 ASSERT_FALSE(RunUntilRequestsReceived(1)); |
632 ASSERT_EQ(1ul, connection_ids_.size()); | 631 ASSERT_EQ(1ul, connection_ids_.size()); |
633 ASSERT_EQ(0ul, requests_.size()); | 632 ASSERT_EQ(0ul, requests_.size()); |
634 } | 633 } |
635 | 634 |
636 } // namespace | 635 } // namespace |
637 | 636 |
638 } // namespace net | 637 } // namespace net |
OLD | NEW |