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

Side by Side Diff: dbus/mock_unittest.cc

Issue 802213003: Standardize usage of virtual/override/final specifiers in dbus/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « dbus/end_to_end_sync_unittest.cc ('k') | dbus/object_manager_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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 11 matching lines...) Expand all
22 using ::testing::Return; 22 using ::testing::Return;
23 using ::testing::Unused; 23 using ::testing::Unused;
24 24
25 namespace dbus { 25 namespace dbus {
26 26
27 class MockTest : public testing::Test { 27 class MockTest : public testing::Test {
28 public: 28 public:
29 MockTest() { 29 MockTest() {
30 } 30 }
31 31
32 virtual void SetUp() { 32 void SetUp() override {
33 // Create a mock bus. 33 // Create a mock bus.
34 Bus::Options options; 34 Bus::Options options;
35 options.bus_type = Bus::SYSTEM; 35 options.bus_type = Bus::SYSTEM;
36 mock_bus_ = new MockBus(options); 36 mock_bus_ = new MockBus(options);
37 37
38 // Create a mock proxy. 38 // Create a mock proxy.
39 mock_proxy_ = new MockObjectProxy( 39 mock_proxy_ = new MockObjectProxy(
40 mock_bus_.get(), 40 mock_bus_.get(),
41 "org.chromium.TestService", 41 "org.chromium.TestService",
42 ObjectPath("/org/chromium/TestObject")); 42 ObjectPath("/org/chromium/TestObject"));
(...skipping 16 matching lines...) Expand all
59 // service name and the object path will return mock_proxy_. 59 // service name and the object path will return mock_proxy_.
60 EXPECT_CALL(*mock_bus_.get(), 60 EXPECT_CALL(*mock_bus_.get(),
61 GetObjectProxy("org.chromium.TestService", 61 GetObjectProxy("org.chromium.TestService",
62 ObjectPath("/org/chromium/TestObject"))) 62 ObjectPath("/org/chromium/TestObject")))
63 .WillOnce(Return(mock_proxy_.get())); 63 .WillOnce(Return(mock_proxy_.get()));
64 64
65 // ShutdownAndBlock() will be called in TearDown(). 65 // ShutdownAndBlock() will be called in TearDown().
66 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); 66 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return());
67 } 67 }
68 68
69 virtual void TearDown() { 69 void TearDown() override { mock_bus_->ShutdownAndBlock(); }
70 mock_bus_->ShutdownAndBlock();
71 }
72 70
73 // Called when the response is received. 71 // Called when the response is received.
74 void OnResponse(Response* response) { 72 void OnResponse(Response* response) {
75 // |response| will be deleted on exit of the function. Copy the 73 // |response| will be deleted on exit of the function. Copy the
76 // payload to |response_string_|. 74 // payload to |response_string_|.
77 if (response) { 75 if (response) {
78 MessageReader reader(response); 76 MessageReader reader(response);
79 ASSERT_TRUE(reader.PopString(&response_string_)); 77 ASSERT_TRUE(reader.PopString(&response_string_));
80 } 78 }
81 run_loop_->Quit(); 79 run_loop_->Quit();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 ObjectProxy::TIMEOUT_USE_DEFAULT, 207 ObjectProxy::TIMEOUT_USE_DEFAULT,
210 base::Bind(&MockTest::OnResponse, 208 base::Bind(&MockTest::OnResponse,
211 base::Unretained(this))); 209 base::Unretained(this)));
212 // Run the message loop to let OnResponse be called. 210 // Run the message loop to let OnResponse be called.
213 run_loop_->Run(); 211 run_loop_->Run();
214 212
215 EXPECT_EQ(kHello, response_string_); 213 EXPECT_EQ(kHello, response_string_);
216 } 214 }
217 215
218 } // namespace dbus 216 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/end_to_end_sync_unittest.cc ('k') | dbus/object_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698