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 "net/websockets/websocket_throttle.h" | 5 #include "net/websockets/websocket_throttle.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
11 #include "net/base/test_completion_callback.h" | 11 #include "net/base/test_completion_callback.h" |
12 #include "net/socket_stream/socket_stream.h" | 12 #include "net/socket_stream/socket_stream.h" |
13 #include "net/url_request/url_request_test_util.h" | 13 #include "net/url_request/url_request_test_util.h" |
14 #include "net/websockets/websocket_job.h" | 14 #include "net/websockets/websocket_job.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "testing/platform_test.h" | 16 #include "testing/platform_test.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 class DummySocketStreamDelegate : public SocketStream::Delegate { | 23 class DummySocketStreamDelegate : public SocketStream::Delegate { |
24 public: | 24 public: |
25 DummySocketStreamDelegate() {} | 25 DummySocketStreamDelegate() {} |
26 virtual ~DummySocketStreamDelegate() {} | 26 virtual ~DummySocketStreamDelegate() {} |
27 virtual void OnConnected( | 27 virtual void OnConnected( |
28 SocketStream* socket, int max_pending_send_allowed) OVERRIDE {} | 28 SocketStream* socket, int max_pending_send_allowed) override {} |
29 virtual void OnSentData(SocketStream* socket, | 29 virtual void OnSentData(SocketStream* socket, |
30 int amount_sent) OVERRIDE {} | 30 int amount_sent) override {} |
31 virtual void OnReceivedData(SocketStream* socket, | 31 virtual void OnReceivedData(SocketStream* socket, |
32 const char* data, int len) OVERRIDE {} | 32 const char* data, int len) override {} |
33 virtual void OnClose(SocketStream* socket) OVERRIDE {} | 33 virtual void OnClose(SocketStream* socket) override {} |
34 }; | 34 }; |
35 | 35 |
36 class WebSocketThrottleTestContext : public TestURLRequestContext { | 36 class WebSocketThrottleTestContext : public TestURLRequestContext { |
37 public: | 37 public: |
38 explicit WebSocketThrottleTestContext(bool enable_websocket_over_spdy) | 38 explicit WebSocketThrottleTestContext(bool enable_websocket_over_spdy) |
39 : TestURLRequestContext(true) { | 39 : TestURLRequestContext(true) { |
40 HttpNetworkSession::Params params; | 40 HttpNetworkSession::Params params; |
41 params.enable_websocket_over_spdy = enable_websocket_over_spdy; | 41 params.enable_websocket_over_spdy = enable_websocket_over_spdy; |
42 Init(); | 42 Init(); |
43 } | 43 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 s1->DetachDelegate(); | 350 s1->DetachDelegate(); |
351 | 351 |
352 DVLOG(1) << "closing socket2"; | 352 DVLOG(1) << "closing socket2"; |
353 w2->OnClose(s2.get()); | 353 w2->OnClose(s2.get()); |
354 s2->DetachDelegate(); | 354 s2->DetachDelegate(); |
355 DVLOG(1) << "Done"; | 355 DVLOG(1) << "Done"; |
356 base::MessageLoopForIO::current()->RunUntilIdle(); | 356 base::MessageLoopForIO::current()->RunUntilIdle(); |
357 } | 357 } |
358 | 358 |
359 } // namespace net | 359 } // namespace net |
OLD | NEW |