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

Side by Side Diff: chrome/browser/chromeos/login/ownership_service_unittest.cc

Issue 6538098: [Chrome OS] Owner keys are generated outside Chrome now; handle appropriately (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ownership_service.h" 5 #include "chrome/browser/chromeos/login/ownership_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/crypto/rsa_private_key.h" 9 #include "base/crypto/rsa_private_key.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 .WillRepeatedly(Return(tmpfile_)); 116 .WillRepeatedly(Return(tmpfile_));
117 EXPECT_CALL(*mock_, ImportPublicKey(tmpfile_, _)) 117 EXPECT_CALL(*mock_, ImportPublicKey(tmpfile_, _))
118 .WillOnce(DoAll(SetArgumentPointee<1>(fake_public_key_), 118 .WillOnce(DoAll(SetArgumentPointee<1>(fake_public_key_),
119 Return(true))) 119 Return(true)))
120 .RetiresOnSaturation(); 120 .RetiresOnSaturation();
121 service_->StartLoadOwnerKeyAttempt(); 121 service_->StartLoadOwnerKeyAttempt();
122 122
123 message_loop_.Run(); 123 message_loop_.Run();
124 } 124 }
125 125
126 TEST_F(OwnershipServiceTest, AttemptKeyGeneration) {
127 // We really only care that we initiate key generation here;
128 // actual key-generation paths are tested in owner_manager_unittest.cc
129 StartUnowned();
130 MockKeyLoadObserver loader;
131 loader.ExpectKeyFetchSuccess(false);
132
133 EXPECT_CALL(*mock_, GenerateKeyPair())
134 .WillOnce(Return(reinterpret_cast<RSAPrivateKey*>(NULL)))
135 .RetiresOnSaturation();
136 EXPECT_CALL(*mock_, GetOwnerKeyFilePath())
137 .WillRepeatedly(Return(tmpfile_));
138
139 service_->StartTakeOwnershipAttempt("me");
140
141 message_loop_.Run();
142 }
143
144 TEST_F(OwnershipServiceTest, NotYetOwnedVerify) { 126 TEST_F(OwnershipServiceTest, NotYetOwnedVerify) {
145 StartUnowned(); 127 StartUnowned();
146 128
147 EXPECT_CALL(*mock_, GetOwnerKeyFilePath()) 129 EXPECT_CALL(*mock_, GetOwnerKeyFilePath())
148 .WillRepeatedly(Return(tmpfile_)); 130 .WillRepeatedly(Return(tmpfile_));
149 131
150 MockKeyUser delegate(OwnerManager::KEY_UNAVAILABLE); 132 MockKeyUser delegate(OwnerManager::KEY_UNAVAILABLE);
151 service_->StartVerifyAttempt("", std::vector<uint8>(), &delegate); 133 service_->StartVerifyAttempt("", std::vector<uint8>(), &delegate);
152 134
153 message_loop_.Run(); 135 message_loop_.Run();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 .WillOnce(Return(false)) 193 .WillOnce(Return(false))
212 .RetiresOnSaturation(); 194 .RetiresOnSaturation();
213 195
214 MockKeyUser delegate(OwnerManager::OPERATION_FAILED); 196 MockKeyUser delegate(OwnerManager::OPERATION_FAILED);
215 service_->StartVerifyAttempt(data, sig, &delegate); 197 service_->StartVerifyAttempt(data, sig, &delegate);
216 198
217 message_loop_.Run(); 199 message_loop_.Run();
218 } 200 }
219 201
220 } // namespace chromeos 202 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ownership_service.cc ('k') | chrome/browser/chromeos/login/user_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698