| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/signed_settings_helper.h" | 5 #include "chrome/browser/chromeos/login/signed_settings_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/cros/cros_library.h" | 7 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 8 #include "chrome/browser/chromeos/login/mock_ownership_service.h" | 8 #include "chrome/browser/chromeos/login/mock_ownership_service.h" |
| 9 #include "chrome/browser/chromeos/login/owner_manager.h" | 9 #include "chrome/browser/chromeos/login/owner_manager.h" |
| 10 #include "chrome/browser/chromeos/login/signed_settings.h" | 10 #include "chrome/browser/chromeos/login/signed_settings.h" |
| 11 #include "content/browser/browser_thread.h" | 11 #include "content/browser/browser_thread.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 int pending_ops_; | 85 int pending_ops_; |
| 86 | 86 |
| 87 ScopedStubCrosEnabler stub_cros_enabler_; | 87 ScopedStubCrosEnabler stub_cros_enabler_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 TEST_F(SignedSettingsHelperTest, SerializedOps) { | 90 TEST_F(SignedSettingsHelperTest, SerializedOps) { |
| 91 MockSignedSettingsHelperCallback cb; | 91 MockSignedSettingsHelperCallback cb; |
| 92 | 92 |
| 93 ON_CALL(m_, GetStatus(_)) | 93 ON_CALL(m_, GetStatus(_)) |
| 94 .WillByDefault(Return(OwnershipService::OWNERSHIP_TAKEN)); | 94 .WillByDefault(Return(OwnershipService::OWNERSHIP_USER)); |
| 95 EXPECT_CALL(m_, GetStatus(_)).Times(2); | 95 EXPECT_CALL(m_, GetStatus(_)).Times(2); |
| 96 InSequence s; | 96 InSequence s; |
| 97 EXPECT_CALL(m_, StartVerifyAttempt(_, _, _)).Times(1); | 97 EXPECT_CALL(m_, StartVerifyAttempt(_, _, _)).Times(1); |
| 98 EXPECT_CALL(cb, OnCheckWhitelistCompleted(SignedSettings::SUCCESS, _)) | 98 EXPECT_CALL(cb, OnCheckWhitelistCompleted(SignedSettings::SUCCESS, _)) |
| 99 .Times(1); | 99 .Times(1); |
| 100 EXPECT_CALL(m_, StartSigningAttempt(_, _)).Times(1); | 100 EXPECT_CALL(m_, StartSigningAttempt(_, _)).Times(1); |
| 101 EXPECT_CALL(cb, OnWhitelistCompleted(SignedSettings::SUCCESS, _)) | 101 EXPECT_CALL(cb, OnWhitelistCompleted(SignedSettings::SUCCESS, _)) |
| 102 .Times(1); | 102 .Times(1); |
| 103 EXPECT_CALL(m_, StartSigningAttempt(_, _)).Times(1); | 103 EXPECT_CALL(m_, StartSigningAttempt(_, _)).Times(1); |
| 104 EXPECT_CALL(cb, OnUnwhitelistCompleted(SignedSettings::SUCCESS, _)) | 104 EXPECT_CALL(cb, OnUnwhitelistCompleted(SignedSettings::SUCCESS, _)) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 118 &cb); | 118 &cb); |
| 119 SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb); | 119 SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb); |
| 120 | 120 |
| 121 message_loop_.Run(); | 121 message_loop_.Run(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 TEST_F(SignedSettingsHelperTest, CanceledOps) { | 124 TEST_F(SignedSettingsHelperTest, CanceledOps) { |
| 125 MockSignedSettingsHelperCallback cb; | 125 MockSignedSettingsHelperCallback cb; |
| 126 | 126 |
| 127 ON_CALL(m_, GetStatus(_)) | 127 ON_CALL(m_, GetStatus(_)) |
| 128 .WillByDefault(Return(OwnershipService::OWNERSHIP_TAKEN)); | 128 .WillByDefault(Return(OwnershipService::OWNERSHIP_USER)); |
| 129 EXPECT_CALL(m_, GetStatus(_)).Times(2); | 129 EXPECT_CALL(m_, GetStatus(_)).Times(2); |
| 130 InSequence s; | 130 InSequence s; |
| 131 EXPECT_CALL(m_, StartVerifyAttempt(_, _, _)).Times(1); | 131 EXPECT_CALL(m_, StartVerifyAttempt(_, _, _)).Times(1); |
| 132 EXPECT_CALL(cb, OnCheckWhitelistCompleted(SignedSettings::SUCCESS, _)) | 132 EXPECT_CALL(cb, OnCheckWhitelistCompleted(SignedSettings::SUCCESS, _)) |
| 133 .Times(1); | 133 .Times(1); |
| 134 EXPECT_CALL(m_, StartSigningAttempt(_, _)).Times(1); | 134 EXPECT_CALL(m_, StartSigningAttempt(_, _)).Times(1); |
| 135 EXPECT_CALL(cb, OnWhitelistCompleted(SignedSettings::SUCCESS, _)) | 135 EXPECT_CALL(cb, OnWhitelistCompleted(SignedSettings::SUCCESS, _)) |
| 136 .Times(1); | 136 .Times(1); |
| 137 EXPECT_CALL(m_, StartSigningAttempt(_, _)).Times(1); | 137 EXPECT_CALL(m_, StartSigningAttempt(_, _)).Times(1); |
| 138 EXPECT_CALL(cb, OnUnwhitelistCompleted(SignedSettings::SUCCESS, _)) | 138 EXPECT_CALL(cb, OnUnwhitelistCompleted(SignedSettings::SUCCESS, _)) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 160 SignedSettingsHelper::Get()->CancelCallback(&cb_to_be_canceled); | 160 SignedSettingsHelper::Get()->CancelCallback(&cb_to_be_canceled); |
| 161 | 161 |
| 162 SignedSettingsHelper::Get()->StartStorePropertyOp(fake_prop_, fake_value_, | 162 SignedSettingsHelper::Get()->StartStorePropertyOp(fake_prop_, fake_value_, |
| 163 &cb); | 163 &cb); |
| 164 SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb); | 164 SignedSettingsHelper::Get()->StartRetrieveProperty(fake_prop_, &cb); |
| 165 | 165 |
| 166 message_loop_.Run(); | 166 message_loop_.Run(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace chromeos | 169 } // namespace chromeos |
| OLD | NEW |