OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 #include <sys/epoll.h> | 6 #include <sys/epoll.h> |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <list> | 9 #include <list> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1975 | 1975 |
1976 // The TestAckListener will cause a failure if not notified. | 1976 // The TestAckListener will cause a failure if not notified. |
1977 scoped_refptr<TestAckListener> delegate(new TestAckListener(2)); | 1977 scoped_refptr<TestAckListener> delegate(new TestAckListener(2)); |
1978 | 1978 |
1979 // Test the AckNotifier's ability to track multiple packets by making the | 1979 // Test the AckNotifier's ability to track multiple packets by making the |
1980 // request body exceed the size of a single packet. | 1980 // request body exceed the size of a single packet. |
1981 string request_string = | 1981 string request_string = |
1982 "a request body bigger than one packet" + string(kMaxPacketSize, '.'); | 1982 "a request body bigger than one packet" + string(kMaxPacketSize, '.'); |
1983 | 1983 |
1984 // Send the request, and register the delegate for ACKs. | 1984 // Send the request, and register the delegate for ACKs. |
1985 client_->SendData(request_string, true, delegate.get()); | 1985 client_->SendData(request_string, true, delegate); |
1986 client_->WaitForResponse(); | 1986 client_->WaitForResponse(); |
1987 EXPECT_EQ(kFooResponseBody, client_->response_body()); | 1987 EXPECT_EQ(kFooResponseBody, client_->response_body()); |
1988 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); | 1988 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); |
1989 | 1989 |
1990 // Send another request to flush out any pending ACKs on the server. | 1990 // Send another request to flush out any pending ACKs on the server. |
1991 client_->SendSynchronousRequest("/bar"); | 1991 client_->SendSynchronousRequest("/bar"); |
1992 | 1992 |
1993 // Make sure the delegate does get the notification it expects. | 1993 // Make sure the delegate does get the notification it expects. |
1994 while (!delegate->has_been_notified()) { | 1994 while (!delegate->has_been_notified()) { |
1995 // Waits for up to 50 ms. | 1995 // Waits for up to 50 ms. |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 client_->WaitForResponse(); | 3047 client_->WaitForResponse(); |
3048 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 3048 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
3049 QuicConnectionStats client_stats = | 3049 QuicConnectionStats client_stats = |
3050 client_->client()->session()->connection()->GetStats(); | 3050 client_->client()->session()->connection()->GetStats(); |
3051 EXPECT_EQ(0u, client_stats.packets_lost); | 3051 EXPECT_EQ(0u, client_stats.packets_lost); |
3052 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 3052 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
3053 } | 3053 } |
3054 } // namespace | 3054 } // namespace |
3055 } // namespace test | 3055 } // namespace test |
3056 } // namespace net | 3056 } // namespace net |
OLD | NEW |