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

Side by Side Diff: net/socket/ssl_client_socket_unittest.cc

Issue 1076063002: Remove certificates from Channel ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: major refactor: push transition to crypto::ECPrivateKey as low as possible Created 5 years, 7 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) 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 "net/socket/ssl_client_socket.h" 5 #include "net/socket/ssl_client_socket.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 StreamSocket* socket_; 612 StreamSocket* socket_;
613 CompletionCallback callback_; 613 CompletionCallback callback_;
614 614
615 DISALLOW_COPY_AND_ASSIGN(DeleteSocketCallback); 615 DISALLOW_COPY_AND_ASSIGN(DeleteSocketCallback);
616 }; 616 };
617 617
618 // A ChannelIDStore that always returns an error when asked for a 618 // A ChannelIDStore that always returns an error when asked for a
619 // channel id. 619 // channel id.
620 class FailingChannelIDStore : public ChannelIDStore { 620 class FailingChannelIDStore : public ChannelIDStore {
621 int GetChannelID(const std::string& server_identifier, 621 int GetChannelID(const std::string& server_identifier,
622 base::Time* expiration_time, 622 scoped_ptr<crypto::ECPrivateKey>* key_result,
623 std::string* private_key_result,
624 std::string* cert_result,
625 const GetChannelIDCallback& callback) override { 623 const GetChannelIDCallback& callback) override {
626 return ERR_UNEXPECTED; 624 return ERR_UNEXPECTED;
627 } 625 }
628 void SetChannelID(const std::string& server_identifier, 626 void SetChannelID(scoped_ptr<ChannelID> channel_id) override {}
629 base::Time creation_time,
630 base::Time expiration_time,
631 const std::string& private_key,
632 const std::string& cert) override {}
633 void DeleteChannelID(const std::string& server_identifier, 627 void DeleteChannelID(const std::string& server_identifier,
634 const base::Closure& completion_callback) override {} 628 const base::Closure& completion_callback) override {}
635 void DeleteAllCreatedBetween( 629 void DeleteAllCreatedBetween(
636 base::Time delete_begin, 630 base::Time delete_begin,
637 base::Time delete_end, 631 base::Time delete_end,
638 const base::Closure& completion_callback) override {} 632 const base::Closure& completion_callback) override {}
639 void DeleteAll(const base::Closure& completion_callback) override {} 633 void DeleteAll(const base::Closure& completion_callback) override {}
640 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} 634 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {}
641 int GetChannelIDCount() override { return 0; } 635 int GetChannelIDCount() override { return 0; }
642 void SetForceKeepSessionState() override {} 636 void SetForceKeepSessionState() override {}
643 }; 637 };
644 638
645 // A ChannelIDStore that asynchronously returns an error when asked for a 639 // A ChannelIDStore that asynchronously returns an error when asked for a
646 // channel id. 640 // channel id.
647 class AsyncFailingChannelIDStore : public ChannelIDStore { 641 class AsyncFailingChannelIDStore : public ChannelIDStore {
648 int GetChannelID(const std::string& server_identifier, 642 int GetChannelID(const std::string& server_identifier,
649 base::Time* expiration_time, 643 scoped_ptr<crypto::ECPrivateKey>* key_result,
650 std::string* private_key_result,
651 std::string* cert_result,
652 const GetChannelIDCallback& callback) override { 644 const GetChannelIDCallback& callback) override {
653 base::MessageLoop::current()->PostTask( 645 base::MessageLoop::current()->PostTask(
654 FROM_HERE, base::Bind(callback, ERR_UNEXPECTED, 646 FROM_HERE,
655 server_identifier, base::Time(), "", "")); 647 base::Bind(callback, ERR_UNEXPECTED, server_identifier,
648 base::Passed(scoped_ptr<crypto::ECPrivateKey>())));
656 return ERR_IO_PENDING; 649 return ERR_IO_PENDING;
657 } 650 }
658 void SetChannelID(const std::string& server_identifier, 651 void SetChannelID(scoped_ptr<ChannelID> channel_id) override {}
659 base::Time creation_time,
660 base::Time expiration_time,
661 const std::string& private_key,
662 const std::string& cert) override {}
663 void DeleteChannelID(const std::string& server_identifier, 652 void DeleteChannelID(const std::string& server_identifier,
664 const base::Closure& completion_callback) override {} 653 const base::Closure& completion_callback) override {}
665 void DeleteAllCreatedBetween( 654 void DeleteAllCreatedBetween(
666 base::Time delete_begin, 655 base::Time delete_begin,
667 base::Time delete_end, 656 base::Time delete_end,
668 const base::Closure& completion_callback) override {} 657 const base::Closure& completion_callback) override {}
669 void DeleteAll(const base::Closure& completion_callback) override {} 658 void DeleteAll(const base::Closure& completion_callback) override {}
670 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} 659 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {}
671 int GetChannelIDCount() override { return 0; } 660 int GetChannelIDCount() override { return 0; }
672 void SetForceKeepSessionState() override {} 661 void SetForceKeepSessionState() override {}
(...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 ssl_config.channel_id_enabled = true; 3420 ssl_config.channel_id_enabled = true;
3432 3421
3433 int rv; 3422 int rv;
3434 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); 3423 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
3435 3424
3436 EXPECT_EQ(ERR_UNEXPECTED, rv); 3425 EXPECT_EQ(ERR_UNEXPECTED, rv);
3437 EXPECT_FALSE(sock_->IsConnected()); 3426 EXPECT_FALSE(sock_->IsConnected());
3438 } 3427 }
3439 3428
3440 } // namespace net 3429 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698