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

Unified Diff: chrome/browser/chromeos/login/signed_settings_helper_unittest.cc

Issue 8163011: PART3: Removed whitelist special ops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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/login/signed_settings_helper_unittest.cc
diff --git a/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc b/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc
index c5f34ac0c394ec38ce796e28271755ab807a969b..364a6cb3550cd99890776e1f1ac64283daf4cf28 100644
--- a/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc
+++ b/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc
@@ -30,12 +30,8 @@ namespace chromeos {
class MockSignedSettingsHelperCallback : public SignedSettingsHelper::Callback {
public:
- MOCK_METHOD2(OnCheckWhitelistCompleted, void(
- SignedSettings::ReturnCode code, const std::string& email));
- MOCK_METHOD2(OnWhitelistCompleted, void(
- SignedSettings::ReturnCode code, const std::string& email));
- MOCK_METHOD2(OnUnwhitelistCompleted, void(
- SignedSettings::ReturnCode code, const std::string& email));
+ virtual ~MockSignedSettingsHelperCallback() {}
+
MOCK_METHOD3(OnStorePropertyCompleted, void(
SignedSettings::ReturnCode code,
const std::string& name,
@@ -115,42 +111,27 @@ TEST_F(SignedSettingsHelperTest, SerializedOps) {
.Times(2)
.WillRepeatedly(Return(OwnershipService::OWNERSHIP_TAKEN));
EXPECT_CALL(m_, has_cached_policy())
- .Times(5)
+ .Times(2)
.WillRepeatedly(Return(true));
em::PolicyData fake_pol = BuildPolicyData();
EXPECT_CALL(m_, cached_policy())
- .Times(5)
+ .Times(2)
.WillRepeatedly(ReturnRef(fake_pol));
EXPECT_CALL(m_, set_cached_policy(A<const em::PolicyData&>()))
- .Times(3)
+ .Times(1)
.WillRepeatedly(SaveArg<0>(&fake_pol));
InSequence s;
EXPECT_CALL(m_, StartSigningAttempt(_, A<OwnerManager::Delegate*>()))
.WillOnce(WithArg<1>(Invoke(&SignedSettingsHelperTest::OnKeyOpComplete)));
- EXPECT_CALL(cb, OnWhitelistCompleted(SignedSettings::SUCCESS, _))
- .Times(1);
-
- EXPECT_CALL(cb, OnCheckWhitelistCompleted(SignedSettings::SUCCESS, _))
- .Times(1);
-
- EXPECT_CALL(m_, StartSigningAttempt(_, A<OwnerManager::Delegate*>()))
- .WillOnce(WithArg<1>(Invoke(&SignedSettingsHelperTest::OnKeyOpComplete)));
- EXPECT_CALL(cb, OnUnwhitelistCompleted(SignedSettings::SUCCESS, _))
- .Times(1);
-
- EXPECT_CALL(m_, StartSigningAttempt(_, A<OwnerManager::Delegate*>()))
- .WillOnce(WithArg<1>(Invoke(&SignedSettingsHelperTest::OnKeyOpComplete)));
EXPECT_CALL(cb, OnStorePropertyCompleted(SignedSettings::SUCCESS, _, _))
.Times(1);
EXPECT_CALL(cb, OnRetrievePropertyCompleted(SignedSettings::SUCCESS, _, _))
.Times(1);
- pending_ops_ = 5;
- SignedSettingsHelper::Get()->StartWhitelistOp(fake_email_, true, &cb);
- SignedSettingsHelper::Get()->StartCheckWhitelistOp(fake_email_, &cb);
- SignedSettingsHelper::Get()->StartWhitelistOp(fake_email_, false, &cb);
+
+ pending_ops_ = 2;
SignedSettingsHelper::Get()->StartStorePropertyOp(fake_prop_, fake_value_,
&cb);
SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb);
@@ -162,53 +143,34 @@ TEST_F(SignedSettingsHelperTest, CanceledOps) {
MockSignedSettingsHelperCallback cb;
EXPECT_CALL(m_, GetStatus(_))
- .Times(2)
+ .Times(3)
.WillRepeatedly(Return(OwnershipService::OWNERSHIP_TAKEN));
EXPECT_CALL(m_, has_cached_policy())
- .Times(6)
+ .Times(3)
.WillRepeatedly(Return(true));
em::PolicyData fake_pol = BuildPolicyData();
EXPECT_CALL(m_, cached_policy())
- .Times(7)
+ .Times(3)
.WillRepeatedly(ReturnRef(fake_pol));
EXPECT_CALL(m_, set_cached_policy(A<const em::PolicyData&>()))
- .Times(3)
+ .Times(1)
Mattias Nissler (ping if slow) 2011/10/07 13:44:49 since some of these are not just 3 less than befor
pastarmovj 2011/10/13 11:31:38 Yes. The test screams when they don't match exactl
.WillRepeatedly(SaveArg<0>(&fake_pol));
InSequence s;
- EXPECT_CALL(m_, StartSigningAttempt(_, A<OwnerManager::Delegate*>()))
- .WillOnce(WithArg<1>(Invoke(&SignedSettingsHelperTest::OnKeyOpComplete)));
- EXPECT_CALL(cb, OnWhitelistCompleted(SignedSettings::SUCCESS, _))
- .Times(1);
-
- EXPECT_CALL(cb, OnCheckWhitelistCompleted(SignedSettings::SUCCESS, _))
- .Times(1);
-
- EXPECT_CALL(m_, StartSigningAttempt(_, A<OwnerManager::Delegate*>()))
- .WillOnce(WithArg<1>(Invoke(&SignedSettingsHelperTest::OnKeyOpComplete)));
- EXPECT_CALL(cb, OnUnwhitelistCompleted(SignedSettings::SUCCESS, _))
- .Times(1);
-
- // CheckWhitelistOp for cb_to_be_canceled still gets executed but callback
+ // RetrievePropertyOp for cb_to_be_canceled still gets executed but callback
// does not happen.
-
EXPECT_CALL(m_, StartSigningAttempt(_, A<OwnerManager::Delegate*>()))
.WillOnce(WithArg<1>(Invoke(&SignedSettingsHelperTest::OnKeyOpComplete)));
EXPECT_CALL(cb, OnStorePropertyCompleted(SignedSettings::SUCCESS, _, _))
.Times(1);
-
EXPECT_CALL(cb, OnRetrievePropertyCompleted(SignedSettings::SUCCESS, _, _))
.Times(1);
- pending_ops_ = 6;
- SignedSettingsHelper::Get()->StartWhitelistOp(fake_email_, true, &cb);
- SignedSettingsHelper::Get()->StartCheckWhitelistOp(fake_email_, &cb);
- SignedSettingsHelper::Get()->StartWhitelistOp(fake_email_, false, &cb);
-
+ pending_ops_ = 3;
MockSignedSettingsHelperCallback cb_to_be_canceled;
- SignedSettingsHelper::Get()->StartCheckWhitelistOp(fake_email_,
- &cb_to_be_canceled);
+ SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_,
+ &cb_to_be_canceled);
SignedSettingsHelper::Get()->CancelCallback(&cb_to_be_canceled);
SignedSettingsHelper::Get()->StartStorePropertyOp(fake_prop_, fake_value_,
« no previous file with comments | « chrome/browser/chromeos/login/signed_settings_helper.cc ('k') | chrome/browser/chromeos/login/signed_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698