Chromium Code Reviews| Index: chromeos/dbus/fake_auth_policy_client_unittest.cc |
| diff --git a/chromeos/dbus/fake_auth_policy_client_unittest.cc b/chromeos/dbus/fake_auth_policy_client_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8df16808686b6d48a2177674f9c5a6d2d06d7a5d |
| --- /dev/null |
| +++ b/chromeos/dbus/fake_auth_policy_client_unittest.cc |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chromeos/dbus/fake_auth_policy_client.h" |
| + |
| +#include "base/bind.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace chromeos { |
| +namespace { |
| + |
| +const char kMachineName[] = "machine_name"; |
|
achuithb
2017/01/25 20:02:46
I think this just adds noise - why not pass in ""
Roman Sorokin (ftl)
2017/01/26 13:10:14
I decided to add machine_name checks, and tests fo
|
| + |
| +void JoinAdCallback(authpolicy::ErrorType expected, |
| + authpolicy::ErrorType actual) { |
| + EXPECT_EQ(expected, actual); |
|
achuithb
2017/01/25 20:02:46
Hmm, I believe you won't be able to tell which cas
Roman Sorokin (ftl)
2017/01/26 13:10:14
Done.
|
| +} |
| + |
| +} // namespace |
| + |
| +TEST(FakeAuthPolicyClientTest, JoinAdDomain_ParseUPN) { |
| + FakeAuthPolicyClient client; |
| + client.JoinAdDomain(kMachineName, "user@realm.com", /* password_fd */ -1, |
| + base::Bind(&JoinAdCallback, authpolicy::ERROR_NONE)); |
| + |
| + client.JoinAdDomain( |
| + kMachineName, "user", /* password_fd */ -1, |
| + base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); |
| + |
| + client.JoinAdDomain( |
| + kMachineName, "", /* password_fd */ -1, |
| + base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); |
| + |
| + client.JoinAdDomain( |
| + kMachineName, "user@", /* password_fd */ -1, |
| + base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); |
| + |
| + client.JoinAdDomain( |
| + kMachineName, "@realm.com", /* password_fd */ -1, |
| + base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); |
| + |
| + client.JoinAdDomain( |
| + kMachineName, "user@realm@com", /* password_fd */ -1, |
| + base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); |
| +} |
| + |
| +} // namespace chromeos |