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

Side by Side Diff: chromeos/attestation/attestation_flow_unittest.cc

Issue 2529743002: Wait for the attestation to be ready (TPM being prepared for attestation) before trying to enroll. (Closed)
Patch Set: Inverted condition for easier reading. Created 4 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/test/test_mock_time_task_runner.h"
12 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "base/time/tick_clock.h"
16 #include "base/timer/timer.h"
13 #include "chromeos/attestation/mock_attestation_flow.h" 17 #include "chromeos/attestation/mock_attestation_flow.h"
14 #include "chromeos/cryptohome/cryptohome_parameters.h" 18 #include "chromeos/cryptohome/cryptohome_parameters.h"
15 #include "chromeos/cryptohome/mock_async_method_caller.h" 19 #include "chromeos/cryptohome/mock_async_method_caller.h"
16 #include "chromeos/dbus/mock_cryptohome_client.h" 20 #include "chromeos/dbus/mock_cryptohome_client.h"
17 #include "components/signin/core/account_id/account_id.h" 21 #include "components/signin/core/account_id/account_id.h"
18 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
20 24
21 using testing::_; 25 using testing::_;
22 using testing::AtLeast; 26 using testing::AtLeast;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 62
59 void operator() (const CryptohomeClient::DataMethodCallback& callback) { 63 void operator() (const CryptohomeClient::DataMethodCallback& callback) {
60 base::ThreadTaskRunnerHandle::Get()->PostTask( 64 base::ThreadTaskRunnerHandle::Get()->PostTask(
61 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true, data_)); 65 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true, data_));
62 } 66 }
63 67
64 private: 68 private:
65 std::string data_; 69 std::string data_;
66 }; 70 };
67 71
72 class ImpatientOneShotTimer : public base::OneShotTimer {
73 public:
74 void Start(const tracked_objects::Location& posted_from,
75 base::TimeDelta delay,
76 const base::Closure& user_task) override {
77 // Can't wait to fire!
78 user_task.Run();
79 }
80 };
81
68 } // namespace 82 } // namespace
69 83
70 class AttestationFlowTest : public testing::Test { 84 class AttestationFlowTest : public testing::Test {
71 protected: 85 protected:
72 void Run() { 86 void Run() {
73 base::RunLoop run_loop; 87 base::RunLoop run_loop;
74 run_loop.RunUntilIdle(); 88 run_loop.RunUntilIdle();
75 } 89 }
76 base::MessageLoop message_loop_; 90 base::MessageLoop message_loop_;
77 }; 91 };
78 92
79 TEST_F(AttestationFlowTest, GetCertificate) { 93 TEST_F(AttestationFlowTest, GetCertificate) {
80 // Verify the order of calls in a sequence. 94 // Verify the order of calls in a sequence.
81 Sequence flow_order; 95 Sequence flow_order;
82 96
83 // Use DBusCallbackFalse so the full enrollment flow is triggered. 97 // Use DBusCallbackFalse so the full enrollment flow is triggered.
84 chromeos::MockCryptohomeClient client; 98 chromeos::MockCryptohomeClient client;
85 EXPECT_CALL(client, TpmAttestationIsEnrolled(_)) 99 EXPECT_CALL(client, TpmAttestationIsEnrolled(_))
86 .InSequence(flow_order) 100 .InSequence(flow_order)
87 .WillRepeatedly(Invoke(DBusCallbackFalse)); 101 .WillRepeatedly(Invoke(DBusCallbackFalse));
88 102
103 EXPECT_CALL(client, TpmAttestationIsPrepared(_))
104 .InSequence(flow_order)
105 .WillOnce(Invoke(DBusCallbackTrue));
106
89 // Use StrictMock when we want to verify invocation frequency. 107 // Use StrictMock when we want to verify invocation frequency.
90 StrictMock<cryptohome::MockAsyncMethodCaller> async_caller; 108 StrictMock<cryptohome::MockAsyncMethodCaller> async_caller;
91 async_caller.SetUp(true, cryptohome::MOUNT_ERROR_NONE); 109 async_caller.SetUp(true, cryptohome::MOUNT_ERROR_NONE);
110 EXPECT_CALL(async_caller, AsyncTpmAttestationCreateEnrollRequest(_, _))
111 .Times(1)
112 .InSequence(flow_order);
113
114 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>());
115 proxy->DeferToFake(true);
116 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault());
117 EXPECT_CALL(
118 *proxy,
119 SendEnrollRequest(
120 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest, _))
121 .Times(1)
122 .InSequence(flow_order);
123
124 std::string fake_enroll_response =
125 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest;
126 fake_enroll_response += "_response";
127 EXPECT_CALL(async_caller,
128 AsyncTpmAttestationEnroll(_, fake_enroll_response, _))
129 .Times(1)
130 .InSequence(flow_order);
131
132 const AccountId account_id = AccountId::FromUserEmail("fake@test.com");
133 EXPECT_CALL(async_caller,
134 AsyncTpmAttestationCreateCertRequest(
135 _, PROFILE_ENTERPRISE_USER_CERTIFICATE,
136 cryptohome::Identification(account_id), "fake_origin", _))
137 .Times(1)
138 .InSequence(flow_order);
139
140 EXPECT_CALL(
141 *proxy,
142 SendCertificateRequest(
143 cryptohome::MockAsyncMethodCaller::kFakeAttestationCertRequest, _))
144 .Times(1)
145 .InSequence(flow_order);
146
147 std::string fake_cert_response =
148 cryptohome::MockAsyncMethodCaller::kFakeAttestationCertRequest;
149 fake_cert_response += "_response";
150 EXPECT_CALL(async_caller, AsyncTpmAttestationFinishCertRequest(
151 fake_cert_response, KEY_USER,
152 cryptohome::Identification(account_id),
153 kEnterpriseUserKey, _))
154 .Times(1)
155 .InSequence(flow_order);
156
157 StrictMock<MockObserver> observer;
158 EXPECT_CALL(
159 observer,
160 MockCertificateCallback(
161 true, cryptohome::MockAsyncMethodCaller::kFakeAttestationCert))
162 .Times(1)
163 .InSequence(flow_order);
164 AttestationFlow::CertificateCallback mock_callback = base::Bind(
165 &MockObserver::MockCertificateCallback, base::Unretained(&observer));
166
167 std::unique_ptr<ServerProxy> proxy_interface(proxy.release());
168 AttestationFlow flow(&async_caller, &client, std::move(proxy_interface));
169 flow.GetCertificate(PROFILE_ENTERPRISE_USER_CERTIFICATE, account_id,
170 "fake_origin", true, mock_callback);
171 Run();
172 }
173
174 TEST_F(AttestationFlowTest, GetCertificate_Attestation_Not_Prepared) {
175 // Verify the order of calls in a sequence.
176 Sequence flow_order;
177
178 // Use DBusCallbackFalse so the full enrollment flow is triggered.
179 chromeos::MockCryptohomeClient client;
180 EXPECT_CALL(client, TpmAttestationIsEnrolled(_))
181 .InSequence(flow_order)
182 .WillRepeatedly(Invoke(DBusCallbackFalse));
183
184 // It will take a bit for attestation to be prepared.
185 EXPECT_CALL(client, TpmAttestationIsPrepared(_))
186 .InSequence(flow_order)
187 .WillOnce(Invoke(DBusCallbackFalse))
188 .WillOnce(Invoke(DBusCallbackTrue));
189
190 // Use StrictMock when we want to verify invocation frequency.
191 StrictMock<cryptohome::MockAsyncMethodCaller> async_caller;
192 async_caller.SetUp(true, cryptohome::MOUNT_ERROR_NONE);
92 EXPECT_CALL(async_caller, AsyncTpmAttestationCreateEnrollRequest(_, _)) 193 EXPECT_CALL(async_caller, AsyncTpmAttestationCreateEnrollRequest(_, _))
93 .Times(1) 194 .Times(1)
94 .InSequence(flow_order); 195 .InSequence(flow_order);
95 196
96 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>()); 197 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>());
97 proxy->DeferToFake(true); 198 proxy->DeferToFake(true);
98 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault()); 199 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault());
99 EXPECT_CALL(*proxy, SendEnrollRequest( 200 EXPECT_CALL(*proxy, SendEnrollRequest(
100 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest, 201 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest,
101 _)).Times(1) 202 _)).Times(1)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 true, 238 true,
138 cryptohome::MockAsyncMethodCaller::kFakeAttestationCert)) 239 cryptohome::MockAsyncMethodCaller::kFakeAttestationCert))
139 .Times(1) 240 .Times(1)
140 .InSequence(flow_order); 241 .InSequence(flow_order);
141 AttestationFlow::CertificateCallback mock_callback = base::Bind( 242 AttestationFlow::CertificateCallback mock_callback = base::Bind(
142 &MockObserver::MockCertificateCallback, 243 &MockObserver::MockCertificateCallback,
143 base::Unretained(&observer)); 244 base::Unretained(&observer));
144 245
145 std::unique_ptr<ServerProxy> proxy_interface(proxy.release()); 246 std::unique_ptr<ServerProxy> proxy_interface(proxy.release());
146 AttestationFlow flow(&async_caller, &client, std::move(proxy_interface)); 247 AttestationFlow flow(&async_caller, &client, std::move(proxy_interface));
248 flow.SetRetryTimerForTest(base::MakeUnique<ImpatientOneShotTimer>());
147 flow.GetCertificate(PROFILE_ENTERPRISE_USER_CERTIFICATE, account_id, 249 flow.GetCertificate(PROFILE_ENTERPRISE_USER_CERTIFICATE, account_id,
148 "fake_origin", true, mock_callback); 250 "fake_origin", true, mock_callback);
149 Run(); 251 Run();
150 } 252 }
151 253
254 TEST_F(AttestationFlowTest, GetCertificate_Attestation_Never_Prepared) {
The one and only Dr. Crash 2016/12/02 06:31:40 Something that is interesting here is that I see t
255 StrictMock<cryptohome::MockAsyncMethodCaller> async_caller;
256 async_caller.SetUp(false, cryptohome::MOUNT_ERROR_NONE);
257
258 chromeos::MockCryptohomeClient client;
259 EXPECT_CALL(client, TpmAttestationIsEnrolled(_))
260 .WillRepeatedly(Invoke(DBusCallbackFalse));
261
262 EXPECT_CALL(client, TpmAttestationIsPrepared(_))
263 .WillRepeatedly(Invoke(DBusCallbackFalse));
264
265 // We're not expecting any server calls in this case; StrictMock will verify.
266 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>());
267 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault());
268
269 StrictMock<MockObserver> observer;
270 EXPECT_CALL(observer, MockCertificateCallback(false, "")).Times(1);
271 AttestationFlow::CertificateCallback mock_callback = base::Bind(
272 &MockObserver::MockCertificateCallback, base::Unretained(&observer));
273
274 std::unique_ptr<ServerProxy> proxy_interface(proxy.release());
275 AttestationFlow flow(&async_caller, &client, std::move(proxy_interface));
276 flow.SetRetryTimerForTest(base::MakeUnique<ImpatientOneShotTimer>());
277 flow.GetCertificate(PROFILE_ENTERPRISE_USER_CERTIFICATE, EmptyAccountId(), "",
278 true, mock_callback);
279 Run();
280 }
281
152 TEST_F(AttestationFlowTest, GetCertificate_NoEK) { 282 TEST_F(AttestationFlowTest, GetCertificate_NoEK) {
153 StrictMock<cryptohome::MockAsyncMethodCaller> async_caller; 283 StrictMock<cryptohome::MockAsyncMethodCaller> async_caller;
154 async_caller.SetUp(false, cryptohome::MOUNT_ERROR_NONE); 284 async_caller.SetUp(false, cryptohome::MOUNT_ERROR_NONE);
155 EXPECT_CALL(async_caller, AsyncTpmAttestationCreateEnrollRequest(_, _)) 285 EXPECT_CALL(async_caller, AsyncTpmAttestationCreateEnrollRequest(_, _))
156 .Times(1); 286 .Times(1);
157 287
158 chromeos::MockCryptohomeClient client; 288 chromeos::MockCryptohomeClient client;
159 EXPECT_CALL(client, TpmAttestationIsEnrolled(_)) 289 EXPECT_CALL(client, TpmAttestationIsEnrolled(_))
160 .WillRepeatedly(Invoke(DBusCallbackFalse)); 290 .WillRepeatedly(Invoke(DBusCallbackFalse));
161 291
292 EXPECT_CALL(client, TpmAttestationIsPrepared(_))
293 .WillOnce(Invoke(DBusCallbackTrue));
294
162 // We're not expecting any server calls in this case; StrictMock will verify. 295 // We're not expecting any server calls in this case; StrictMock will verify.
163 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>()); 296 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>());
164 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault()); 297 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault());
165 298
166 StrictMock<MockObserver> observer; 299 StrictMock<MockObserver> observer;
167 EXPECT_CALL(observer, MockCertificateCallback(false, "")) 300 EXPECT_CALL(observer, MockCertificateCallback(false, ""))
168 .Times(1); 301 .Times(1);
169 AttestationFlow::CertificateCallback mock_callback = base::Bind( 302 AttestationFlow::CertificateCallback mock_callback = base::Bind(
170 &MockObserver::MockCertificateCallback, 303 &MockObserver::MockCertificateCallback,
171 base::Unretained(&observer)); 304 base::Unretained(&observer));
172 305
173 std::unique_ptr<ServerProxy> proxy_interface(proxy.release()); 306 std::unique_ptr<ServerProxy> proxy_interface(proxy.release());
174 AttestationFlow flow(&async_caller, &client, std::move(proxy_interface)); 307 AttestationFlow flow(&async_caller, &client, std::move(proxy_interface));
175 flow.GetCertificate(PROFILE_ENTERPRISE_USER_CERTIFICATE, EmptyAccountId(), "", 308 flow.GetCertificate(PROFILE_ENTERPRISE_USER_CERTIFICATE, EmptyAccountId(), "",
176 true, mock_callback); 309 true, mock_callback);
177 Run(); 310 Run();
178 } 311 }
179 312
180 TEST_F(AttestationFlowTest, GetCertificate_EKRejected) { 313 TEST_F(AttestationFlowTest, GetCertificate_EKRejected) {
181 StrictMock<cryptohome::MockAsyncMethodCaller> async_caller; 314 StrictMock<cryptohome::MockAsyncMethodCaller> async_caller;
182 async_caller.SetUp(true, cryptohome::MOUNT_ERROR_NONE); 315 async_caller.SetUp(true, cryptohome::MOUNT_ERROR_NONE);
183 EXPECT_CALL(async_caller, AsyncTpmAttestationCreateEnrollRequest(_, _)) 316 EXPECT_CALL(async_caller, AsyncTpmAttestationCreateEnrollRequest(_, _))
184 .Times(1); 317 .Times(1);
185 318
186 chromeos::MockCryptohomeClient client; 319 chromeos::MockCryptohomeClient client;
187 EXPECT_CALL(client, TpmAttestationIsEnrolled(_)) 320 EXPECT_CALL(client, TpmAttestationIsEnrolled(_))
188 .WillRepeatedly(Invoke(DBusCallbackFalse)); 321 .WillRepeatedly(Invoke(DBusCallbackFalse));
189 322
323 EXPECT_CALL(client, TpmAttestationIsPrepared(_))
324 .WillOnce(Invoke(DBusCallbackTrue));
325
190 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>()); 326 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>());
191 proxy->DeferToFake(false); 327 proxy->DeferToFake(false);
192 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault()); 328 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault());
193 EXPECT_CALL(*proxy, SendEnrollRequest( 329 EXPECT_CALL(*proxy, SendEnrollRequest(
194 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest, 330 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest,
195 _)).Times(1); 331 _)).Times(1);
196 332
197 StrictMock<MockObserver> observer; 333 StrictMock<MockObserver> observer;
198 EXPECT_CALL(observer, MockCertificateCallback(false, "")) 334 EXPECT_CALL(observer, MockCertificateCallback(false, ""))
199 .Times(1); 335 .Times(1);
(...skipping 17 matching lines...) Expand all
217 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest; 353 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest;
218 fake_enroll_response += "_response"; 354 fake_enroll_response += "_response";
219 EXPECT_CALL(async_caller, 355 EXPECT_CALL(async_caller,
220 AsyncTpmAttestationEnroll(_, fake_enroll_response, _)) 356 AsyncTpmAttestationEnroll(_, fake_enroll_response, _))
221 .WillOnce(WithArgs<2>(Invoke(AsyncCallbackFalse))); 357 .WillOnce(WithArgs<2>(Invoke(AsyncCallbackFalse)));
222 358
223 chromeos::MockCryptohomeClient client; 359 chromeos::MockCryptohomeClient client;
224 EXPECT_CALL(client, TpmAttestationIsEnrolled(_)) 360 EXPECT_CALL(client, TpmAttestationIsEnrolled(_))
225 .WillRepeatedly(Invoke(DBusCallbackFalse)); 361 .WillRepeatedly(Invoke(DBusCallbackFalse));
226 362
363 EXPECT_CALL(client, TpmAttestationIsPrepared(_))
364 .WillOnce(Invoke(DBusCallbackTrue));
365
227 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>()); 366 std::unique_ptr<MockServerProxy> proxy(new StrictMock<MockServerProxy>());
228 proxy->DeferToFake(true); 367 proxy->DeferToFake(true);
229 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault()); 368 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(DoDefault());
230 EXPECT_CALL(*proxy, SendEnrollRequest( 369 EXPECT_CALL(*proxy, SendEnrollRequest(
231 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest, 370 cryptohome::MockAsyncMethodCaller::kFakeAttestationEnrollRequest,
232 _)).Times(1); 371 _)).Times(1);
233 372
234 StrictMock<MockObserver> observer; 373 StrictMock<MockObserver> observer;
235 EXPECT_CALL(observer, MockCertificateCallback(false, "")).Times(1); 374 EXPECT_CALL(observer, MockCertificateCallback(false, "")).Times(1);
236 AttestationFlow::CertificateCallback mock_callback = base::Bind( 375 AttestationFlow::CertificateCallback mock_callback = base::Bind(
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // Strategy: Create a ServerProxy mock which reports ALTERNATE_PCA and check 594 // Strategy: Create a ServerProxy mock which reports ALTERNATE_PCA and check
456 // that all calls to the AsyncMethodCaller reflect this PCA type. 595 // that all calls to the AsyncMethodCaller reflect this PCA type.
457 std::unique_ptr<MockServerProxy> proxy(new NiceMock<MockServerProxy>()); 596 std::unique_ptr<MockServerProxy> proxy(new NiceMock<MockServerProxy>());
458 proxy->DeferToFake(true); 597 proxy->DeferToFake(true);
459 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(Return(ALTERNATE_PCA)); 598 EXPECT_CALL(*proxy, GetType()).WillRepeatedly(Return(ALTERNATE_PCA));
460 599
461 chromeos::MockCryptohomeClient client; 600 chromeos::MockCryptohomeClient client;
462 EXPECT_CALL(client, TpmAttestationIsEnrolled(_)) 601 EXPECT_CALL(client, TpmAttestationIsEnrolled(_))
463 .WillRepeatedly(Invoke(DBusCallbackFalse)); 602 .WillRepeatedly(Invoke(DBusCallbackFalse));
464 603
604 EXPECT_CALL(client, TpmAttestationIsPrepared(_))
605 .WillRepeatedly(Invoke(DBusCallbackTrue));
606
465 NiceMock<cryptohome::MockAsyncMethodCaller> async_caller; 607 NiceMock<cryptohome::MockAsyncMethodCaller> async_caller;
466 async_caller.SetUp(true, cryptohome::MOUNT_ERROR_NONE); 608 async_caller.SetUp(true, cryptohome::MOUNT_ERROR_NONE);
467 EXPECT_CALL(async_caller, 609 EXPECT_CALL(async_caller,
468 AsyncTpmAttestationCreateEnrollRequest(ALTERNATE_PCA, _)) 610 AsyncTpmAttestationCreateEnrollRequest(ALTERNATE_PCA, _))
469 .Times(AtLeast(1)); 611 .Times(AtLeast(1));
470 EXPECT_CALL(async_caller, 612 EXPECT_CALL(async_caller,
471 AsyncTpmAttestationEnroll(ALTERNATE_PCA, _, _)) 613 AsyncTpmAttestationEnroll(ALTERNATE_PCA, _, _))
472 .Times(AtLeast(1)); 614 .Times(AtLeast(1));
473 EXPECT_CALL(async_caller, 615 EXPECT_CALL(async_caller,
474 AsyncTpmAttestationCreateCertRequest(ALTERNATE_PCA, _, _, _, _)) 616 AsyncTpmAttestationCreateCertRequest(ALTERNATE_PCA, _, _, _, _))
475 .Times(AtLeast(1)); 617 .Times(AtLeast(1));
476 618
477 NiceMock<MockObserver> observer; 619 NiceMock<MockObserver> observer;
478 AttestationFlow::CertificateCallback mock_callback = base::Bind( 620 AttestationFlow::CertificateCallback mock_callback = base::Bind(
479 &MockObserver::MockCertificateCallback, 621 &MockObserver::MockCertificateCallback,
480 base::Unretained(&observer)); 622 base::Unretained(&observer));
481 623
482 std::unique_ptr<ServerProxy> proxy_interface(proxy.release()); 624 std::unique_ptr<ServerProxy> proxy_interface(proxy.release());
483 AttestationFlow flow(&async_caller, &client, std::move(proxy_interface)); 625 AttestationFlow flow(&async_caller, &client, std::move(proxy_interface));
484 flow.GetCertificate(PROFILE_ENTERPRISE_USER_CERTIFICATE, EmptyAccountId(), "", 626 flow.GetCertificate(PROFILE_ENTERPRISE_USER_CERTIFICATE, EmptyAccountId(), "",
485 true, mock_callback); 627 true, mock_callback);
486 Run(); 628 Run();
487 } 629 }
488 630
489 } // namespace attestation 631 } // namespace attestation
490 } // namespace chromeos 632 } // namespace chromeos
OLDNEW
« chromeos/attestation/attestation_flow.cc ('K') | « chromeos/attestation/attestation_flow.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698