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

Unified Diff: chromeos/dbus/fake_auth_policy_client_unittest.cc

Issue 2794493002: Add AuthPolicyLoginHelper (Closed)
Patch Set: Fix test + Update on Lutz's comments Created 3 years, 8 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: 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
index e220238e18e8d2c30796b8f74b9fb910f1adb156..fe3c0269455c4d8c70e37343b3c3b854a913ed3a 100644
--- a/chromeos/dbus/fake_auth_policy_client_unittest.cc
+++ b/chromeos/dbus/fake_auth_policy_client_unittest.cc
@@ -5,6 +5,8 @@
#include "chromeos/dbus/fake_auth_policy_client.h"
#include "base/bind.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "components/signin/core/account_id/account_id.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -18,6 +20,7 @@ const char kCorrectUserName[] = "user@realm.com";
// Tests parsing machine name.
TEST(FakeAuthPolicyClientTest, JoinAdDomain_ParseMachineName) {
+ base::MessageLoop loop;
hashimoto 2017/04/04 12:04:13 You can let a test fixture class own this loop and
Roman Sorokin (ftl) 2017/04/06 15:00:32 Done.
FakeAuthPolicyClient client;
client.set_started(true);
client.JoinAdDomain("correct_length1", kCorrectUserName, /* password_fd */ -1,
@@ -41,10 +44,13 @@ TEST(FakeAuthPolicyClientTest, JoinAdDomain_ParseMachineName) {
base::Bind([](authpolicy::ErrorType error) {
EXPECT_EQ(authpolicy::ERROR_BAD_MACHINE_NAME, error);
}));
+
+ base::RunLoop().RunUntilIdle();
}
// Tests parsing user name.
TEST(FakeAuthPolicyClientTest, JoinAdDomain_ParseUPN) {
+ base::MessageLoop loop;
FakeAuthPolicyClient client;
client.set_started(true);
client.JoinAdDomain(kCorrectMachineName, "user@realm.com",
@@ -73,10 +79,13 @@ TEST(FakeAuthPolicyClientTest, JoinAdDomain_ParseUPN) {
base::Bind([](authpolicy::ErrorType error) {
EXPECT_EQ(authpolicy::ERROR_PARSE_UPN_FAILED, error);
}));
+
+ base::RunLoop().RunUntilIdle();
}
// Tests calls to not started authpolicyd fails.
TEST(FakeAuthPolicyClientTest, NotStartedAuthPolicyService) {
+ base::MessageLoop loop;
FakeAuthPolicyClient client;
client.JoinAdDomain(kCorrectMachineName, kCorrectUserName,
/* password_fd */ -1,
@@ -94,6 +103,8 @@ TEST(FakeAuthPolicyClientTest, NotStartedAuthPolicyService) {
client.RefreshUserPolicy(
AccountId::FromUserEmail(kCorrectUserName),
base::Bind([](bool success) { EXPECT_FALSE(success); }));
+
+ base::RunLoop().RunUntilIdle();
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698