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

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

Issue 247283007: Add ScopedStubEnterpriseInstallAttributes for tests to set test install attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/browser_policy_connector_chromeos.cc
diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
index cbcbe3a27e5a27657b24599287fb8f558f718c2e..efb4c2701ea5a4f6a5fcb44c454783591b738bf3 100644
--- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
+++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
@@ -84,8 +84,10 @@ BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS()
: device_cloud_policy_manager_(NULL),
global_user_cloud_policy_provider_(NULL),
weak_ptr_factory_(this) {
- if (g_testing_install_attributes)
+ if (g_testing_install_attributes) {
install_attributes_.reset(g_testing_install_attributes);
+ g_testing_install_attributes = NULL;
+ }
// SystemSaltGetter or DBusThreadManager may be uninitialized on unit tests.
@@ -95,7 +97,7 @@ BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS()
chromeos::DBusThreadManager::IsInitialized()) {
chromeos::CryptohomeClient* cryptohome_client =
chromeos::DBusThreadManager::Get()->GetCryptohomeClient();
- if (!g_testing_install_attributes) {
+ if (!install_attributes_) {
install_attributes_.reset(
new EnterpriseInstallAttributes(cryptohome_client));
}
@@ -243,6 +245,13 @@ void BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting(
g_testing_install_attributes = attributes;
}
+void BrowserPolicyConnectorChromeOS::RemoveInstallAttributesForTesting() {
+ if (g_testing_install_attributes) {
+ delete g_testing_install_attributes;
+ g_testing_install_attributes = NULL;
+ }
+}
+
// static
void BrowserPolicyConnectorChromeOS::RegisterPrefs(
PrefRegistrySimple* registry) {

Powered by Google App Engine
This is Rietveld 408576698