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

Unified Diff: chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc

Issue 18053006: Added retry support to AttestationPolicyObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « chrome/browser/chromeos/attestation/attestation_policy_observer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc
diff --git a/chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc b/chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc
index 31a274f868a3928e3be7cdea6e4157375fde08c9..dd0a07075f7cbc016b165008e631b8f1ed0f2ba9 100644
--- a/chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc
+++ b/chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc
@@ -75,6 +75,11 @@ void DBusCallbackTrue(const BoolDBusMethodCallback& callback) {
FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
}
+void DBusCallbackError(const BoolDBusMethodCallback& callback) {
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_FAILURE, false));
+}
+
void CertCallbackSuccess(const AttestationFlow::CertificateCallback& callback) {
base::MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(callback, true, "fake_cert"));
@@ -187,6 +192,7 @@ class AttestationPolicyObserverTest : public ::testing::Test {
AttestationPolicyObserver observer(&policy_client_,
&cryptohome_client_,
&attestation_flow_);
+ observer.set_retry_delay(0);
base::RunLoop().RunUntilIdle();
}
@@ -288,5 +294,14 @@ TEST_F(AttestationPolicyObserverTest, IgnoreUnknownCertFormat) {
Run();
}
+TEST_F(AttestationPolicyObserverTest, DBusFailureRetry) {
+ SetupMocks(MOCK_NEW_KEY, "");
+ // Simulate a DBus failure.
+ EXPECT_CALL(cryptohome_client_, TpmAttestationDoesKeyExist(_, _, _))
+ .WillOnce(WithArgs<2>(Invoke(DBusCallbackError)))
+ .WillRepeatedly(WithArgs<2>(Invoke(DBusCallbackFalse)));
+ Run();
+}
+
} // namespace attestation
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/attestation/attestation_policy_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698