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

Side by Side Diff: chromeos/dbus/fake_auth_policy_client_unittest.cc

Issue 2653913002: Check username validity in the FakeAuthPolicyClient (Closed)
Patch Set: Add unittests Created 3 years, 11 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
« no previous file with comments | « chromeos/dbus/fake_auth_policy_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_auth_policy_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698