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

Unified Diff: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc

Issue 275363002: Internalize ServiceConnector<> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add OnConnectionEstablished() Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
index 4410e6f4ace001bb623cc3186b54329e931e242a..e3b47e236ef533f318fd00905eaf7796b1ed823b 100644
--- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -32,7 +32,13 @@ class MathCalculatorImpl : public InterfaceImpl<math::Calculator> {
public:
virtual ~MathCalculatorImpl() {}
- MathCalculatorImpl() : total_(0.0) {
+ MathCalculatorImpl()
+ : total_(0.0),
+ got_connection_(false) {
+ }
+
+ virtual void OnConnectionEstablished() MOJO_OVERRIDE {
+ got_connection_ = true;
}
virtual void OnConnectionError() MOJO_OVERRIDE {
@@ -53,8 +59,13 @@ class MathCalculatorImpl : public InterfaceImpl<math::Calculator> {
client()->Output(total_);
}
- private:
+ bool DidGetConnection() const {
+ return got_connection_;
+ }
+
+private:
double total_;
+ bool got_connection_;
};
class MathCalculatorUIImpl : public math::CalculatorUI {
@@ -116,7 +127,9 @@ class InterfacePtrTest : public testing::Test {
TEST_F(InterfacePtrTest, EndToEnd) {
math::CalculatorPtr calc;
- BindToProxy(new MathCalculatorImpl(), &calc);
+ MathCalculatorImpl* impl = new MathCalculatorImpl();
+ BindToProxy(impl, &calc);
darin (slow to review) 2014/05/15 18:06:20 note: BindToProxy returns the first argument, so y
+ EXPECT_TRUE(impl->DidGetConnection());
// Suppose this is instantiated in a process that has pipe1_.
MathCalculatorUIImpl calculator_ui(calc.Pass());

Powered by Google App Engine
This is Rietveld 408576698