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

Unified Diff: src/platform/cryptohome/service_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/cryptohome/service_unittest.cc
diff --git a/src/platform/cryptohome/service_unittest.cc b/src/platform/cryptohome/service_unittest.cc
index 9da5502669bcab55fb5807c04452780169699a1b..1483b74d22db1c09ebcf0ef05452355a63d8783c 100755
--- a/src/platform/cryptohome/service_unittest.cc
+++ b/src/platform/cryptohome/service_unittest.cc
@@ -9,22 +9,20 @@
#include <glib.h>
#include <gtest/gtest.h>
-#include "cryptohome/mock_authenticator.h"
+#include "cryptohome/mock_mount.h"
namespace cryptohome {
using ::testing::Return;
using ::testing::_;
TEST(ServiceInterfaceTests, CheckKeySuccessTest) {
- MockAuthenticator *auth = new MockAuthenticator;
- EXPECT_CALL(*auth, Init())
- .WillOnce(Return(true));
- EXPECT_CALL(*auth, TestAllMasterKeys(_))
+ MockMount *mount = new MockMount;
+ EXPECT_CALL(*mount, TestCredentials(_))
.WillOnce(Return(true));
Service service;
+ service.set_mount(mount); // takes ownership.
service.Initialize();
- service.set_authenticator(auth); // takes ownership.
gboolean out = FALSE;
GError *error = NULL;
@@ -34,38 +32,6 @@ TEST(ServiceInterfaceTests, CheckKeySuccessTest) {
EXPECT_EQ(TRUE, out);
}
-TEST(ServiceInterfaceTests, NopWrappers) {
- Service service;
- service.Initialize();
- service.set_mount_command("/bin/true");
- service.set_unmount_command("/bin/true");
- gboolean out = FALSE;
- GError *error = NULL;
- service.set_is_mounted_command("/bin/true");
- EXPECT_EQ(TRUE, service.IsMounted(&out, &error));
- EXPECT_EQ(TRUE, out);
- // Change to false so that we can exercise Mount
- // without it failing on a double mount.
- service.set_is_mounted_command("/bin/false");
- char user[] = "chromeos-user";
- char key[] = "274146c6e8886a843ddfea373e2dc71b";
- out = FALSE;
- EXPECT_EQ(TRUE, service.Mount(user, key, &out, &error));
- EXPECT_EQ(TRUE, out);
- // Check double mount detection
- service.set_is_mounted_command("/bin/true");
- out = FALSE;
- EXPECT_EQ(TRUE, service.Mount(user, key, &out, &error));
- EXPECT_EQ(FALSE, out);
-
- EXPECT_TRUE(service.Unmount(&out, &error));
- EXPECT_EQ(out, TRUE);
- // Check IsMounted tests for unmounting nothing.
- service.set_is_mounted_command("/bin/false");
- EXPECT_TRUE(service.Unmount(&out, &error));
- EXPECT_EQ(out, TRUE);
-}
-
// TODO(wad) setup test fixture to create a temp dir
// touch files on Mount/Unmount/IsMounted and
// check for goodness.

Powered by Google App Engine
This is Rietveld 408576698