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

Unified Diff: chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc

Issue 24869003: cryptohome: Move stateless wrapper functions out of CryptohomeLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 7 years, 3 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: chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc
diff --git a/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc b/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc
index c85940bd2e8c066905f6a96023ebdb257d148dca..dd1e63ab2c4400970d48e3abaaf537b4b219c787 100644
--- a/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc
+++ b/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc
@@ -11,12 +11,15 @@
#include "base/run_loop.h"
#include "chrome/browser/policy/proto/chromeos/install_attributes.pb.h"
#include "chromeos/cryptohome/cryptohome_library.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/fake_cryptohome_client.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace policy {
+namespace cryptohome_util = chromeos::cryptohome_util;
+
namespace {
void CopyLockResult(base::RunLoop* loop,
@@ -36,14 +39,18 @@ static const char kTestDeviceId[] = "133750519";
class EnterpriseInstallAttributesTest : public testing::Test {
protected:
EnterpriseInstallAttributesTest()
- : cryptohome_(chromeos::CryptohomeLibrary::GetTestImpl()),
- fake_cryptohome_client_(new chromeos::FakeCryptohomeClient()),
- install_attributes_(cryptohome_.get(), fake_cryptohome_client_.get()) {
+ : fake_cryptohome_client_(new chromeos::FakeCryptohomeClient()),
+ install_attributes_(fake_cryptohome_client_.get()) {
fake_cryptohome_client_->Init(NULL /* no dbus::Bus */);
}
virtual void SetUp() OVERRIDE {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ chromeos::DBusThreadManager::InitializeWithStub();
+ }
+
+ virtual void TearDown() OVERRIDE {
+ chromeos::DBusThreadManager::Shutdown();
}
base::FilePath GetTempPath() const {
@@ -62,7 +69,6 @@ class EnterpriseInstallAttributesTest : public testing::Test {
base::MessageLoopForUI message_loop_;
base::ScopedTempDir temp_dir_;
- scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_;
scoped_ptr<chromeos::FakeCryptohomeClient> fake_cryptohome_client_;
EnterpriseInstallAttributes install_attributes_;
@@ -175,12 +181,12 @@ TEST_F(EnterpriseInstallAttributesTest, ConsumerDevice) {
install_attributes_.ReadCacheFile(GetTempPath());
EXPECT_EQ(DEVICE_MODE_PENDING, install_attributes_.GetMode());
// Lock the attributes empty.
- ASSERT_TRUE(cryptohome_->InstallAttributesFinalize());
+ ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize());
base::RunLoop loop;
install_attributes_.ReadImmutableAttributes(base::Bind(loop.QuitClosure()));
loop.Run();
- ASSERT_FALSE(cryptohome_->InstallAttributesIsFirstInstall());
+ ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall());
EXPECT_EQ(DEVICE_MODE_CONSUMER, install_attributes_.GetMode());
}
@@ -194,7 +200,7 @@ TEST_F(EnterpriseInstallAttributesTest, ConsumerKioskDevice) {
DEVICE_MODE_CONSUMER_KIOSK,
std::string()));
- ASSERT_FALSE(cryptohome_->InstallAttributesIsFirstInstall());
+ ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall());
EXPECT_EQ(DEVICE_MODE_CONSUMER_KIOSK, install_attributes_.GetMode());
ASSERT_TRUE(install_attributes_.IsConsumerKioskDevice());
}
@@ -203,16 +209,16 @@ TEST_F(EnterpriseInstallAttributesTest, DeviceLockedFromOlderVersion) {
install_attributes_.ReadCacheFile(GetTempPath());
EXPECT_EQ(DEVICE_MODE_PENDING, install_attributes_.GetMode());
// Lock the attributes as if it was done from older Chrome version.
- ASSERT_TRUE(cryptohome_->InstallAttributesSet(
+ ASSERT_TRUE(cryptohome_util::InstallAttributesSet(
EnterpriseInstallAttributes::kAttrEnterpriseOwned, "true"));
- ASSERT_TRUE(cryptohome_->InstallAttributesSet(
+ ASSERT_TRUE(cryptohome_util::InstallAttributesSet(
EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser));
- ASSERT_TRUE(cryptohome_->InstallAttributesFinalize());
+ ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize());
base::RunLoop loop;
install_attributes_.ReadImmutableAttributes(base::Bind(loop.QuitClosure()));
loop.Run();
- ASSERT_FALSE(cryptohome_->InstallAttributesIsFirstInstall());
+ ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall());
EXPECT_EQ(DEVICE_MODE_ENTERPRISE, install_attributes_.GetMode());
EXPECT_EQ(kTestDomain, install_attributes_.GetDomain());
EXPECT_EQ(kTestUser, install_attributes_.GetRegistrationUser());

Powered by Google App Engine
This is Rietveld 408576698