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

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

Issue 1377313002: Revert of Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: Created 5 years, 2 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 "base/callback.h" 7 #include "base/callback.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "components/proximity_auth/connection.h" 10 #include "components/proximity_auth/connection.h"
11 #include "components/proximity_auth/fake_connection.h" 11 #include "components/proximity_auth/fake_connection.h"
12 #include "components/proximity_auth/messenger_observer.h" 12 #include "components/proximity_auth/messenger_observer.h"
13 #include "components/proximity_auth/proximity_auth_test_util.h"
14 #include "components/proximity_auth/remote_device.h" 13 #include "components/proximity_auth/remote_device.h"
15 #include "components/proximity_auth/remote_status_update.h" 14 #include "components/proximity_auth/remote_status_update.h"
16 #include "components/proximity_auth/secure_context.h" 15 #include "components/proximity_auth/secure_context.h"
17 #include "components/proximity_auth/wire_message.h" 16 #include "components/proximity_auth/wire_message.h"
18 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
20 19
21 using testing::_; 20 using testing::_;
22 using testing::AllOf; 21 using testing::AllOf;
23 using testing::EndsWith; 22 using testing::EndsWith;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 private: 85 private:
87 // The messenger that |this| instance observes. 86 // The messenger that |this| instance observes.
88 Messenger* const messenger_; 87 Messenger* const messenger_;
89 88
90 DISALLOW_COPY_AND_ASSIGN(MockMessengerObserver); 89 DISALLOW_COPY_AND_ASSIGN(MockMessengerObserver);
91 }; 90 };
92 91
93 class TestMessenger : public MessengerImpl { 92 class TestMessenger : public MessengerImpl {
94 public: 93 public:
95 TestMessenger() 94 TestMessenger()
96 : MessengerImpl(make_scoped_ptr(new FakeConnection( 95 : MessengerImpl(make_scoped_ptr(new FakeConnection(RemoteDevice())),
97 CreateClassicRemoteDeviceForTest())),
98 make_scoped_ptr(new NiceMock<MockSecureContext>())) {} 96 make_scoped_ptr(new NiceMock<MockSecureContext>())) {}
99 ~TestMessenger() override {} 97 ~TestMessenger() override {}
100 98
101 // Simple getters for the mock objects owned by |this| messenger. 99 // Simple getters for the mock objects owned by |this| messenger.
102 FakeConnection* GetFakeConnection() { 100 FakeConnection* GetFakeConnection() {
103 return static_cast<FakeConnection*>(connection()); 101 return static_cast<FakeConnection*>(connection());
104 } 102 }
105 MockSecureContext* GetMockSecureContext() { 103 MockSecureContext* GetMockSecureContext() {
106 return static_cast<MockSecureContext*>(secure_context()); 104 return static_cast<MockSecureContext*>(secure_context());
107 } 105 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 "\"data\":\"YSB3aW5uZXIgaXMgeW91\"" 460 "\"data\":\"YSB3aW5uZXIgaXMgeW91\""
463 "}, but encoded"); 461 "}, but encoded");
464 462
465 // The unlock request should have remained buffered, and should only now be 463 // The unlock request should have remained buffered, and should only now be
466 // sent. 464 // sent.
467 EXPECT_CALL(observer, OnUnlockResponse(false)); 465 EXPECT_CALL(observer, OnUnlockResponse(false));
468 messenger.GetFakeConnection()->FinishSendingMessageWithSuccess(false); 466 messenger.GetFakeConnection()->FinishSendingMessageWithSuccess(false);
469 } 467 }
470 468
471 } // namespace proximity_auth 469 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/messenger_impl.cc ('k') | components/proximity_auth/proximity_auth_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698