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

Side by Side Diff: chrome/browser/extensions/api/socket/tcp_socket_unittest.cc

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 8 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
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 "chrome/browser/extensions/api/socket/tcp_socket.h" 5 #include "chrome/browser/extensions/api/socket/tcp_socket.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" 8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h"
9 #include "net/base/address_list.h" 9 #include "net/base/address_list.h"
10 #include "net/base/completion_callback.h" 10 #include "net/base/completion_callback.h"
(...skipping 30 matching lines...) Expand all
41 41
42 class MockAPIResourceEventNotifier : public APIResourceEventNotifier { 42 class MockAPIResourceEventNotifier : public APIResourceEventNotifier {
43 public: 43 public:
44 MockAPIResourceEventNotifier() : APIResourceEventNotifier(NULL, NULL, 44 MockAPIResourceEventNotifier() : APIResourceEventNotifier(NULL, NULL,
45 std::string(), 45 std::string(),
46 0, GURL()) {} 46 0, GURL()) {}
47 47
48 MOCK_METHOD2(OnReadComplete, void(int result_code, 48 MOCK_METHOD2(OnReadComplete, void(int result_code,
49 const std::string& message)); 49 const std::string& message));
50 MOCK_METHOD1(OnWriteComplete, void(int result_code)); 50 MOCK_METHOD1(OnWriteComplete, void(int result_code));
51
52 protected:
53 virtual ~MockAPIResourceEventNotifier() {}
51 }; 54 };
52 55
53 TEST(SocketTest, TestTCPSocketRead) { 56 TEST(SocketTest, TestTCPSocketRead) {
54 net::AddressList address_list; 57 net::AddressList address_list;
55 MockTCPSocket* tcp_client_socket = new MockTCPSocket(address_list); 58 MockTCPSocket* tcp_client_socket = new MockTCPSocket(address_list);
56 APIResourceEventNotifier* notifier = new MockAPIResourceEventNotifier(); 59 APIResourceEventNotifier* notifier = new MockAPIResourceEventNotifier();
57 60
58 scoped_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting( 61 scoped_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting(
59 tcp_client_socket, notifier)); 62 tcp_client_socket, notifier));
60 63
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 io_buffer->size())); 105 io_buffer->size()));
103 106
104 // Good. Original call came back unable to complete. Now pretend the socket 107 // Good. Original call came back unable to complete. Now pretend the socket
105 // finished, and confirm that we passed the error back. 108 // finished, and confirm that we passed the error back.
106 EXPECT_CALL(*notifier, OnWriteComplete(42)) 109 EXPECT_CALL(*notifier, OnWriteComplete(42))
107 .Times(1); 110 .Times(1);
108 callback.Run(42); 111 callback.Run(42);
109 } 112 }
110 113
111 } // namespace extensions 114 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/socket/socket_api.cc ('k') | chrome/browser/extensions/api/terminal/terminal_private_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698