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

Side by Side Diff: chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/api/enterprise_platform_keys_private/enterpr ise_platform_keys_private_api.h" 5 #include "chrome/browser/extensions/api/enterprise_platform_keys_private/enterpr ise_platform_keys_private_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 _, _, _, _)) 328 _, _, _, _))
329 .Times(1); 329 .Times(1);
330 // SignEnterpriseChallenge must be called exactly once. 330 // SignEnterpriseChallenge must be called exactly once.
331 EXPECT_CALL( 331 EXPECT_CALL(
332 mock_async_method_caller_, 332 mock_async_method_caller_,
333 TpmAttestationSignEnterpriseChallenge( 333 TpmAttestationSignEnterpriseChallenge(
334 chromeos::attestation::KEY_DEVICE, cryptohome::Identification(), 334 chromeos::attestation::KEY_DEVICE, cryptohome::Identification(),
335 "attest-ent-machine", "google.com", "device_id", _, "challenge", _)) 335 "attest-ent-machine", "google.com", "device_id", _, "challenge", _))
336 .Times(1); 336 .Times(1);
337 337
338 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( 338 std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
339 func_.get(), kArgs, browser(), utils::NONE)); 339 func_.get(), kArgs, browser(), utils::NONE));
340 340
341 std::string response; 341 std::string response;
342 value->GetAsString(&response); 342 value->GetAsString(&response);
343 EXPECT_EQ("cmVzcG9uc2U=" /* Base64 encoding of 'response' */, response); 343 EXPECT_EQ("cmVzcG9uc2U=" /* Base64 encoding of 'response' */, response);
344 } 344 }
345 345
346 TEST_F(EPKPChallengeMachineKeyTest, AttestationNotPrepared) { 346 TEST_F(EPKPChallengeMachineKeyTest, AttestationNotPrepared) {
347 EXPECT_CALL(mock_cryptohome_client_, TpmAttestationIsPrepared(_)) 347 EXPECT_CALL(mock_cryptohome_client_, TpmAttestationIsPrepared(_))
348 .WillRepeatedly(Invoke(FakeBoolDBusMethod( 348 .WillRepeatedly(Invoke(FakeBoolDBusMethod(
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 cryptohome::Identification(account_id).id(), "device_id", _, 500 cryptohome::Identification(account_id).id(), "device_id", _,
501 "challenge", _)) 501 "challenge", _))
502 .Times(1); 502 .Times(1);
503 // RegisterKey must be called exactly once. 503 // RegisterKey must be called exactly once.
504 EXPECT_CALL(mock_async_method_caller_, 504 EXPECT_CALL(mock_async_method_caller_,
505 TpmAttestationRegisterKey(chromeos::attestation::KEY_USER, 505 TpmAttestationRegisterKey(chromeos::attestation::KEY_USER,
506 cryptohome::Identification(account_id), 506 cryptohome::Identification(account_id),
507 "attest-ent-user", _)) 507 "attest-ent-user", _))
508 .Times(1); 508 .Times(1);
509 509
510 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( 510 std::unique_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
511 func_.get(), kArgs, browser(), utils::NONE)); 511 func_.get(), kArgs, browser(), utils::NONE));
512 512
513 std::string response; 513 std::string response;
514 value->GetAsString(&response); 514 value->GetAsString(&response);
515 EXPECT_EQ("cmVzcG9uc2U=" /* Base64 encoding of 'response' */, response); 515 EXPECT_EQ("cmVzcG9uc2U=" /* Base64 encoding of 'response' */, response);
516 } 516 }
517 517
518 TEST_F(EPKPChallengeUserKeyTest, AttestationNotPrepared) { 518 TEST_F(EPKPChallengeUserKeyTest, AttestationNotPrepared) {
519 EXPECT_CALL(mock_cryptohome_client_, TpmAttestationIsPrepared(_)) 519 EXPECT_CALL(mock_cryptohome_client_, TpmAttestationIsPrepared(_))
520 .WillRepeatedly(Invoke(FakeBoolDBusMethod( 520 .WillRepeatedly(Invoke(FakeBoolDBusMethod(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 AccountId::FromUserEmailGaiaId("test@chromium.com", "12345"); 577 AccountId::FromUserEmailGaiaId("test@chromium.com", "12345");
578 }; 578 };
579 579
580 TEST_F(EPKPChallengeUserKeyUnmanagedUserTest, UserNotManaged) { 580 TEST_F(EPKPChallengeUserKeyUnmanagedUserTest, UserNotManaged) {
581 EXPECT_EQ(EPKPChallengeKeyBase::kUserNotManaged, 581 EXPECT_EQ(EPKPChallengeKeyBase::kUserNotManaged,
582 utils::RunFunctionAndReturnError(func_.get(), kArgs, browser())); 582 utils::RunFunctionAndReturnError(func_.get(), kArgs, browser()));
583 } 583 }
584 584
585 } // namespace 585 } // namespace
586 } // namespace extensions 586 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698