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

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

Issue 50093002: Added a timeout for platform verification key generation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed browsertest Created 7 years, 1 month 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: chrome/browser/chromeos/attestation/platform_verification_flow_unittest.cc
diff --git a/chrome/browser/chromeos/attestation/platform_verification_flow_unittest.cc b/chrome/browser/chromeos/attestation/platform_verification_flow_unittest.cc
index 8e918a27aa9428e2db1f0dbd17dab8610bf1b292..b8174052d7c769fe6f0ecd15f04998b29a552000 100644
--- a/chrome/browser/chromeos/attestation/platform_verification_flow_unittest.cc
+++ b/chrome/browser/chromeos/attestation/platform_verification_flow_unittest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_registry_simple.h"
-#include "base/prefs/scoped_user_pref_update.h"
#include "base/prefs/testing_pref_service.h"
#include "base/run_loop.h"
#include "chrome/browser/chromeos/attestation/attestation_signed_data.pb.h"
@@ -132,11 +131,11 @@ class PlatformVerificationFlowTest : public ::testing::Test {
mock_user_manager_.SetActiveUser(kTestEmail);
// Create a verifier for tests to call.
- verifier_.reset(new PlatformVerificationFlow(&mock_attestation_flow_,
- &mock_async_caller_,
- &fake_cryptohome_client_,
- &mock_user_manager_,
- &fake_delegate_));
+ verifier_ = new PlatformVerificationFlow(&mock_attestation_flow_,
+ &mock_async_caller_,
+ &fake_cryptohome_client_,
+ &mock_user_manager_,
+ &fake_delegate_);
// Create callbacks for tests to use with verifier_.
callback_ = base::Bind(&PlatformVerificationFlowTest::FakeChallengeCallback,
@@ -226,7 +225,6 @@ class PlatformVerificationFlowTest : public ::testing::Test {
}
void TearDown() {
- verifier_.reset();
// Restore the real DeviceSettingsProvider.
CrosSettings* cros_settings = CrosSettings::Get();
cros_settings->RemoveSettingsProvider(&stub_settings_provider_);
@@ -315,7 +313,7 @@ class PlatformVerificationFlowTest : public ::testing::Test {
ScopedTestDeviceSettingsService test_device_settings_service_;
ScopedTestCrosSettings test_cros_settings_;
scoped_refptr<HostContentSettingsMap> test_content_settings_;
- scoped_ptr<PlatformVerificationFlow> verifier_;
+ scoped_refptr<PlatformVerificationFlow> verifier_;
// Controls result of FakeGetCertificate.
bool certificate_success_;
@@ -453,5 +451,13 @@ TEST_F(PlatformVerificationFlowTest, ConsentPerScheme) {
EXPECT_EQ(2, fake_delegate_.num_consent_calls());
}
+TEST_F(PlatformVerificationFlowTest, Timeout) {
+ verifier_->set_timeout_delay(base::TimeDelta::FromSeconds(0));
+ ExpectAttestationFlow();
+ verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_);
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(PlatformVerificationFlow::TIMEOUT, result_);
+}
+
} // namespace attestation
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698