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

Side by Side Diff: jingle/notifier/base/proxy_resolving_client_socket_unittest.cc

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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 | « ipc/ipc_sync_channel.cc ('k') | jingle/notifier/base/xmpp_connection_unittest.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 "jingle/notifier/base/proxy_resolving_client_socket.h" 5 #include "jingle/notifier/base/proxy_resolving_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "net/url_request/url_request_context_getter.h" 9 #include "net/url_request/url_request_context_getter.h"
10 #include "net/url_request/url_request_test_util.h" 10 #include "net/url_request/url_request_test_util.h"
11 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace { 14 namespace {
15 // TODO(sanjeevr): Move this to net_test_support. 15 // TODO(sanjeevr): Move this to net_test_support.
16 // Used to return a dummy context. 16 // Used to return a dummy context.
17 class TestURLRequestContextGetter : public net::URLRequestContextGetter { 17 class TestURLRequestContextGetter : public net::URLRequestContextGetter {
18 public: 18 public:
19 TestURLRequestContextGetter() 19 TestURLRequestContextGetter()
20 : message_loop_proxy_(base::MessageLoopProxy::CreateForCurrentThread()) { 20 : message_loop_proxy_(base::MessageLoopProxy::current()) {
21 } 21 }
22 virtual ~TestURLRequestContextGetter() { } 22 virtual ~TestURLRequestContextGetter() { }
23 23
24 // net::URLRequestContextGetter: 24 // net::URLRequestContextGetter:
25 virtual net::URLRequestContext* GetURLRequestContext() { 25 virtual net::URLRequestContext* GetURLRequestContext() {
26 if (!context_) 26 if (!context_)
27 context_ = new TestURLRequestContext(); 27 context_ = new TestURLRequestContext();
28 return context_.get(); 28 return context_.get();
29 } 29 }
30 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { 30 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // ERR_ADDRESS_INVALID for a 0 IP address. 73 // ERR_ADDRESS_INVALID for a 0 IP address.
74 EXPECT_CALL(*this, NetCallback(net::ERR_ADDRESS_INVALID)).Times(1); 74 EXPECT_CALL(*this, NetCallback(net::ERR_ADDRESS_INVALID)).Times(1);
75 int status = proxy_resolving_socket.Connect(&connect_callback_); 75 int status = proxy_resolving_socket.Connect(&connect_callback_);
76 // Connect always returns ERR_IO_PENDING because it is always asynchronous. 76 // Connect always returns ERR_IO_PENDING because it is always asynchronous.
77 EXPECT_EQ(status, net::ERR_IO_PENDING); 77 EXPECT_EQ(status, net::ERR_IO_PENDING);
78 message_loop_.RunAllPending(); 78 message_loop_.RunAllPending();
79 } 79 }
80 80
81 // TODO(sanjeevr): Add more unit-tests. 81 // TODO(sanjeevr): Add more unit-tests.
82 } // namespace notifier 82 } // namespace notifier
OLDNEW
« no previous file with comments | « ipc/ipc_sync_channel.cc ('k') | jingle/notifier/base/xmpp_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698