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

Side by Side Diff: jingle/glue/proxy_resolving_client_socket_unittest.cc

Issue 11410066: Revert 167337 - Move url_request_test_util into net namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
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 "jingle/glue/proxy_resolving_client_socket.h" 5 #include "jingle/glue/proxy_resolving_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.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 "net/base/mock_host_resolver.h" 10 #include "net/base/mock_host_resolver.h"
11 #include "net/base/test_completion_callback.h" 11 #include "net/base/test_completion_callback.h"
12 #include "net/proxy/proxy_service.h" 12 #include "net/proxy/proxy_service.h"
13 #include "net/socket/socket_test_util.h" 13 #include "net/socket/socket_test_util.h"
14 #include "net/url_request/url_request_context_getter.h" 14 #include "net/url_request/url_request_context_getter.h"
15 #include "net/url_request/url_request_test_util.h" 15 #include "net/url_request/url_request_test_util.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace { 18 namespace {
19 19
20 class MyTestURLRequestContext : public net::TestURLRequestContext { 20 class MyTestURLRequestContext : public TestURLRequestContext {
21 public: 21 public:
22 MyTestURLRequestContext() : TestURLRequestContext(true) { 22 MyTestURLRequestContext() : TestURLRequestContext(true) {
23 context_storage_.set_proxy_service( 23 context_storage_.set_proxy_service(
24 net::ProxyService::CreateFixedFromPacResult( 24 net::ProxyService::CreateFixedFromPacResult(
25 "PROXY bad:99; PROXY maybe:80; DIRECT")); 25 "PROXY bad:99; PROXY maybe:80; DIRECT"));
26 Init(); 26 Init();
27 } 27 }
28 virtual ~MyTestURLRequestContext() {} 28 virtual ~MyTestURLRequestContext() {}
29 }; 29 };
30 30
31 } // namespace 31 } // namespace
32 32
33 namespace jingle_glue { 33 namespace jingle_glue {
34 34
35 class ProxyResolvingClientSocketTest : public testing::Test { 35 class ProxyResolvingClientSocketTest : public testing::Test {
36 protected: 36 protected:
37 ProxyResolvingClientSocketTest() 37 ProxyResolvingClientSocketTest()
38 : url_request_context_getter_(new net::TestURLRequestContextGetter( 38 : url_request_context_getter_(new TestURLRequestContextGetter(
39 base::MessageLoopProxy::current(), 39 base::MessageLoopProxy::current(),
40 scoped_ptr<net::TestURLRequestContext>( 40 scoped_ptr<TestURLRequestContext>(new MyTestURLRequestContext))) {}
41 new MyTestURLRequestContext))) {}
42 41
43 virtual ~ProxyResolvingClientSocketTest() {} 42 virtual ~ProxyResolvingClientSocketTest() {}
44 43
45 virtual void TearDown() { 44 virtual void TearDown() {
46 // Clear out any messages posted by ProxyResolvingClientSocket's 45 // Clear out any messages posted by ProxyResolvingClientSocket's
47 // destructor. 46 // destructor.
48 message_loop_.RunAllPending(); 47 message_loop_.RunAllPending();
49 } 48 }
50 49
51 MessageLoop message_loop_; 50 MessageLoop message_loop_;
52 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; 51 scoped_refptr<TestURLRequestContextGetter> url_request_context_getter_;
53 }; 52 };
54 53
55 // TODO(sanjeevr): Fix this test on Linux. 54 // TODO(sanjeevr): Fix this test on Linux.
56 TEST_F(ProxyResolvingClientSocketTest, DISABLED_ConnectError) { 55 TEST_F(ProxyResolvingClientSocketTest, DISABLED_ConnectError) {
57 net::HostPortPair dest("0.0.0.0", 0); 56 net::HostPortPair dest("0.0.0.0", 0);
58 ProxyResolvingClientSocket proxy_resolving_socket( 57 ProxyResolvingClientSocket proxy_resolving_socket(
59 NULL, 58 NULL,
60 url_request_context_getter_, 59 url_request_context_getter_,
61 net::SSLConfig(), 60 net::SSLConfig(),
62 dest); 61 dest);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const net::ProxyRetryInfoMap& retry_info = 108 const net::ProxyRetryInfoMap& retry_info =
110 context->proxy_service()->proxy_retry_info(); 109 context->proxy_service()->proxy_retry_info();
111 110
112 EXPECT_EQ(1u, retry_info.size()); 111 EXPECT_EQ(1u, retry_info.size());
113 net::ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); 112 net::ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99");
114 EXPECT_TRUE(iter != retry_info.end()); 113 EXPECT_TRUE(iter != retry_info.end());
115 } 114 }
116 115
117 // TODO(sanjeevr): Add more unit-tests. 116 // TODO(sanjeevr): Add more unit-tests.
118 } // namespace jingle_glue 117 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « content/test/webrtc_audio_device_test.cc ('k') | jingle/notifier/base/xmpp_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698