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

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

Issue 6293005: Fix preconnect crash on synchronous socket error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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
« no previous file with comments | « net/socket/client_socket_pool_base.cc ('k') | no next file » | 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) 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 "net/socket/client_socket_pool_base.h" 5 #include "net/socket/client_socket_pool_base.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/platform_thread.h" 10 #include "base/platform_thread.h"
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 } 2918 }
2919 2919
2920 TEST_F(ClientSocketPoolBaseTest, RequestSocketsSynchronousError) { 2920 TEST_F(ClientSocketPoolBaseTest, RequestSocketsSynchronousError) {
2921 CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); 2921 CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup);
2922 connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob); 2922 connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob);
2923 2923
2924 pool_->RequestSockets("a", &params_, kDefaultMaxSocketsPerGroup, 2924 pool_->RequestSockets("a", &params_, kDefaultMaxSocketsPerGroup,
2925 BoundNetLog()); 2925 BoundNetLog());
2926 2926
2927 ASSERT_FALSE(pool_->HasGroup("a")); 2927 ASSERT_FALSE(pool_->HasGroup("a"));
2928
2929 connect_job_factory_->set_job_type(
2930 TestConnectJob::kMockAdditionalErrorStateJob);
2931 pool_->RequestSockets("a", &params_, kDefaultMaxSocketsPerGroup,
2932 BoundNetLog());
2933
2934 ASSERT_FALSE(pool_->HasGroup("a"));
2928 } 2935 }
2929 2936
2930 TEST_F(ClientSocketPoolBaseTest, RequestSocketsMultipleTimesDoesNothing) { 2937 TEST_F(ClientSocketPoolBaseTest, RequestSocketsMultipleTimesDoesNothing) {
2931 CreatePool(4, 4); 2938 CreatePool(4, 4);
2932 connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); 2939 connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob);
2933 2940
2934 pool_->RequestSockets("a", &params_, 2, BoundNetLog()); 2941 pool_->RequestSockets("a", &params_, 2, BoundNetLog());
2935 2942
2936 ASSERT_TRUE(pool_->HasGroup("a")); 2943 ASSERT_TRUE(pool_->HasGroup("a"));
2937 EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a")); 2944 EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a"));
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3097 EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a")); 3104 EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a"));
3098 EXPECT_EQ(0, pool_->NumActiveSocketsInGroup("a")); 3105 EXPECT_EQ(0, pool_->NumActiveSocketsInGroup("a"));
3099 EXPECT_EQ(0, pool_->NumConnectJobsInGroup("b")); 3106 EXPECT_EQ(0, pool_->NumConnectJobsInGroup("b"));
3100 EXPECT_EQ(1, pool_->IdleSocketCountInGroup("b")); 3107 EXPECT_EQ(1, pool_->IdleSocketCountInGroup("b"));
3101 EXPECT_EQ(0, pool_->NumActiveSocketsInGroup("b")); 3108 EXPECT_EQ(0, pool_->NumActiveSocketsInGroup("b"));
3102 } 3109 }
3103 3110
3104 } // namespace 3111 } // namespace
3105 3112
3106 } // namespace net 3113 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698