| 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/messenger_impl.h" | 5 #include "components/proximity_auth/messenger_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 private: | 56 private: |
| 57 // The messenger that |this| instance observes. | 57 // The messenger that |this| instance observes. |
| 58 Messenger* const messenger_; | 58 Messenger* const messenger_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(MockMessengerObserver); | 60 DISALLOW_COPY_AND_ASSIGN(MockMessengerObserver); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 class TestMessenger : public MessengerImpl { | 63 class TestMessenger : public MessengerImpl { |
| 64 public: | 64 public: |
| 65 TestMessenger() | 65 TestMessenger() |
| 66 : MessengerImpl(base::WrapUnique(new FakeConnection( | 66 : MessengerImpl(base::MakeUnique<FakeConnection>( |
| 67 CreateClassicRemoteDeviceForTest())), | 67 CreateClassicRemoteDeviceForTest()), |
| 68 base::WrapUnique(new FakeSecureContext())) {} | 68 base::MakeUnique<FakeSecureContext>()) {} |
| 69 ~TestMessenger() override {} | 69 ~TestMessenger() override {} |
| 70 | 70 |
| 71 // Simple getters for the mock objects owned by |this| messenger. | 71 // Simple getters for the mock objects owned by |this| messenger. |
| 72 FakeConnection* GetFakeConnection() { | 72 FakeConnection* GetFakeConnection() { |
| 73 return static_cast<FakeConnection*>(connection()); | 73 return static_cast<FakeConnection*>(connection()); |
| 74 } | 74 } |
| 75 FakeSecureContext* GetFakeSecureContext() { | 75 FakeSecureContext* GetFakeSecureContext() { |
| 76 return static_cast<FakeSecureContext*>(GetSecureContext()); | 76 return static_cast<FakeSecureContext*>(GetSecureContext()); |
| 77 } | 77 } |
| 78 | 78 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 "\"data\":\"YSB3aW5uZXIgaXMgeW91\"" | 432 "\"data\":\"YSB3aW5uZXIgaXMgeW91\"" |
| 433 "}, but encoded"); | 433 "}, but encoded"); |
| 434 | 434 |
| 435 // The unlock request should have remained buffered, and should only now be | 435 // The unlock request should have remained buffered, and should only now be |
| 436 // sent. | 436 // sent. |
| 437 EXPECT_CALL(observer, OnUnlockResponse(false)); | 437 EXPECT_CALL(observer, OnUnlockResponse(false)); |
| 438 messenger.GetFakeConnection()->FinishSendingMessageWithSuccess(false); | 438 messenger.GetFakeConnection()->FinishSendingMessageWithSuccess(false); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace proximity_auth | 441 } // namespace proximity_auth |
| OLD | NEW |