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

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: Udpate KeysEqual to fail if preconditions fail 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
« no previous file with comments | « net/socket/ssl_client_socket_openssl.cc ('k') | net/ssl/channel_id_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 StreamSocket* socket_; 624 StreamSocket* socket_;
625 CompletionCallback callback_; 625 CompletionCallback callback_;
626 626
627 DISALLOW_COPY_AND_ASSIGN(DeleteSocketCallback); 627 DISALLOW_COPY_AND_ASSIGN(DeleteSocketCallback);
628 }; 628 };
629 629
630 // A ChannelIDStore that always returns an error when asked for a 630 // A ChannelIDStore that always returns an error when asked for a
631 // channel id. 631 // channel id.
632 class FailingChannelIDStore : public ChannelIDStore { 632 class FailingChannelIDStore : public ChannelIDStore {
633 int GetChannelID(const std::string& server_identifier, 633 int GetChannelID(const std::string& server_identifier,
634 base::Time* expiration_time, 634 scoped_ptr<crypto::ECPrivateKey>* key_result,
635 std::string* private_key_result,
636 std::string* cert_result,
637 const GetChannelIDCallback& callback) override { 635 const GetChannelIDCallback& callback) override {
638 return ERR_UNEXPECTED; 636 return ERR_UNEXPECTED;
639 } 637 }
640 void SetChannelID(const std::string& server_identifier, 638 void SetChannelID(scoped_ptr<ChannelID> channel_id) override {}
641 base::Time creation_time,
642 base::Time expiration_time,
643 const std::string& private_key,
644 const std::string& cert) override {}
645 void DeleteChannelID(const std::string& server_identifier, 639 void DeleteChannelID(const std::string& server_identifier,
646 const base::Closure& completion_callback) override {} 640 const base::Closure& completion_callback) override {}
647 void DeleteAllCreatedBetween( 641 void DeleteAllCreatedBetween(
648 base::Time delete_begin, 642 base::Time delete_begin,
649 base::Time delete_end, 643 base::Time delete_end,
650 const base::Closure& completion_callback) override {} 644 const base::Closure& completion_callback) override {}
651 void DeleteAll(const base::Closure& completion_callback) override {} 645 void DeleteAll(const base::Closure& completion_callback) override {}
652 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} 646 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {}
653 int GetChannelIDCount() override { return 0; } 647 int GetChannelIDCount() override { return 0; }
654 void SetForceKeepSessionState() override {} 648 void SetForceKeepSessionState() override {}
655 }; 649 };
656 650
657 // A ChannelIDStore that asynchronously returns an error when asked for a 651 // A ChannelIDStore that asynchronously returns an error when asked for a
658 // channel id. 652 // channel id.
659 class AsyncFailingChannelIDStore : public ChannelIDStore { 653 class AsyncFailingChannelIDStore : public ChannelIDStore {
660 int GetChannelID(const std::string& server_identifier, 654 int GetChannelID(const std::string& server_identifier,
661 base::Time* expiration_time, 655 scoped_ptr<crypto::ECPrivateKey>* key_result,
662 std::string* private_key_result,
663 std::string* cert_result,
664 const GetChannelIDCallback& callback) override { 656 const GetChannelIDCallback& callback) override {
665 base::MessageLoop::current()->PostTask( 657 base::MessageLoop::current()->PostTask(
666 FROM_HERE, base::Bind(callback, ERR_UNEXPECTED, 658 FROM_HERE,
667 server_identifier, base::Time(), "", "")); 659 base::Bind(callback, ERR_UNEXPECTED, server_identifier, nullptr));
668 return ERR_IO_PENDING; 660 return ERR_IO_PENDING;
669 } 661 }
670 void SetChannelID(const std::string& server_identifier, 662 void SetChannelID(scoped_ptr<ChannelID> channel_id) override {}
671 base::Time creation_time,
672 base::Time expiration_time,
673 const std::string& private_key,
674 const std::string& cert) override {}
675 void DeleteChannelID(const std::string& server_identifier, 663 void DeleteChannelID(const std::string& server_identifier,
676 const base::Closure& completion_callback) override {} 664 const base::Closure& completion_callback) override {}
677 void DeleteAllCreatedBetween( 665 void DeleteAllCreatedBetween(
678 base::Time delete_begin, 666 base::Time delete_begin,
679 base::Time delete_end, 667 base::Time delete_end,
680 const base::Closure& completion_callback) override {} 668 const base::Closure& completion_callback) override {}
681 void DeleteAll(const base::Closure& completion_callback) override {} 669 void DeleteAll(const base::Closure& completion_callback) override {}
682 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} 670 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {}
683 int GetChannelIDCount() override { return 0; } 671 int GetChannelIDCount() override { return 0; }
684 void SetForceKeepSessionState() override {} 672 void SetForceKeepSessionState() override {}
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after
3442 ssl_config.channel_id_enabled = true; 3430 ssl_config.channel_id_enabled = true;
3443 3431
3444 int rv; 3432 int rv;
3445 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); 3433 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
3446 3434
3447 EXPECT_EQ(ERR_UNEXPECTED, rv); 3435 EXPECT_EQ(ERR_UNEXPECTED, rv);
3448 EXPECT_FALSE(sock_->IsConnected()); 3436 EXPECT_FALSE(sock_->IsConnected());
3449 } 3437 }
3450 3438
3451 } // namespace net 3439 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_openssl.cc ('k') | net/ssl/channel_id_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698