OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/proximity_auth/connection.h" | 5 #include "components/proximity_auth/connection.h" |
6 | 6 |
7 #include "components/proximity_auth/connection_observer.h" | 7 #include "components/proximity_auth/connection_observer.h" |
8 #include "components/proximity_auth/remote_device.h" | 8 #include "components/proximity_auth/remote_device.h" |
9 #include "components/proximity_auth/wire_message.h" | 9 #include "components/proximity_auth/wire_message.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 MOCK_METHOD1(SetPaused, void(bool paused)); | 28 MOCK_METHOD1(SetPaused, void(bool paused)); |
29 MOCK_METHOD0(Connect, void()); | 29 MOCK_METHOD0(Connect, void()); |
30 MOCK_METHOD0(Disconnect, void()); | 30 MOCK_METHOD0(Disconnect, void()); |
31 MOCK_METHOD0(CancelConnectionAttempt, void()); | 31 MOCK_METHOD0(CancelConnectionAttempt, void()); |
32 MOCK_METHOD1(SendMessageImplProxy, void(WireMessage* message)); | 32 MOCK_METHOD1(SendMessageImplProxy, void(WireMessage* message)); |
33 MOCK_METHOD1(DeserializeWireMessageProxy, | 33 MOCK_METHOD1(DeserializeWireMessageProxy, |
34 WireMessage*(bool* is_incomplete_message)); | 34 WireMessage*(bool* is_incomplete_message)); |
35 | 35 |
36 // Gmock only supports copyable types, so create simple wrapper methods for | 36 // Gmock only supports copyable types, so create simple wrapper methods for |
37 // ease of mocking. | 37 // ease of mocking. |
38 virtual void SendMessageImpl(scoped_ptr<WireMessage> message) OVERRIDE { | 38 virtual void SendMessageImpl(scoped_ptr<WireMessage> message) override { |
39 SendMessageImplProxy(message.get()); | 39 SendMessageImplProxy(message.get()); |
40 } | 40 } |
41 | 41 |
42 virtual scoped_ptr<WireMessage> DeserializeWireMessage( | 42 virtual scoped_ptr<WireMessage> DeserializeWireMessage( |
43 bool* is_incomplete_message) OVERRIDE { | 43 bool* is_incomplete_message) override { |
44 return make_scoped_ptr(DeserializeWireMessageProxy(is_incomplete_message)); | 44 return make_scoped_ptr(DeserializeWireMessageProxy(is_incomplete_message)); |
45 } | 45 } |
46 | 46 |
47 using Connection::status; | 47 using Connection::status; |
48 using Connection::SetStatus; | 48 using Connection::SetStatus; |
49 using Connection::OnDidSendMessage; | 49 using Connection::OnDidSendMessage; |
50 using Connection::OnBytesReceived; | 50 using Connection::OnBytesReceived; |
51 | 51 |
52 private: | 52 private: |
53 DISALLOW_COPY_AND_ASSIGN(MockConnection); | 53 DISALLOW_COPY_AND_ASSIGN(MockConnection); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 connection.AddObserver(&observer); | 238 connection.AddObserver(&observer); |
239 | 239 |
240 ON_CALL(connection, DeserializeWireMessageProxy(_)) | 240 ON_CALL(connection, DeserializeWireMessageProxy(_)) |
241 .WillByDefault(DoAll(SetArgPointee<0>(false), | 241 .WillByDefault(DoAll(SetArgPointee<0>(false), |
242 Return(static_cast<WireMessage*>(NULL)))); | 242 Return(static_cast<WireMessage*>(NULL)))); |
243 EXPECT_CALL(observer, OnMessageReceived(_, _)).Times(0); | 243 EXPECT_CALL(observer, OnMessageReceived(_, _)).Times(0); |
244 connection.OnBytesReceived(std::string()); | 244 connection.OnBytesReceived(std::string()); |
245 } | 245 } |
246 | 246 |
247 } // namespace proximity_auth | 247 } // namespace proximity_auth |
OLD | NEW |