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

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

Issue 9839075: chromeos: Separate CrosDBusService Initialize/Shutdown from DBusThreadManager (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased onto ToT 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 dbus::ObjectPath(kLibCrosServicePath))) 56 dbus::ObjectPath(kLibCrosServicePath)))
57 .WillOnce(Return(mock_exported_object_.get())); 57 .WillOnce(Return(mock_exported_object_.get()));
58 58
59 // Create a mock proxy resolution service. 59 // Create a mock proxy resolution service.
60 MockProxyResolutionService* mock_proxy_resolution_service_provider = 60 MockProxyResolutionService* mock_proxy_resolution_service_provider =
61 new MockProxyResolutionService; 61 new MockProxyResolutionService;
62 62
63 // Start() will be called with |mock_exported_object_|. 63 // Start() will be called with |mock_exported_object_|.
64 EXPECT_CALL(*mock_proxy_resolution_service_provider, 64 EXPECT_CALL(*mock_proxy_resolution_service_provider,
65 Start(Eq(mock_exported_object_))).WillOnce(Return()); 65 Start(Eq(mock_exported_object_))).WillOnce(Return());
66 66 // Initialize the cros service with the mocks injected.
67 // Create the cros service with the mocks injected. 67 CrosDBusService::InitializeForTesting(
68 cros_dbus_service_.reset( 68 mock_bus_, mock_proxy_resolution_service_provider);
69 CrosDBusService::CreateForTesting(
70 mock_bus_,
71 mock_proxy_resolution_service_provider));
72 } 69 }
73 70
74 virtual void TearDown() { 71 virtual void TearDown() {
72 // Shutdown the cros service.
73 CrosDBusService::Shutdown();
74
75 // Shutdown the bus. 75 // Shutdown the bus.
76 mock_bus_->ShutdownAndBlock(); 76 mock_bus_->ShutdownAndBlock();
77 } 77 }
78 78
79 protected: 79 protected:
80 scoped_refptr<dbus::MockBus> mock_bus_; 80 scoped_refptr<dbus::MockBus> mock_bus_;
81 scoped_refptr<dbus::MockExportedObject> mock_exported_object_; 81 scoped_refptr<dbus::MockExportedObject> mock_exported_object_;
82 scoped_ptr<CrosDBusService> cros_dbus_service_;
83 }; 82 };
84 83
85 TEST_F(CrosDBusServiceTest, Start) { 84 TEST_F(CrosDBusServiceTest, Start) {
86 // Simply start the service and see if mock expectations are met: 85 // Simply start the service and see if mock expectations are met:
87 // - The service object is exported by GetExportedObject() 86 // - The service object is exported by GetExportedObject()
88 // - The proxy resolution service is started. 87 // - The proxy resolution service is started.
89 cros_dbus_service_->Start();
90 } 88 }
91 89
92 } // namespace chromeos 90 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/dbus/cros_dbus_service.cc ('k') | chrome/browser/chromeos/dbus/dbus_thread_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698