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

Side by Side Diff: chromeos/dbus/blocking_method_caller_unittest.cc

Issue 16998003: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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
« no previous file with comments | « chromeos/audio/cras_audio_handler.cc ('k') | chromeos/dbus/cros_disks_client.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 #include "chromeos/dbus/blocking_method_caller.h" 5 #include "chromeos/dbus/blocking_method_caller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "dbus/message.h" 10 #include "dbus/message.h"
(...skipping 21 matching lines...) Expand all
32 mock_bus_ = new dbus::MockBus(options); 32 mock_bus_ = new dbus::MockBus(options);
33 33
34 // Create a mock proxy. 34 // Create a mock proxy.
35 mock_proxy_ = new dbus::MockObjectProxy( 35 mock_proxy_ = new dbus::MockObjectProxy(
36 mock_bus_.get(), 36 mock_bus_.get(),
37 "org.chromium.TestService", 37 "org.chromium.TestService",
38 dbus::ObjectPath("/org/chromium/TestObject")); 38 dbus::ObjectPath("/org/chromium/TestObject"));
39 39
40 // Set an expectation so mock_proxy's CallMethodAndBlock() will use 40 // Set an expectation so mock_proxy's CallMethodAndBlock() will use
41 // CreateMockProxyResponse() to return responses. 41 // CreateMockProxyResponse() to return responses.
42 EXPECT_CALL(*mock_proxy_, MockCallMethodAndBlock(_, _)) 42 EXPECT_CALL(*mock_proxy_.get(), MockCallMethodAndBlock(_, _))
43 .WillRepeatedly(Invoke( 43 .WillRepeatedly(
44 this, &BlockingMethodCallerTest::CreateMockProxyResponse)); 44 Invoke(this, &BlockingMethodCallerTest::CreateMockProxyResponse));
45 45
46 // Set an expectation so mock_bus's GetObjectProxy() for the given 46 // Set an expectation so mock_bus's GetObjectProxy() for the given
47 // service name and the object path will return mock_proxy_. 47 // service name and the object path will return mock_proxy_.
48 EXPECT_CALL(*mock_bus_, GetObjectProxy( 48 EXPECT_CALL(*mock_bus_.get(),
49 "org.chromium.TestService", 49 GetObjectProxy("org.chromium.TestService",
50 dbus::ObjectPath("/org/chromium/TestObject"))) 50 dbus::ObjectPath("/org/chromium/TestObject")))
51 .WillOnce(Return(mock_proxy_.get())); 51 .WillOnce(Return(mock_proxy_.get()));
52 52
53 // Set an expectation so mock_bus's PostTaskToDBusThread() will run the 53 // Set an expectation so mock_bus's PostTaskToDBusThread() will run the
54 // given task. 54 // given task.
55 EXPECT_CALL(*mock_bus_, PostTaskToDBusThread(_, _)) 55 EXPECT_CALL(*mock_bus_.get(), PostTaskToDBusThread(_, _))
56 .WillRepeatedly(Invoke( 56 .WillRepeatedly(Invoke(this, &BlockingMethodCallerTest::RunTask));
57 this, &BlockingMethodCallerTest::RunTask));
58 57
59 // ShutdownAndBlock() will be called in TearDown(). 58 // ShutdownAndBlock() will be called in TearDown().
60 EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); 59 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return());
61 } 60 }
62 61
63 virtual void TearDown() { 62 virtual void TearDown() {
64 mock_bus_->ShutdownAndBlock(); 63 mock_bus_->ShutdownAndBlock();
65 } 64 }
66 65
67 protected: 66 protected:
68 scoped_refptr<dbus::MockBus> mock_bus_; 67 scoped_refptr<dbus::MockBus> mock_bus_;
69 scoped_refptr<dbus::MockObjectProxy> mock_proxy_; 68 scoped_refptr<dbus::MockObjectProxy> mock_proxy_;
70 69
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Check the response. 115 // Check the response.
117 ASSERT_TRUE(response.get()); 116 ASSERT_TRUE(response.get());
118 dbus::MessageReader reader(response.get()); 117 dbus::MessageReader reader(response.get());
119 std::string text_message; 118 std::string text_message;
120 ASSERT_TRUE(reader.PopString(&text_message)); 119 ASSERT_TRUE(reader.PopString(&text_message));
121 // The text message should be echo'ed back. 120 // The text message should be echo'ed back.
122 EXPECT_EQ(kHello, text_message); 121 EXPECT_EQ(kHello, text_message);
123 } 122 }
124 123
125 } // namespace chromeos 124 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/audio/cras_audio_handler.cc ('k') | chromeos/dbus/cros_disks_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698