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

Side by Side Diff: net/base/test_completion_callback.h

Issue 817653003: Update from https://crrev.com/309717 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « net/base/sdch_manager_unittest.cc ('k') | net/cert/cert_policy_enforcer_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) 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/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "net/base/completion_callback.h" 10 #include "net/base/completion_callback.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 }; 78 };
79 79
80 } // namespace internal 80 } // namespace internal
81 81
82 class TestClosure 82 class TestClosure
83 : public internal::TestCompletionCallbackBaseInternal { 83 : public internal::TestCompletionCallbackBaseInternal {
84 public: 84 public:
85 using internal::TestCompletionCallbackBaseInternal::WaitForResult; 85 using internal::TestCompletionCallbackBaseInternal::WaitForResult;
86 86
87 TestClosure(); 87 TestClosure();
88 virtual ~TestClosure() override; 88 ~TestClosure() override;
89 89
90 const base::Closure& closure() const { return closure_; } 90 const base::Closure& closure() const { return closure_; }
91 91
92 private: 92 private:
93 const base::Closure closure_; 93 const base::Closure closure_;
94 94
95 DISALLOW_COPY_AND_ASSIGN(TestClosure); 95 DISALLOW_COPY_AND_ASSIGN(TestClosure);
96 }; 96 };
97 97
98 // Base class overridden by custom implementations of TestCompletionCallback. 98 // Base class overridden by custom implementations of TestCompletionCallback.
99 typedef internal::TestCompletionCallbackTemplate<int> 99 typedef internal::TestCompletionCallbackTemplate<int>
100 TestCompletionCallbackBase; 100 TestCompletionCallbackBase;
101 101
102 typedef internal::TestCompletionCallbackTemplate<int64> 102 typedef internal::TestCompletionCallbackTemplate<int64>
103 TestInt64CompletionCallbackBase; 103 TestInt64CompletionCallbackBase;
104 104
105 class TestCompletionCallback : public TestCompletionCallbackBase { 105 class TestCompletionCallback : public TestCompletionCallbackBase {
106 public: 106 public:
107 TestCompletionCallback(); 107 TestCompletionCallback();
108 virtual ~TestCompletionCallback() override; 108 ~TestCompletionCallback() override;
109 109
110 const CompletionCallback& callback() const { return callback_; } 110 const CompletionCallback& callback() const { return callback_; }
111 111
112 private: 112 private:
113 const CompletionCallback callback_; 113 const CompletionCallback callback_;
114 114
115 DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback); 115 DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback);
116 }; 116 };
117 117
118 class TestInt64CompletionCallback : public TestInt64CompletionCallbackBase { 118 class TestInt64CompletionCallback : public TestInt64CompletionCallbackBase {
119 public: 119 public:
120 TestInt64CompletionCallback(); 120 TestInt64CompletionCallback();
121 virtual ~TestInt64CompletionCallback() override; 121 ~TestInt64CompletionCallback() override;
122 122
123 const Int64CompletionCallback& callback() const { return callback_; } 123 const Int64CompletionCallback& callback() const { return callback_; }
124 124
125 private: 125 private:
126 const Int64CompletionCallback callback_; 126 const Int64CompletionCallback callback_;
127 127
128 DISALLOW_COPY_AND_ASSIGN(TestInt64CompletionCallback); 128 DISALLOW_COPY_AND_ASSIGN(TestInt64CompletionCallback);
129 }; 129 };
130 130
131 // Makes sure that the buffer is not referenced when the callback runs. 131 // Makes sure that the buffer is not referenced when the callback runs.
132 class ReleaseBufferCompletionCallback: public TestCompletionCallback { 132 class ReleaseBufferCompletionCallback: public TestCompletionCallback {
133 public: 133 public:
134 explicit ReleaseBufferCompletionCallback(IOBuffer* buffer); 134 explicit ReleaseBufferCompletionCallback(IOBuffer* buffer);
135 virtual ~ReleaseBufferCompletionCallback() override; 135 ~ReleaseBufferCompletionCallback() override;
136 136
137 private: 137 private:
138 void SetResult(int result) override; 138 void SetResult(int result) override;
139 139
140 IOBuffer* buffer_; 140 IOBuffer* buffer_;
141 DISALLOW_COPY_AND_ASSIGN(ReleaseBufferCompletionCallback); 141 DISALLOW_COPY_AND_ASSIGN(ReleaseBufferCompletionCallback);
142 }; 142 };
143 143
144 } // namespace net 144 } // namespace net
145 145
146 #endif // NET_BASE_TEST_COMPLETION_CALLBACK_H_ 146 #endif // NET_BASE_TEST_COMPLETION_CALLBACK_H_
OLDNEW
« no previous file with comments | « net/base/sdch_manager_unittest.cc ('k') | net/cert/cert_policy_enforcer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698