diff options
author | sreeram@chromium.org <sreeram@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-19 19:28:44 +0000 |
---|---|---|
committer | sreeram@chromium.org <sreeram@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-19 19:28:44 +0000 |
commit | 350928d345250305e13e1dec5d30d76ff119badd (patch) | |
tree | 77c62c856a1aea6737b8881c469508569ee36229 /chrome/browser/chromeos/settings | |
parent | a6f8cb73534952d34e66001f09443e6955b7302b (diff) | |
download | chromium_src-350928d345250305e13e1dec5d30d76ff119badd.zip chromium_src-350928d345250305e13e1dec5d30d76ff119badd.tar.gz chromium_src-350928d345250305e13e1dec5d30d76ff119badd.tar.bz2 |
Revert 168563 - Wire up local account policy DBus calls in SessionManagerClient.
BUG=chromium-os:35715
TEST=None
Review URL: https://chromiumcodereview.appspot.com/11360191
You had a green linux_chromeos try run, but unfortunately, clang is pickier:
http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20%28Clang%20dbg%29/builds/24522
TBR=mnissler@chromium.org
Review URL: https://codereview.chromium.org/11308106
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/settings')
-rw-r--r-- | chrome/browser/chromeos/settings/device_settings_test_helper.cc | 74 | ||||
-rw-r--r-- | chrome/browser/chromeos/settings/device_settings_test_helper.h | 54 |
2 files changed, 20 insertions, 108 deletions
diff --git a/chrome/browser/chromeos/settings/device_settings_test_helper.cc b/chrome/browser/chromeos/settings/device_settings_test_helper.cc index d1951e8..eb6c889 100644 --- a/chrome/browser/chromeos/settings/device_settings_test_helper.cc +++ b/chrome/browser/chromeos/settings/device_settings_test_helper.cc @@ -12,7 +12,8 @@ namespace chromeos { -DeviceSettingsTestHelper::DeviceSettingsTestHelper() {} +DeviceSettingsTestHelper::DeviceSettingsTestHelper() + : store_result_(true) {} DeviceSettingsTestHelper::~DeviceSettingsTestHelper() {} @@ -29,41 +30,19 @@ void DeviceSettingsTestHelper::FlushLoops() { void DeviceSettingsTestHelper::FlushStore() { std::vector<StorePolicyCallback> callbacks; - callbacks.swap(device_policy_.store_callbacks_); + callbacks.swap(store_callbacks_); for (std::vector<StorePolicyCallback>::iterator cb(callbacks.begin()); cb != callbacks.end(); ++cb) { - cb->Run(device_policy_.store_result_); - } - - std::map<std::string, PolicyState>::iterator device_local_account_state; - for (device_local_account_state = device_local_account_policy_.begin(); - device_local_account_state != device_local_account_policy_.end(); - ++device_local_account_state) { - callbacks.swap(device_local_account_state->second.store_callbacks_); - for (std::vector<StorePolicyCallback>::iterator cb(callbacks.begin()); - cb != callbacks.end(); ++cb) { - cb->Run(device_local_account_state->second.store_result_); - } + cb->Run(store_result_); } } void DeviceSettingsTestHelper::FlushRetrieve() { std::vector<RetrievePolicyCallback> callbacks; - callbacks.swap(device_policy_.retrieve_callbacks_); + callbacks.swap(retrieve_callbacks_); for (std::vector<RetrievePolicyCallback>::iterator cb(callbacks.begin()); cb != callbacks.end(); ++cb) { - cb->Run(device_policy_.policy_blob_); - } - - std::map<std::string, PolicyState>::iterator device_local_account_state; - for (device_local_account_state = device_local_account_policy_.begin(); - device_local_account_state != device_local_account_policy_.end(); - ++device_local_account_state) { - callbacks.swap(device_local_account_state->second.retrieve_callbacks_); - for (std::vector<RetrievePolicyCallback>::iterator cb(callbacks.begin()); - cb != callbacks.end(); ++cb) { - cb->Run(device_local_account_state->second.policy_blob_); - } + cb->Run(policy_blob_); } } @@ -74,22 +53,7 @@ void DeviceSettingsTestHelper::Flush() { FlushLoops(); FlushRetrieve(); FlushLoops(); - } while (HasPendingOperations()); -} - -bool DeviceSettingsTestHelper::HasPendingOperations() const { - if (device_policy_.HasPendingOperations()) - return true; - - std::map<std::string, PolicyState>::const_iterator device_local_account_state; - for (device_local_account_state = device_local_account_policy_.begin(); - device_local_account_state != device_local_account_policy_.end(); - ++device_local_account_state) { - if (device_local_account_state->second.HasPendingOperations()) - return true; - } - - return false; + } while (!store_callbacks_.empty() || !retrieve_callbacks_.empty()); } void DeviceSettingsTestHelper::AddObserver(Observer* observer) {} @@ -129,39 +93,23 @@ bool DeviceSettingsTestHelper::GetIsScreenLocked() { void DeviceSettingsTestHelper::RetrieveDevicePolicy( const RetrievePolicyCallback& callback) { - device_policy_.retrieve_callbacks_.push_back(callback); + retrieve_callbacks_.push_back(callback); } void DeviceSettingsTestHelper::RetrieveUserPolicy( const RetrievePolicyCallback& callback) { } -void DeviceSettingsTestHelper::RetrieveDeviceLocalAccountPolicy( - const std::string& account_id, - const RetrievePolicyCallback& callback) { - device_local_account_policy_[account_id].retrieve_callbacks_.push_back( - callback); -} - void DeviceSettingsTestHelper::StoreDevicePolicy( const std::string& policy_blob, const StorePolicyCallback& callback) { - device_policy_.policy_blob_ = policy_blob; - device_policy_.store_callbacks_.push_back(callback); + policy_blob_ = policy_blob; + store_callbacks_.push_back(callback); } void DeviceSettingsTestHelper::StoreUserPolicy( const std::string& policy_blob, - const StorePolicyCallback& callback) { -} - -void DeviceSettingsTestHelper::StoreDeviceLocalAccountPolicy( - const std::string& account_id, - const std::string& policy_blob, - const StorePolicyCallback& callback) { - device_local_account_policy_[account_id].policy_blob_ = policy_blob; - device_local_account_policy_[account_id].store_callbacks_.push_back(callback); -} + const StorePolicyCallback& callback) {} ScopedDeviceSettingsTestHelper::ScopedDeviceSettingsTestHelper() { DeviceSettingsService::Get()->Initialize(this, new MockOwnerKeyUtil()); diff --git a/chrome/browser/chromeos/settings/device_settings_test_helper.h b/chrome/browser/chromeos/settings/device_settings_test_helper.h index e641f28..3fd8394 100644 --- a/chrome/browser/chromeos/settings/device_settings_test_helper.h +++ b/chrome/browser/chromeos/settings/device_settings_test_helper.h @@ -5,13 +5,11 @@ #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ -#include <map> #include <string> #include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "base/string_util.h" #include "chromeos/dbus/session_manager_client.h" namespace chromeos { @@ -39,34 +37,18 @@ class DeviceSettingsTestHelper : public SessionManagerClient { // Flushes all pending operations. void Flush(); - // Checks whether any asynchronous Store/Retrieve operations are pending. - bool HasPendingOperations() const; - bool store_result() { - return device_policy_.store_result_; + return store_result_; } void set_store_result(bool store_result) { - device_policy_.store_result_ = store_result; + store_result_ = store_result; } const std::string& policy_blob() { - return device_policy_.policy_blob_; + return policy_blob_; } void set_policy_blob(const std::string& policy_blob) { - device_policy_.policy_blob_ = policy_blob; - } - - const std::string& device_local_account_policy_blob( - const std::string& id) const { - const std::map<std::string, PolicyState>::const_iterator entry = - device_local_account_policy_.find(id); - return entry == device_local_account_policy_.end() ? - EmptyString() : entry->second.policy_blob_; - } - - void set_device_local_account_policy_blob(const std::string& id, - const std::string& policy_blob) { - device_local_account_policy_[id].policy_blob_ = policy_blob; + policy_blob_ = policy_blob; } // SessionManagerClient: @@ -89,35 +71,17 @@ class DeviceSettingsTestHelper : public SessionManagerClient { const RetrievePolicyCallback& callback) OVERRIDE; virtual void RetrieveUserPolicy( const RetrievePolicyCallback& callback) OVERRIDE; - virtual void RetrieveDeviceLocalAccountPolicy( - const std::string& account_id, - const RetrievePolicyCallback& callback) OVERRIDE; virtual void StoreDevicePolicy(const std::string& policy_blob, const StorePolicyCallback& callback) OVERRIDE; virtual void StoreUserPolicy(const std::string& policy_blob, const StorePolicyCallback& callback) OVERRIDE; - virtual void StoreDeviceLocalAccountPolicy( - const std::string& account_id, - const std::string& policy_blob, - const StorePolicyCallback& callback) OVERRIDE; private: - struct PolicyState { - bool store_result_; - std::string policy_blob_; - std::vector<StorePolicyCallback> store_callbacks_; - std::vector<RetrievePolicyCallback> retrieve_callbacks_; - - PolicyState() - : store_result_(true) {} - - bool HasPendingOperations() const { - return !store_callbacks_.empty() || !retrieve_callbacks_.empty(); - } - }; - - PolicyState device_policy_; - std::map<std::string, PolicyState> device_local_account_policy_; + bool store_result_; + std::string policy_blob_; + + std::vector<StorePolicyCallback> store_callbacks_; + std::vector<RetrievePolicyCallback> retrieve_callbacks_; DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestHelper); }; |