Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: components/proximity_auth/messenger_impl_unittest.cc

Issue 1912433002: Convert //components/proximity_auth from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
8
7 #include "base/callback.h" 9 #include "base/callback.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/ptr_util.h"
10 #include "components/proximity_auth/connection.h" 12 #include "components/proximity_auth/connection.h"
11 #include "components/proximity_auth/fake_connection.h" 13 #include "components/proximity_auth/fake_connection.h"
12 #include "components/proximity_auth/fake_secure_context.h" 14 #include "components/proximity_auth/fake_secure_context.h"
13 #include "components/proximity_auth/messenger_observer.h" 15 #include "components/proximity_auth/messenger_observer.h"
14 #include "components/proximity_auth/proximity_auth_test_util.h" 16 #include "components/proximity_auth/proximity_auth_test_util.h"
15 #include "components/proximity_auth/remote_device.h" 17 #include "components/proximity_auth/remote_device.h"
16 #include "components/proximity_auth/remote_status_update.h" 18 #include "components/proximity_auth/remote_status_update.h"
17 #include "components/proximity_auth/wire_message.h" 19 #include "components/proximity_auth/wire_message.h"
18 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 private: 56 private:
55 // The messenger that |this| instance observes. 57 // The messenger that |this| instance observes.
56 Messenger* const messenger_; 58 Messenger* const messenger_;
57 59
58 DISALLOW_COPY_AND_ASSIGN(MockMessengerObserver); 60 DISALLOW_COPY_AND_ASSIGN(MockMessengerObserver);
59 }; 61 };
60 62
61 class TestMessenger : public MessengerImpl { 63 class TestMessenger : public MessengerImpl {
62 public: 64 public:
63 TestMessenger() 65 TestMessenger()
64 : MessengerImpl(make_scoped_ptr(new FakeConnection( 66 : MessengerImpl(base::WrapUnique(new FakeConnection(
65 CreateClassicRemoteDeviceForTest())), 67 CreateClassicRemoteDeviceForTest())),
66 make_scoped_ptr(new FakeSecureContext())) {} 68 base::WrapUnique(new FakeSecureContext())) {}
67 ~TestMessenger() override {} 69 ~TestMessenger() override {}
68 70
69 // Simple getters for the mock objects owned by |this| messenger. 71 // Simple getters for the mock objects owned by |this| messenger.
70 FakeConnection* GetFakeConnection() { 72 FakeConnection* GetFakeConnection() {
71 return static_cast<FakeConnection*>(connection()); 73 return static_cast<FakeConnection*>(connection());
72 } 74 }
73 FakeSecureContext* GetFakeSecureContext() { 75 FakeSecureContext* GetFakeSecureContext() {
74 return static_cast<FakeSecureContext*>(GetSecureContext()); 76 return static_cast<FakeSecureContext*>(GetSecureContext());
75 } 77 }
76 78
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 "\"data\":\"YSB3aW5uZXIgaXMgeW91\"" 432 "\"data\":\"YSB3aW5uZXIgaXMgeW91\""
431 "}, but encoded"); 433 "}, but encoded");
432 434
433 // 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
434 // sent. 436 // sent.
435 EXPECT_CALL(observer, OnUnlockResponse(false)); 437 EXPECT_CALL(observer, OnUnlockResponse(false));
436 messenger.GetFakeConnection()->FinishSendingMessageWithSuccess(false); 438 messenger.GetFakeConnection()->FinishSendingMessageWithSuccess(false);
437 } 439 }
438 440
439 } // namespace proximity_auth 441 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/messenger_impl.cc ('k') | components/proximity_auth/messenger_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698