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

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

Issue 265013002: Revert of Enable Enterprise enrollment on desktop builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/device_policy_cros_browser_test.cc
diff --git a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
index 782cf3d7fe9812e0085a5ad4d9b9050188f382dd..4797ee4c6ca7356de2d18c8a60ddfe08b69293b3 100644
--- a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
+++ b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
@@ -14,7 +14,6 @@
#include "chrome/browser/chromeos/policy/device_policy_builder.h"
#include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
#include "chrome/browser/chromeos/policy/proto/install_attributes.pb.h"
-#include "chrome/common/chrome_paths.h"
#include "chromeos/chromeos_paths.h"
#include "chromeos/dbus/fake_dbus_thread_manager.h"
#include "chromeos/dbus/fake_session_manager_client.h"
@@ -28,13 +27,13 @@
namespace policy {
-DevicePolicyCrosTestHelper::DevicePolicyCrosTestHelper() {}
+DevicePolicyCrosTestHelper::DevicePolicyCrosTestHelper() {
+ CHECK(temp_dir_.CreateUniqueTempDir());
+}
DevicePolicyCrosTestHelper::~DevicePolicyCrosTestHelper() {}
void DevicePolicyCrosTestHelper::MarkAsEnterpriseOwned() {
- OverridePaths();
-
cryptohome::SerializedInstallAttributes install_attrs_proto;
cryptohome::SerializedInstallAttributes::Attribute* attribute = NULL;
@@ -46,22 +45,20 @@
attribute->set_name(EnterpriseInstallAttributes::kAttrEnterpriseUser);
attribute->set_value(device_policy_.policy_data().username());
- base::FilePath install_attrs_file;
- ASSERT_TRUE(
- PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, &install_attrs_file));
+ base::FilePath install_attrs_file =
+ temp_dir_.path().AppendASCII("install_attributes.pb");
const std::string install_attrs_blob(
install_attrs_proto.SerializeAsString());
ASSERT_EQ(static_cast<int>(install_attrs_blob.size()),
base::WriteFile(install_attrs_file,
install_attrs_blob.c_str(),
install_attrs_blob.size()));
+ ASSERT_TRUE(PathService::Override(chromeos::FILE_INSTALL_ATTRIBUTES,
+ install_attrs_file));
}
void DevicePolicyCrosTestHelper::InstallOwnerKey() {
- OverridePaths();
-
- base::FilePath owner_key_file;
- ASSERT_TRUE(PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_file));
+ base::FilePath owner_key_file = temp_dir_.path().AppendASCII("owner.key");
std::vector<uint8> owner_key_bits;
ASSERT_TRUE(
device_policy()->GetSigningKey()->ExportPublicKey(&owner_key_bits));
@@ -70,15 +67,7 @@
reinterpret_cast<const char*>(vector_as_array(&owner_key_bits)),
owner_key_bits.size()),
static_cast<int>(owner_key_bits.size()));
-}
-
-void DevicePolicyCrosTestHelper::OverridePaths() {
- // This is usually done by ChromeBrowserMainChromeOS, but some tests
- // use the overridden paths before ChromeBrowserMain starts. Make sure that
- // the paths are overridden before using them.
- base::FilePath user_data_dir;
- ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
- chromeos::RegisterStubPathOverrides(user_data_dir);
+ ASSERT_TRUE(PathService::Override(chromeos::FILE_OWNER_KEY, owner_key_file));
}
DevicePolicyCrosBrowserTest::DevicePolicyCrosBrowserTest()

Powered by Google App Engine
This is Rietveld 408576698