This source file includes following definitions.
- SetUp
- TearDown
- TEST_F
#include "chrome/browser/chromeos/dbus/cros_dbus_service.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "dbus/message.h"
#include "dbus/mock_bus.h"
#include "dbus/mock_exported_object.h"
#include "dbus/mock_object_proxy.h"
#include "dbus/object_path.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
using ::testing::Eq;
using ::testing::Invoke;
using ::testing::Return;
namespace chromeos {
class MockProxyResolutionService
: public CrosDBusService::ServiceProviderInterface {
public:
MOCK_METHOD1(Start, void(scoped_refptr<dbus::ExportedObject>
exported_object));
};
class CrosDBusServiceTest : public testing::Test {
public:
CrosDBusServiceTest() {
}
virtual void SetUp() {
dbus::Bus::Options options;
options.bus_type = dbus::Bus::SYSTEM;
mock_bus_ = new dbus::MockBus(options);
EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return());
mock_exported_object_ =
new dbus::MockExportedObject(mock_bus_.get(),
dbus::ObjectPath(kLibCrosServicePath));
EXPECT_CALL(*mock_bus_.get(),
GetExportedObject(dbus::ObjectPath(kLibCrosServicePath)))
.WillOnce(Return(mock_exported_object_.get()));
MockProxyResolutionService* mock_proxy_resolution_service_provider =
new MockProxyResolutionService;
EXPECT_CALL(*mock_proxy_resolution_service_provider,
Start(Eq(mock_exported_object_))).WillOnce(Return());
CrosDBusService::InitializeForTesting(
mock_bus_.get(), mock_proxy_resolution_service_provider);
}
virtual void TearDown() {
CrosDBusService::Shutdown();
mock_bus_->ShutdownAndBlock();
}
protected:
scoped_refptr<dbus::MockBus> mock_bus_;
scoped_refptr<dbus::MockExportedObject> mock_exported_object_;
};
TEST_F(CrosDBusServiceTest, Start) {
}
}