OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chromeos/dbus/fake_auth_policy_client.h" | 5 #include "chromeos/dbus/fake_auth_policy_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "components/signin/core/account_id/account_id.h" | 10 #include "components/signin/core/account_id/account_id.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 | 104 |
105 // Test AuthenticateUser. | 105 // Test AuthenticateUser. |
106 TEST_F(FakeAuthPolicyClientTest, AuthenticateUser_ByObjectGUID) { | 106 TEST_F(FakeAuthPolicyClientTest, AuthenticateUser_ByObjectGUID) { |
107 authpolicy_client()->set_started(true); | 107 authpolicy_client()->set_started(true); |
108 // Check that objectGUID do not change. | 108 // Check that objectGUID do not change. |
109 authpolicy_client()->AuthenticateUser( | 109 authpolicy_client()->AuthenticateUser( |
110 kCorrectUserName, kObjectGUID, /* password_fd */ -1, | 110 kCorrectUserName, kObjectGUID, /* password_fd */ -1, |
111 base::Bind( | 111 base::Bind( |
112 [](authpolicy::ErrorType error, | 112 [](authpolicy::ErrorType error, |
113 const authpolicy::ActiveDirectoryAccountData& account_data) { | 113 const authpolicy::ActiveDirectoryAccountInfo& account_info) { |
114 EXPECT_EQ(authpolicy::ERROR_NONE, error); | 114 EXPECT_EQ(authpolicy::ERROR_NONE, error); |
115 EXPECT_EQ(kObjectGUID, account_data.account_id()); | 115 EXPECT_EQ(kObjectGUID, account_info.account_id()); |
116 })); | 116 })); |
117 } | 117 } |
118 | 118 |
119 // Tests calls to not started authpolicyd fails. | 119 // Tests calls to not started authpolicyd fails. |
120 TEST_F(FakeAuthPolicyClientTest, NotStartedAuthPolicyService) { | 120 TEST_F(FakeAuthPolicyClientTest, NotStartedAuthPolicyService) { |
121 authpolicy_client()->JoinAdDomain( | 121 authpolicy_client()->JoinAdDomain( |
122 kCorrectMachineName, kCorrectUserName, | 122 kCorrectMachineName, kCorrectUserName, |
123 /* password_fd */ -1, base::Bind([](authpolicy::ErrorType error) { | 123 /* password_fd */ -1, base::Bind([](authpolicy::ErrorType error) { |
124 EXPECT_EQ(authpolicy::ERROR_DBUS_FAILURE, error); | 124 EXPECT_EQ(authpolicy::ERROR_DBUS_FAILURE, error); |
125 })); | 125 })); |
126 authpolicy_client()->AuthenticateUser( | 126 authpolicy_client()->AuthenticateUser( |
127 kCorrectUserName, std::string() /* object_guid */, /* password_fd */ -1, | 127 kCorrectUserName, std::string() /* object_guid */, /* password_fd */ -1, |
128 base::Bind([](authpolicy::ErrorType error, | 128 base::Bind([](authpolicy::ErrorType error, |
129 const authpolicy::ActiveDirectoryAccountData&) { | 129 const authpolicy::ActiveDirectoryAccountInfo&) { |
130 EXPECT_EQ(authpolicy::ERROR_DBUS_FAILURE, error); | 130 EXPECT_EQ(authpolicy::ERROR_DBUS_FAILURE, error); |
131 })); | 131 })); |
132 authpolicy_client()->RefreshDevicePolicy( | 132 authpolicy_client()->RefreshDevicePolicy( |
133 base::Bind([](bool success) { EXPECT_FALSE(success); })); | 133 base::Bind([](bool success) { EXPECT_FALSE(success); })); |
134 authpolicy_client()->RefreshUserPolicy( | 134 authpolicy_client()->RefreshUserPolicy( |
135 AccountId::FromUserEmail(kCorrectUserName), | 135 AccountId::FromUserEmail(kCorrectUserName), |
136 base::Bind([](bool success) { EXPECT_FALSE(success); })); | 136 base::Bind([](bool success) { EXPECT_FALSE(success); })); |
137 | 137 |
138 base::RunLoop().RunUntilIdle(); | 138 base::RunLoop().RunUntilIdle(); |
139 } | 139 } |
140 | 140 |
141 } // namespace chromeos | 141 } // namespace chromeos |
OLD | NEW |