| 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());
|
|
|