OLD | NEW |
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 "net/base/network_change_notifier_linux.h" | 5 #include "net/base/network_change_notifier_linux.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "dbus/mock_bus.h" | 10 #include "dbus/mock_bus.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 virtual void SetUp() { | 40 virtual void SetUp() { |
41 dbus::Bus::Options options; | 41 dbus::Bus::Options options; |
42 options.bus_type = dbus::Bus::SYSTEM; | 42 options.bus_type = dbus::Bus::SYSTEM; |
43 mock_bus_ = new dbus::MockBus(options); | 43 mock_bus_ = new dbus::MockBus(options); |
44 | 44 |
45 mock_object_proxy_ = new dbus::MockObjectProxy( | 45 mock_object_proxy_ = new dbus::MockObjectProxy( |
46 mock_bus_.get(), | 46 mock_bus_.get(), |
47 "service_name", | 47 "service_name", |
48 dbus::ObjectPath("service_path")); | 48 dbus::ObjectPath("service_path")); |
49 EXPECT_CALL(*mock_bus_, GetObjectProxyWithOptions(_, _, _)) | 49 EXPECT_CALL(*mock_bus_.get(), GetObjectProxyWithOptions(_, _, _)) |
50 .WillOnce(Return(mock_object_proxy_.get())); | 50 .WillOnce(Return(mock_object_proxy_.get())); |
51 | 51 |
52 EXPECT_CALL(*mock_object_proxy_, CallMethod(_, _, _)) | 52 EXPECT_CALL(*mock_object_proxy_.get(), CallMethod(_, _, _)) |
53 .WillOnce(SaveArg<2>(&response_callback_)); | 53 .WillOnce(SaveArg<2>(&response_callback_)); |
54 EXPECT_CALL(*mock_object_proxy_, ConnectToSignal(_, _, _, _)) | 54 EXPECT_CALL(*mock_object_proxy_.get(), ConnectToSignal(_, _, _, _)) |
55 .WillOnce( | 55 .WillOnce( |
56 DoAll( | 56 DoAll( |
57 SaveArg<2>(&signal_callback_), | 57 SaveArg<2>(&signal_callback_), |
58 InvokeWithoutArgs( | 58 InvokeWithoutArgs( |
59 this, | 59 this, |
60 &NetworkChangeNotifierLinuxTest::Initialize))); | 60 &NetworkChangeNotifierLinuxTest::Initialize))); |
61 | 61 |
62 notifier_.reset(NetworkChangeNotifierLinux::CreateForTest(mock_bus_.get())); | 62 notifier_.reset(NetworkChangeNotifierLinux::CreateForTest(mock_bus_.get())); |
63 | 63 |
64 initialized_.Wait(); | 64 initialized_.Wait(); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 234 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
235 dbus::MessageWriter writer(response.get()); | 235 dbus::MessageWriter writer(response.get()); |
236 writer.AppendUint16(20); // Uint16 instead of the expected Uint32 | 236 writer.AppendUint16(20); // Uint16 instead of the expected Uint32 |
237 RunOnNotifierThread(base::Bind(response_callback_, response.get())); | 237 RunOnNotifierThread(base::Bind(response_callback_, response.get())); |
238 EXPECT_NE(NetworkChangeNotifier::CONNECTION_NONE, | 238 EXPECT_NE(NetworkChangeNotifier::CONNECTION_NONE, |
239 NetworkChangeNotifier::GetConnectionType()); | 239 NetworkChangeNotifier::GetConnectionType()); |
240 } | 240 } |
241 | 241 |
242 } // namespace | 242 } // namespace |
243 } // namespace net | 243 } // namespace net |
OLD | NEW |