OLD | NEW |
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 #ifndef NET_BASE_TEST_COMPLETION_CALLBACK_H_ | 5 #ifndef NET_BASE_TEST_COMPLETION_CALLBACK_H_ |
6 #define NET_BASE_TEST_COMPLETION_CALLBACK_H_ | 6 #define NET_BASE_TEST_COMPLETION_CALLBACK_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/tuple.h" | 9 #include "base/tuple.h" |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Base class overridden by custom implementations of TestCompletionCallback. | 80 // Base class overridden by custom implementations of TestCompletionCallback. |
81 typedef internal::TestCompletionCallbackTemplate<int> | 81 typedef internal::TestCompletionCallbackTemplate<int> |
82 TestCompletionCallbackBase; | 82 TestCompletionCallbackBase; |
83 | 83 |
84 typedef internal::TestCompletionCallbackTemplate<int64> | 84 typedef internal::TestCompletionCallbackTemplate<int64> |
85 TestInt64CompletionCallbackBase; | 85 TestInt64CompletionCallbackBase; |
86 | 86 |
87 class TestCompletionCallback : public TestCompletionCallbackBase { | 87 class TestCompletionCallback : public TestCompletionCallbackBase { |
88 public: | 88 public: |
89 TestCompletionCallback(); | 89 TestCompletionCallback(); |
90 virtual ~TestCompletionCallback(); | 90 ~TestCompletionCallback() override; |
91 | 91 |
92 const CompletionCallback& callback() const { return callback_; } | 92 const CompletionCallback& callback() const { return callback_; } |
93 | 93 |
94 private: | 94 private: |
95 const CompletionCallback callback_; | 95 const CompletionCallback callback_; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback); | 97 DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback); |
98 }; | 98 }; |
99 | 99 |
100 class TestInt64CompletionCallback : public TestInt64CompletionCallbackBase { | 100 class TestInt64CompletionCallback : public TestInt64CompletionCallbackBase { |
101 public: | 101 public: |
102 TestInt64CompletionCallback(); | 102 TestInt64CompletionCallback(); |
103 virtual ~TestInt64CompletionCallback(); | 103 ~TestInt64CompletionCallback() override; |
104 | 104 |
105 const Int64CompletionCallback& callback() const { return callback_; } | 105 const Int64CompletionCallback& callback() const { return callback_; } |
106 | 106 |
107 private: | 107 private: |
108 const Int64CompletionCallback callback_; | 108 const Int64CompletionCallback callback_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(TestInt64CompletionCallback); | 110 DISALLOW_COPY_AND_ASSIGN(TestInt64CompletionCallback); |
111 }; | 111 }; |
112 | 112 |
113 // Makes sure that the buffer is not referenced when the callback runs. | 113 // Makes sure that the buffer is not referenced when the callback runs. |
114 class ReleaseBufferCompletionCallback: public TestCompletionCallback { | 114 class ReleaseBufferCompletionCallback: public TestCompletionCallback { |
115 public: | 115 public: |
116 explicit ReleaseBufferCompletionCallback(IOBuffer* buffer); | 116 explicit ReleaseBufferCompletionCallback(IOBuffer* buffer); |
117 virtual ~ReleaseBufferCompletionCallback(); | 117 ~ReleaseBufferCompletionCallback() override; |
118 | 118 |
119 private: | 119 private: |
120 virtual void SetResult(int result) override; | 120 void SetResult(int result) override; |
121 | 121 |
122 IOBuffer* buffer_; | 122 IOBuffer* buffer_; |
123 DISALLOW_COPY_AND_ASSIGN(ReleaseBufferCompletionCallback); | 123 DISALLOW_COPY_AND_ASSIGN(ReleaseBufferCompletionCallback); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace net | 126 } // namespace net |
127 | 127 |
128 #endif // NET_BASE_TEST_COMPLETION_CALLBACK_H_ | 128 #endif // NET_BASE_TEST_COMPLETION_CALLBACK_H_ |
OLD | NEW |