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

Side by Side Diff: mojo/public/cpp/bindings/strong_binding.h

Issue 2280483002: Add FlushForTesting to InterfacePtr and Binding. (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Interface* impl() { return binding_.impl(); } 107 Interface* impl() { return binding_.impl(); }
108 // Exposed for testing, should not generally be used. 108 // Exposed for testing, should not generally be used.
109 internal::Router* internal_router() { return binding_.internal_router(); } 109 internal::Router* internal_router() { return binding_.internal_router(); }
110 110
111 void OnConnectionError() { 111 void OnConnectionError() {
112 if (!connection_error_handler_.is_null()) 112 if (!connection_error_handler_.is_null())
113 connection_error_handler_.Run(); 113 connection_error_handler_.Run();
114 delete binding_.impl(); 114 delete binding_.impl();
115 } 115 }
116 116
117 // Sends a message on the underlying message pipe and runs the current
118 // message loop until its response is received. This can be used in tests to
119 // verify that no message was sent on a message pipe in response to some
120 // stimulus.
121 void FlushForTesting() { binding_.FlushForTesting(); }
122
117 private: 123 private:
118 base::Closure connection_error_handler_; 124 base::Closure connection_error_handler_;
119 Binding<Interface> binding_; 125 Binding<Interface> binding_;
120 126
121 DISALLOW_COPY_AND_ASSIGN(StrongBinding); 127 DISALLOW_COPY_AND_ASSIGN(StrongBinding);
122 }; 128 };
123 129
124 } // namespace mojo 130 } // namespace mojo
125 131
126 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_ 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/validation_util.cc ('k') | mojo/public/cpp/bindings/tests/associated_interface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698