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

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

Issue 7719007: Add a gyp flag to enable dcheck by default in release without (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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/http/http_cache_unittest.cc ('k') | net/spdy/spdy_protocol_test.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/transport_client_socket_pool.h" 5 #include "net/socket/transport_client_socket_pool.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/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 return callback_.WaitForResult(); 790 return callback_.WaitForResult();
791 } 791 }
792 792
793 private: 793 private:
794 ClientSocketHandle* const handle_; 794 ClientSocketHandle* const handle_;
795 TransportClientSocketPool* const pool_; 795 TransportClientSocketPool* const pool_;
796 bool within_callback_; 796 bool within_callback_;
797 TestCompletionCallback callback_; 797 TestCompletionCallback callback_;
798 }; 798 };
799 799
800 TEST_F(TransportClientSocketPoolTest, RequestTwice) { 800 // Disabled in release with dcheck : http://crbug.com/94501
801 #if defined(DCHECK_ALWAYS_ON)
802 #define MAYBE_RequestTwice DISABLED_RequestTwice
803 #else
804 #define MAYBE_RequestTwice RequestTwice
805 #endif
806 TEST_F(TransportClientSocketPoolTest, MAYBE_RequestTwice) {
801 ClientSocketHandle handle; 807 ClientSocketHandle handle;
802 RequestSocketCallback callback(&handle, &pool_); 808 RequestSocketCallback callback(&handle, &pool_);
803 scoped_refptr<TransportSocketParams> dest(new TransportSocketParams( 809 scoped_refptr<TransportSocketParams> dest(new TransportSocketParams(
804 HostPortPair("www.google.com", 80), LOWEST, GURL(), false, false)); 810 HostPortPair("www.google.com", 80), LOWEST, GURL(), false, false));
805 int rv = handle.Init("a", dest, LOWEST, &callback, &pool_, 811 int rv = handle.Init("a", dest, LOWEST, &callback, &pool_,
806 BoundNetLog()); 812 BoundNetLog());
807 ASSERT_EQ(ERR_IO_PENDING, rv); 813 ASSERT_EQ(ERR_IO_PENDING, rv);
808 814
809 // The callback is going to request "www.google.com". We want it to complete 815 // The callback is going to request "www.google.com". We want it to complete
810 // synchronously this time. 816 // synchronously this time.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 EXPECT_EQ(0, pool_.IdleSocketCount()); 995 EXPECT_EQ(0, pool_.IdleSocketCount());
990 } 996 }
991 } 997 }
992 998
993 // Test the case where a socket took long enough to start the creation 999 // Test the case where a socket took long enough to start the creation
994 // of the backup socket and never completes, and then the backup 1000 // of the backup socket and never completes, and then the backup
995 // connection fails. 1001 // connection fails.
996 // 1002 //
997 // Flaky on Mac + Linux - http://crbug.com/86550 1003 // Flaky on Mac + Linux - http://crbug.com/86550
998 // Flaky on ChromeOS - http://crbug.com/89273 1004 // Flaky on ChromeOS - http://crbug.com/89273
1005 // Disabled in release with dcheck : http://crbug.com/94501
999 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) || defined(OS_LINUX) 1006 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) || defined(OS_LINUX)
1000 #define MAYBE_BackupSocketFailAfterStall FLAKY_BackupSocketFailAfterStall 1007 #define MAYBE_BackupSocketFailAfterStall FLAKY_BackupSocketFailAfterStall
1008 #elif defined(DCHECK_ALWAYS_ON)
1009 #define MAYBE_BackupSocketFailAfterStall DISABLED_BackupSocketFailAfterStall
1001 #else 1010 #else
1002 #define MAYBE_BackupSocketFailAfterStall BackupSocketFailAfterStall 1011 #define MAYBE_BackupSocketFailAfterStall BackupSocketFailAfterStall
1003 #endif 1012 #endif
1004 TEST_F(TransportClientSocketPoolTest, MAYBE_BackupSocketFailAfterStall) { 1013 TEST_F(TransportClientSocketPoolTest, MAYBE_BackupSocketFailAfterStall) {
1005 MockClientSocketFactory::ClientSocketType case_types[] = { 1014 MockClientSocketFactory::ClientSocketType case_types[] = {
1006 // The first socket will not connect. 1015 // The first socket will not connect.
1007 MockClientSocketFactory::MOCK_STALLED_CLIENT_SOCKET, 1016 MockClientSocketFactory::MOCK_STALLED_CLIENT_SOCKET,
1008 // The second socket will fail immediately. 1017 // The second socket will fail immediately.
1009 MockClientSocketFactory::MOCK_FAILING_CLIENT_SOCKET 1018 MockClientSocketFactory::MOCK_FAILING_CLIENT_SOCKET
1010 }; 1019 };
(...skipping 28 matching lines...) Expand all
1039 EXPECT_EQ(0, pool_.IdleSocketCount()); 1048 EXPECT_EQ(0, pool_.IdleSocketCount());
1040 handle.Reset(); 1049 handle.Reset();
1041 1050
1042 // Reset for the next case. 1051 // Reset for the next case.
1043 host_resolver_->set_synchronous_mode(false); 1052 host_resolver_->set_synchronous_mode(false);
1044 } 1053 }
1045 1054
1046 // Test the case where a socket took long enough to start the creation 1055 // Test the case where a socket took long enough to start the creation
1047 // of the backup socket and eventually completes, but the backup socket 1056 // of the backup socket and eventually completes, but the backup socket
1048 // fails. 1057 // fails.
1049 TEST_F(TransportClientSocketPoolTest, BackupSocketFailAfterDelay) { 1058 // Disabled in release with dcheck : http://crbug.com/94501
1059 #if defined(DCHECK_ALWAYS_ON)
1060 #define MAYBE_BackupSocketFailAfterDelay DISABLED_BackupSocketFailAfterDelay
1061 #else
1062 #define MAYBE_BackupSocketFailAfterDelay BackupSocketFailAfterDelay
1063 #endif
1064 TEST_F(TransportClientSocketPoolTest, MAYBE_BackupSocketFailAfterDelay) {
1050 MockClientSocketFactory::ClientSocketType case_types[] = { 1065 MockClientSocketFactory::ClientSocketType case_types[] = {
1051 // The first socket will connect, although delayed. 1066 // The first socket will connect, although delayed.
1052 MockClientSocketFactory::MOCK_DELAYED_CLIENT_SOCKET, 1067 MockClientSocketFactory::MOCK_DELAYED_CLIENT_SOCKET,
1053 // The second socket will not connect. 1068 // The second socket will not connect.
1054 MockClientSocketFactory::MOCK_FAILING_CLIENT_SOCKET 1069 MockClientSocketFactory::MOCK_FAILING_CLIENT_SOCKET
1055 }; 1070 };
1056 1071
1057 client_socket_factory_.set_client_socket_types(case_types, 2); 1072 client_socket_factory_.set_client_socket_types(case_types, 2);
1058 client_socket_factory_.set_delay_ms(5000); 1073 client_socket_factory_.set_delay_ms(5000);
1059 1074
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 EXPECT_TRUE(handle.socket()); 1250 EXPECT_TRUE(handle.socket());
1236 IPEndPoint endpoint; 1251 IPEndPoint endpoint;
1237 handle.socket()->GetLocalAddress(&endpoint); 1252 handle.socket()->GetLocalAddress(&endpoint);
1238 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size()); 1253 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size());
1239 EXPECT_EQ(1, client_socket_factory_.allocation_count()); 1254 EXPECT_EQ(1, client_socket_factory_.allocation_count());
1240 } 1255 }
1241 1256
1242 } // namespace 1257 } // namespace
1243 1258
1244 } // namespace net 1259 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/spdy/spdy_protocol_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698