Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chromeos/dbus/fake_auth_policy_client.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 namespace chromeos { | |
| 11 namespace { | |
| 12 | |
| 13 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
| |
| 14 | |
| 15 void JoinAdCallback(authpolicy::ErrorType expected, | |
| 16 authpolicy::ErrorType actual) { | |
| 17 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.
| |
| 18 } | |
| 19 | |
| 20 } // namespace | |
| 21 | |
| 22 TEST(FakeAuthPolicyClientTest, JoinAdDomain_ParseUPN) { | |
| 23 FakeAuthPolicyClient client; | |
| 24 client.JoinAdDomain(kMachineName, "user@realm.com", /* password_fd */ -1, | |
| 25 base::Bind(&JoinAdCallback, authpolicy::ERROR_NONE)); | |
| 26 | |
| 27 client.JoinAdDomain( | |
| 28 kMachineName, "user", /* password_fd */ -1, | |
| 29 base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); | |
| 30 | |
| 31 client.JoinAdDomain( | |
| 32 kMachineName, "", /* password_fd */ -1, | |
| 33 base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); | |
| 34 | |
| 35 client.JoinAdDomain( | |
| 36 kMachineName, "user@", /* password_fd */ -1, | |
| 37 base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); | |
| 38 | |
| 39 client.JoinAdDomain( | |
| 40 kMachineName, "@realm.com", /* password_fd */ -1, | |
| 41 base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); | |
| 42 | |
| 43 client.JoinAdDomain( | |
| 44 kMachineName, "user@realm@com", /* password_fd */ -1, | |
| 45 base::Bind(&JoinAdCallback, authpolicy::ERROR_PARSE_UPN_FAILED)); | |
| 46 } | |
| 47 | |
| 48 } // namespace chromeos | |
| OLD | NEW |