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

Unified Diff: chrome/browser/policy/device_policy_cache_unittest.cc

Issue 7345010: Tests for cloud policy UMA metrics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewed, rebased Created 9 years, 5 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
« no previous file with comments | « chrome/browser/policy/device_policy_cache.h ('k') | chrome/browser/policy/device_token_fetcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/device_policy_cache_unittest.cc
diff --git a/chrome/browser/policy/device_policy_cache_unittest.cc b/chrome/browser/policy/device_policy_cache_unittest.cc
index 8346a61b3163e8e98b7188a9e3125a95d796e158..37e1b6b02f3193cd40caaf101498aaa0abd076ba 100644
--- a/chrome/browser/policy/device_policy_cache_unittest.cc
+++ b/chrome/browser/policy/device_policy_cache_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/policy/device_policy_cache.h"
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
+#include "chrome/browser/chromeos/login/mock_signed_settings_helper.h"
#include "chrome/browser/policy/cloud_policy_data_store.h"
#include "chrome/browser/policy/enterprise_install_attributes.h"
#include "policy/configuration_policy_type.h"
@@ -23,40 +24,6 @@ using ::chromeos::SignedSettingsHelper;
using ::testing::_;
using ::testing::InSequence;
-class MockSignedSettingsHelper : public SignedSettingsHelper {
- public:
- MockSignedSettingsHelper() {}
- virtual ~MockSignedSettingsHelper() {}
-
- MOCK_METHOD2(StartStorePolicyOp, void(const em::PolicyFetchResponse&,
- SignedSettingsHelper::Callback*));
- MOCK_METHOD1(StartRetrievePolicyOp, void(SignedSettingsHelper::Callback*));
- MOCK_METHOD1(CancelCallback, void(SignedSettingsHelper::Callback*));
-
- // This test doesn't need these methods, but since they're pure virtual in
- // SignedSettingsHelper, they must be implemented:
- MOCK_METHOD2(StartCheckWhitelistOp, void(const std::string&,
- SignedSettingsHelper::Callback*));
- MOCK_METHOD3(StartWhitelistOp, void(const std::string&, bool,
- SignedSettingsHelper::Callback*));
- MOCK_METHOD3(StartStorePropertyOp, void(const std::string&,
- const std::string&,
- SignedSettingsHelper::Callback*));
- MOCK_METHOD2(StartRetrieveProperty, void(const std::string&,
- SignedSettingsHelper::Callback*));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockSignedSettingsHelper);
-};
-
-ACTION_P(MockSignedSettingsHelperStorePolicy, status_code) {
- arg1->OnStorePolicyCompleted(status_code);
-}
-
-ACTION_P2(MockSignedSettingsHelperRetrievePolicy, status_code, policy) {
- arg0->OnRetrievePolicyCompleted(status_code, policy);
-}
-
void CreateRefreshRatePolicy(em::PolicyFetchResponse* policy,
const std::string& user,
int refresh_rate) {
@@ -136,7 +103,7 @@ class DevicePolicyCacheTest : public testing::Test {
scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_;
EnterpriseInstallAttributes install_attributes_;
scoped_ptr<CloudPolicyDataStore> data_store_;
- MockSignedSettingsHelper signed_settings_helper_;
+ chromeos::MockSignedSettingsHelper signed_settings_helper_;
scoped_ptr<DevicePolicyCache> cache_;
private:
@@ -183,6 +150,7 @@ TEST_F(DevicePolicyCacheTest, SetPolicy) {
EXPECT_CALL(signed_settings_helper_, StartRetrievePolicyOp(_)).WillOnce(
MockSignedSettingsHelperRetrievePolicy(SignedSettings::SUCCESS,
new_policy));
+ EXPECT_CALL(signed_settings_helper_, CancelCallback(_));
cache_->SetPolicy(new_policy);
testing::Mock::VerifyAndClearExpectations(&signed_settings_helper_);
FundamentalValue updated_expected(300);
« no previous file with comments | « chrome/browser/policy/device_policy_cache.h ('k') | chrome/browser/policy/device_token_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698