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

Unified Diff: components/proximity_auth/remote_device_life_cycle_impl_unittest.cc

Issue 1372283002: Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/remote_device_life_cycle_impl_unittest.cc
diff --git a/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc b/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc
index 77e3aa36959a414efa5c07a0988ac19cb0d83cde..ec5e4c654a4f443f6395433a4ea51307a3fde280 100644
--- a/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc
+++ b/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc
@@ -92,8 +92,13 @@ class FakeConnectionFinder : public ConnectionFinder {
class FakeAuthenticator : public Authenticator {
public:
- FakeAuthenticator() {}
- ~FakeAuthenticator() override {}
+ FakeAuthenticator(Connection* connection) : connection_(connection) {}
+ ~FakeAuthenticator() override {
+ // This object should be destroyed immediately after authentication is
+ // complete in order not to outlive the underlying connection.
+ EXPECT_FALSE(callback_.is_null());
+ EXPECT_EQ(std::string(), connection_->remote_device().public_key);
+ }
void OnAuthenticationResult(Authenticator::Result result) {
ASSERT_FALSE(callback_.is_null());
@@ -110,6 +115,8 @@ class FakeAuthenticator : public Authenticator {
callback_ = callback;
}
+ Connection* connection_;
+
AuthenticationCallback callback_;
DISALLOW_COPY_AND_ASSIGN(FakeAuthenticator);
@@ -136,7 +143,9 @@ class TestableRemoteDeviceLifeCycleImpl : public RemoteDeviceLifeCycleImpl {
}
scoped_ptr<Authenticator> CreateAuthenticator() override {
- scoped_ptr<FakeAuthenticator> scoped_authenticator(new FakeAuthenticator());
+ EXPECT_TRUE(connection_finder_);
+ scoped_ptr<FakeAuthenticator> scoped_authenticator(
+ new FakeAuthenticator(connection_finder_->connection()));
authenticator_ = scoped_authenticator.get();
return scoped_authenticator.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698