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

Side by Side Diff: net/base/network_change_notifier_linux_unittest.cc

Issue 9378039: dbus: add ObjectPath type (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: add patch for cryptohome_client Created 8 years, 10 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
« no previous file with comments | « net/base/network_change_notifier_linux.cc ('k') | no next file » | 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 "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"
11 #include "dbus/mock_object_proxy.h" 11 #include "dbus/mock_object_proxy.h"
12 #include "dbus/message.h" 12 #include "dbus/message.h"
13 #include "dbus/object_path.h"
13 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace net { 17 namespace net {
17 18
18 using testing::_; 19 using testing::_;
19 using testing::DoAll; 20 using testing::DoAll;
20 using testing::InvokeWithoutArgs; 21 using testing::InvokeWithoutArgs;
21 using testing::Return; 22 using testing::Return;
22 using testing::SaveArg; 23 using testing::SaveArg;
(...skipping 11 matching lines...) Expand all
34 }; 35 };
35 36
36 NetworkChangeNotifierLinuxTest() 37 NetworkChangeNotifierLinuxTest()
37 : initialized_(false, false) {} 38 : initialized_(false, false) {}
38 39
39 virtual void SetUp() { 40 virtual void SetUp() {
40 dbus::Bus::Options options; 41 dbus::Bus::Options options;
41 options.bus_type = dbus::Bus::SYSTEM; 42 options.bus_type = dbus::Bus::SYSTEM;
42 mock_bus_ = new dbus::MockBus(options); 43 mock_bus_ = new dbus::MockBus(options);
43 44
44 mock_object_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), 45 mock_object_proxy_ = new dbus::MockObjectProxy(
45 "service_name", 46 mock_bus_.get(),
46 "service_path"); 47 "service_name",
48 dbus::ObjectPath("service_path"));
47 EXPECT_CALL(*mock_bus_, GetObjectProxyWithOptions(_, _, _)) 49 EXPECT_CALL(*mock_bus_, GetObjectProxyWithOptions(_, _, _))
48 .WillOnce(Return(mock_object_proxy_.get())); 50 .WillOnce(Return(mock_object_proxy_.get()));
49 51
50 EXPECT_CALL(*mock_object_proxy_, CallMethod(_, _, _)) 52 EXPECT_CALL(*mock_object_proxy_, CallMethod(_, _, _))
51 .WillOnce(SaveArg<2>(&response_callback_)); 53 .WillOnce(SaveArg<2>(&response_callback_));
52 EXPECT_CALL(*mock_object_proxy_, ConnectToSignal(_, _, _, _)) 54 EXPECT_CALL(*mock_object_proxy_, ConnectToSignal(_, _, _, _))
53 .WillOnce( 55 .WillOnce(
54 DoAll( 56 DoAll(
55 SaveArg<2>(&signal_callback_), 57 SaveArg<2>(&signal_callback_),
56 InvokeWithoutArgs( 58 InvokeWithoutArgs(
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 TEST_F(NetworkChangeNotifierLinuxTest, InvalidResponse) { 220 TEST_F(NetworkChangeNotifierLinuxTest, InvalidResponse) {
219 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); 221 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty());
220 dbus::MessageWriter writer(response.get()); 222 dbus::MessageWriter writer(response.get());
221 writer.AppendUint16(20); // Uint16 instead of the expected Uint32 223 writer.AppendUint16(20); // Uint16 instead of the expected Uint32
222 RunOnNotifierThread(base::Bind(response_callback_, response.get())); 224 RunOnNotifierThread(base::Bind(response_callback_, response.get()));
223 EXPECT_FALSE(NetworkChangeNotifier::IsOffline()); 225 EXPECT_FALSE(NetworkChangeNotifier::IsOffline());
224 } 226 }
225 227
226 } // namespace 228 } // namespace
227 } // namespace net 229 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698