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

Side by Side Diff: chrome/browser/extensions/api/socket/udp_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: Implementations 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/udp_socket.h" 5 #include "chrome/browser/extensions/api/socket/udp_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/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 27 matching lines...) Expand all
38 38
39 class MockAPIResourceEventNotifier : public APIResourceEventNotifier { 39 class MockAPIResourceEventNotifier : public APIResourceEventNotifier {
40 public: 40 public:
41 MockAPIResourceEventNotifier() : APIResourceEventNotifier(NULL, NULL, 41 MockAPIResourceEventNotifier() : APIResourceEventNotifier(NULL, NULL,
42 std::string(), 42 std::string(),
43 0, GURL()) {} 43 0, GURL()) {}
44 44
45 MOCK_METHOD2(OnReadComplete, void(int result_code, 45 MOCK_METHOD2(OnReadComplete, void(int result_code,
46 const std::string& message)); 46 const std::string& message));
47 MOCK_METHOD1(OnWriteComplete, void(int result_code)); 47 MOCK_METHOD1(OnWriteComplete, void(int result_code));
48
49 protected:
50 virtual ~MockAPIResourceEventNotifier() {}
48 }; 51 };
49 52
50 TEST(SocketTest, TestUDPSocketRead) { 53 TEST(SocketTest, TestUDPSocketRead) {
51 MockUDPSocket* udp_client_socket = new MockUDPSocket(); 54 MockUDPSocket* udp_client_socket = new MockUDPSocket();
52 APIResourceEventNotifier* notifier = new MockAPIResourceEventNotifier(); 55 APIResourceEventNotifier* notifier = new MockAPIResourceEventNotifier();
53 56
54 scoped_ptr<UDPSocket> socket(UDPSocket::CreateSocketForTesting( 57 scoped_ptr<UDPSocket> socket(UDPSocket::CreateSocketForTesting(
55 udp_client_socket, "1.2.3.4", 1, notifier)); 58 udp_client_socket, "1.2.3.4", 1, notifier));
56 59
57 EXPECT_CALL(*udp_client_socket, Read(_, _, _)) 60 EXPECT_CALL(*udp_client_socket, Read(_, _, _))
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 io_buffer->size())); 98 io_buffer->size()));
96 99
97 // Good. Original call came back unable to complete. Now pretend the socket 100 // Good. Original call came back unable to complete. Now pretend the socket
98 // finished, and confirm that we passed the error back. 101 // finished, and confirm that we passed the error back.
99 EXPECT_CALL(*notifier, OnWriteComplete(42)) 102 EXPECT_CALL(*notifier, OnWriteComplete(42))
100 .Times(1); 103 .Times(1);
101 callback.Run(42); 104 callback.Run(42);
102 } 105 }
103 106
104 } // namespace extensions 107 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698