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

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

Issue 5523001: Fix ClientSocketPoolBaseHelper preconnect crasher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add NOTREACHED(). Created 10 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 | 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 2898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2909 EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a")); 2909 EXPECT_EQ(0, pool_->NumConnectJobsInGroup("a"));
2910 EXPECT_EQ(kDefaultMaxSocketsPerGroup, pool_->IdleSocketCountInGroup("a")); 2910 EXPECT_EQ(kDefaultMaxSocketsPerGroup, pool_->IdleSocketCountInGroup("a"));
2911 2911
2912 pool_->RequestSockets("b", &params_, kDefaultMaxSocketsPerGroup, 2912 pool_->RequestSockets("b", &params_, kDefaultMaxSocketsPerGroup,
2913 BoundNetLog()); 2913 BoundNetLog());
2914 2914
2915 EXPECT_EQ(0, pool_->NumConnectJobsInGroup("b")); 2915 EXPECT_EQ(0, pool_->NumConnectJobsInGroup("b"));
2916 EXPECT_EQ(kDefaultMaxSocketsPerGroup, pool_->IdleSocketCountInGroup("b")); 2916 EXPECT_EQ(kDefaultMaxSocketsPerGroup, pool_->IdleSocketCountInGroup("b"));
2917 } 2917 }
2918 2918
2919 TEST_F(ClientSocketPoolBaseTest, RequestSocketsSynchronousError) {
2920 CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup);
2921 connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob);
2922
2923 pool_->RequestSockets("a", &params_, kDefaultMaxSocketsPerGroup,
2924 BoundNetLog());
2925
2926 ASSERT_FALSE(pool_->HasGroup("a"));
2927 }
2928
2919 TEST_F(ClientSocketPoolBaseTest, RequestSocketsMultipleTimesDoesNothing) { 2929 TEST_F(ClientSocketPoolBaseTest, RequestSocketsMultipleTimesDoesNothing) {
2920 CreatePool(4, 4); 2930 CreatePool(4, 4);
2921 connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); 2931 connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob);
2922 2932
2923 pool_->RequestSockets("a", &params_, 2, BoundNetLog()); 2933 pool_->RequestSockets("a", &params_, 2, BoundNetLog());
2924 2934
2925 ASSERT_TRUE(pool_->HasGroup("a")); 2935 ASSERT_TRUE(pool_->HasGroup("a"));
2926 EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a")); 2936 EXPECT_EQ(2, pool_->NumConnectJobsInGroup("a"));
2927 EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); 2937 EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a"));
2928 2938
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3011 ASSERT_EQ(OK, callback1.WaitForResult()); 3021 ASSERT_EQ(OK, callback1.WaitForResult());
3012 3022
3013 handle1.Reset(); 3023 handle1.Reset();
3014 3024
3015 EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a")); 3025 EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a"));
3016 } 3026 }
3017 3027
3018 } // namespace 3028 } // namespace
3019 3029
3020 } // namespace net 3030 } // 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