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 "content/browser/renderer_host/websocket_dispatcher_host.h" | 5 #include "content/browser/renderer_host/websocket_dispatcher_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // A mock of WebsocketHost which records received messages. | 30 // A mock of WebsocketHost which records received messages. |
31 class MockWebSocketHost : public WebSocketHost { | 31 class MockWebSocketHost : public WebSocketHost { |
32 public: | 32 public: |
33 MockWebSocketHost(int routing_id, | 33 MockWebSocketHost(int routing_id, |
34 WebSocketDispatcherHost* dispatcher, | 34 WebSocketDispatcherHost* dispatcher, |
35 net::URLRequestContext* url_request_context, | 35 net::URLRequestContext* url_request_context, |
36 WebSocketDispatcherHostTest* owner); | 36 WebSocketDispatcherHostTest* owner); |
37 | 37 |
38 virtual ~MockWebSocketHost() {} | 38 virtual ~MockWebSocketHost() {} |
39 | 39 |
40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 40 virtual bool OnMessageReceived(const IPC::Message& message) override { |
41 received_messages_.push_back(message); | 41 received_messages_.push_back(message); |
42 return true; | 42 return true; |
43 } | 43 } |
44 | 44 |
45 virtual void GoAway() OVERRIDE; | 45 virtual void GoAway() override; |
46 | 46 |
47 std::vector<IPC::Message> received_messages_; | 47 std::vector<IPC::Message> received_messages_; |
48 base::WeakPtr<WebSocketDispatcherHostTest> owner_; | 48 base::WeakPtr<WebSocketDispatcherHostTest> owner_; |
49 }; | 49 }; |
50 | 50 |
51 class WebSocketDispatcherHostTest : public ::testing::Test { | 51 class WebSocketDispatcherHostTest : public ::testing::Test { |
52 public: | 52 public: |
53 WebSocketDispatcherHostTest() | 53 WebSocketDispatcherHostTest() |
54 : weak_ptr_factory_(this) { | 54 : weak_ptr_factory_(this) { |
55 dispatcher_host_ = new WebSocketDispatcherHost( | 55 dispatcher_host_ = new WebSocketDispatcherHost( |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 ASSERT_EQ(2u, gone_hosts_.size()); | 210 ASSERT_EQ(2u, gone_hosts_.size()); |
211 // The gone_hosts_ ordering is not predictable because it depends on the | 211 // The gone_hosts_ ordering is not predictable because it depends on the |
212 // hash_map ordering. | 212 // hash_map ordering. |
213 std::sort(gone_hosts_.begin(), gone_hosts_.end()); | 213 std::sort(gone_hosts_.begin(), gone_hosts_.end()); |
214 EXPECT_EQ(123, gone_hosts_[0]); | 214 EXPECT_EQ(123, gone_hosts_[0]); |
215 EXPECT_EQ(456, gone_hosts_[1]); | 215 EXPECT_EQ(456, gone_hosts_[1]); |
216 } | 216 } |
217 | 217 |
218 } // namespace | 218 } // namespace |
219 } // namespace content | 219 } // namespace content |
OLD | NEW |