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

Side by Side Diff: chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc

Issue 9668018: dbus: remove service name from ExportedObject (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pay more attention when fixing mock Created 8 years, 9 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
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 "chrome/browser/chromeos/dbus/cros_dbus_service.h" 5 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "dbus/message.h" 10 #include "dbus/message.h"
(...skipping 30 matching lines...) Expand all
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 // ShutdownAndBlock() will be called in TearDown(). 44 // ShutdownAndBlock() will be called in TearDown().
45 EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); 45 EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return());
46 46
47 // Create a mock exported object that behaves as 47 // Create a mock exported object that behaves as
48 // org.chromium.CrosDBusService. 48 // org.chromium.CrosDBusService.
49 mock_exported_object_ = 49 mock_exported_object_ =
50 new dbus::MockExportedObject(mock_bus_.get(), 50 new dbus::MockExportedObject(mock_bus_.get(),
51 kLibCrosServiceName,
52 dbus::ObjectPath(kLibCrosServicePath)); 51 dbus::ObjectPath(kLibCrosServicePath));
53 52
54 // |mock_bus_|'s GetExportedObject() will return mock_exported_object_| 53 // |mock_bus_|'s GetExportedObject() will return mock_exported_object_|
55 // for the given service name and the object path. 54 // for the given service name and the object path.
56 EXPECT_CALL(*mock_bus_, GetExportedObject( 55 EXPECT_CALL(*mock_bus_, GetExportedObject(
57 kLibCrosServiceName, dbus::ObjectPath(kLibCrosServicePath))) 56 dbus::ObjectPath(kLibCrosServicePath)))
58 .WillOnce(Return(mock_exported_object_.get())); 57 .WillOnce(Return(mock_exported_object_.get()));
59 58
60 // Create a mock proxy resolution service. 59 // Create a mock proxy resolution service.
61 MockProxyResolutionService* mock_proxy_resolution_service_provider = 60 MockProxyResolutionService* mock_proxy_resolution_service_provider =
62 new MockProxyResolutionService; 61 new MockProxyResolutionService;
63 62
64 // Start() will be called with |mock_exported_object_|. 63 // Start() will be called with |mock_exported_object_|.
65 EXPECT_CALL(*mock_proxy_resolution_service_provider, 64 EXPECT_CALL(*mock_proxy_resolution_service_provider,
66 Start(Eq(mock_exported_object_))).WillOnce(Return()); 65 Start(Eq(mock_exported_object_))).WillOnce(Return());
67 66
(...skipping 16 matching lines...) Expand all
84 }; 83 };
85 84
86 TEST_F(CrosDBusServiceTest, Start) { 85 TEST_F(CrosDBusServiceTest, Start) {
87 // Simply start the service and see if mock expectations are met: 86 // Simply start the service and see if mock expectations are met:
88 // - The service object is exported by GetExportedObject() 87 // - The service object is exported by GetExportedObject()
89 // - The proxy resolution service is started. 88 // - The proxy resolution service is started.
90 cros_dbus_service_->Start(); 89 cros_dbus_service_->Start();
91 } 90 }
92 91
93 } // namespace chromeos 92 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698