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

Unified Diff: src/platform/pam_offline/authenticator_unittest.cc

Issue 2051003: Initial patch from Will. (Closed) Base URL: ssh://git@chromiumos-git/chromiumos
Patch Set: Address style nits. Created 10 years, 7 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: src/platform/pam_offline/authenticator_unittest.cc
diff --git a/src/platform/pam_offline/authenticator_unittest.cc b/src/platform/pam_offline/authenticator_unittest.cc
deleted file mode 100644
index 600814cdd9ad255d8fd616af00b0d24228b11a38..0000000000000000000000000000000000000000
--- a/src/platform/pam_offline/authenticator_unittest.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Unit tests for UsernamePassword.
-
-#include "pam_offline/authenticator.h"
-
-#include <string.h> // For memset(), memcpy()
-#include <stdlib.h>
-
-#include "gtest/gtest.h"
-#include "pam_offline/authenticator.h"
-#include "pam_offline/username_password.h"
-#include "pam_offline/utils.h"
-
-namespace pam_offline {
-
-using std::string;
-
-const char kImageDir[] = "test_image_dir";
-const char kFakeUser[] = "testuser@invalid.domain";
-
-class AuthenticatorTest : public ::testing::Test { };
-
-TEST(AuthenticatorTest, BadInitTest) {
- // create an authenticator that points to an invalid shadow root
- // and make sure it complains
- Authenticator authn("/dev/null");
- UsernamePassword up(kFakeUser, strlen(kFakeUser),
- "zero", 4);
-
- EXPECT_EQ(false, authn.Init());
- EXPECT_EQ(false, authn.TestAllMasterKeys(up));
-}
-
-TEST(AuthenticatorTest, GoodDecryptTest0) {
- Authenticator authn(kImageDir);
- UsernamePassword up(kFakeUser, strlen(kFakeUser),
- "zero", 4);
-
- EXPECT_EQ(true, authn.Init());
- EXPECT_EQ(true, authn.TestAllMasterKeys(up));
-}
-
-TEST(AuthenticatorTest, GoodDecryptTest1) {
- Authenticator authn(kImageDir);
- UsernamePassword up(kFakeUser, strlen(kFakeUser),
- "one", 3);
-
- EXPECT_EQ(true, authn.Init());
- EXPECT_EQ(true, authn.TestAllMasterKeys(up));
-}
-
-TEST(AuthenticatorTest, GoodDecryptTest2) {
- Authenticator authn(kImageDir);
- UsernamePassword up(kFakeUser, strlen(kFakeUser),
- "two", 3);
-
- EXPECT_EQ(true, authn.Init());
- EXPECT_EQ(true, authn.TestAllMasterKeys(up));
-}
-
-TEST(AuthenticatorTest, BadDecryptTest) {
- Authenticator authn(kImageDir);
- UsernamePassword up(kFakeUser, strlen(kFakeUser),
- "bogus", 5);
-
- EXPECT_EQ(true, authn.Init());
- EXPECT_EQ(false, authn.TestAllMasterKeys(up));
-}
-
-} // namespace pam_offline

Powered by Google App Engine
This is Rietveld 408576698