OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 26 matching lines...) Expand all Loading... |
37 : initialized_(false, false) {} | 37 : initialized_(false, false) {} |
38 | 38 |
39 virtual void SetUp() { | 39 virtual void SetUp() { |
40 dbus::Bus::Options options; | 40 dbus::Bus::Options options; |
41 options.bus_type = dbus::Bus::SYSTEM; | 41 options.bus_type = dbus::Bus::SYSTEM; |
42 mock_bus_ = new dbus::MockBus(options); | 42 mock_bus_ = new dbus::MockBus(options); |
43 | 43 |
44 mock_object_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), | 44 mock_object_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), |
45 "service_name", | 45 "service_name", |
46 "service_path"); | 46 "service_path"); |
47 EXPECT_CALL(*mock_bus_, GetObjectProxy(_, _)) | 47 EXPECT_CALL(*mock_bus_, GetObjectProxyIgnoreUnknownService(_, _)) |
48 .WillOnce(Return(mock_object_proxy_.get())); | 48 .WillOnce(Return(mock_object_proxy_.get())); |
49 | 49 |
50 EXPECT_CALL(*mock_object_proxy_, CallMethod(_, _, _)) | 50 EXPECT_CALL(*mock_object_proxy_, CallMethod(_, _, _)) |
51 .WillOnce(SaveArg<2>(&response_callback_)); | 51 .WillOnce(SaveArg<2>(&response_callback_)); |
52 EXPECT_CALL(*mock_object_proxy_, ConnectToSignal(_, _, _, _)) | 52 EXPECT_CALL(*mock_object_proxy_, ConnectToSignal(_, _, _, _)) |
53 .WillOnce( | 53 .WillOnce( |
54 DoAll( | 54 DoAll( |
55 SaveArg<2>(&signal_callback_), | 55 SaveArg<2>(&signal_callback_), |
56 InvokeWithoutArgs( | 56 InvokeWithoutArgs( |
57 this, | 57 this, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 TEST_F(NetworkChangeNotifierLinuxTest, InvalidResponse) { | 218 TEST_F(NetworkChangeNotifierLinuxTest, InvalidResponse) { |
219 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 219 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
220 dbus::MessageWriter writer(response.get()); | 220 dbus::MessageWriter writer(response.get()); |
221 writer.AppendUint16(20); // Uint16 instead of the expected Uint32 | 221 writer.AppendUint16(20); // Uint16 instead of the expected Uint32 |
222 RunOnNotifierThread(base::Bind(response_callback_, response.get())); | 222 RunOnNotifierThread(base::Bind(response_callback_, response.get())); |
223 EXPECT_FALSE(NetworkChangeNotifier::IsOffline()); | 223 EXPECT_FALSE(NetworkChangeNotifier::IsOffline()); |
224 } | 224 } |
225 | 225 |
226 } // namespace | 226 } // namespace |
227 } // namespace net | 227 } // namespace net |
OLD | NEW |