summaryrefslogtreecommitdiffstats
path: root/dbus/mock_exported_object.h
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 05:18:29 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 05:18:29 +0000
commitb8ae051ea8edaefb9f787bdca704e2df1adfb89f (patch)
treef26c2509c5f31de44d9446d17be64666558bdfcc /dbus/mock_exported_object.h
parent2517cfa5066e63e6ed2642779ea57616ae49eb42 (diff)
downloadchromium_src-b8ae051ea8edaefb9f787bdca704e2df1adfb89f.zip
chromium_src-b8ae051ea8edaefb9f787bdca704e2df1adfb89f.tar.gz
chromium_src-b8ae051ea8edaefb9f787bdca704e2df1adfb89f.tar.bz2
Add mock classes for Bus, ObjectProxy, and ExportedObject.
Also add mock_unittest.cc that demonstrates how to mock synchronos and asynchronos D-Bus method calls. BUG=90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7714030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/mock_exported_object.h')
-rw-r--r--dbus/mock_exported_object.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/dbus/mock_exported_object.h b/dbus/mock_exported_object.h
new file mode 100644
index 0000000..17a36d0
--- /dev/null
+++ b/dbus/mock_exported_object.h
@@ -0,0 +1,39 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DBUS_MOCK_EXPORTED_OBJECT_H_
+#define DBUS_MOCK_EXPORTED_OBJECT_H_
+#pragma once
+
+#include <string>
+
+#include "dbus/exported_object.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace dbus {
+
+// Mock for ExportedObject.
+class MockExportedObject : public ExportedObject {
+ public:
+ MockExportedObject(Bus* bus,
+ const std::string& service_name,
+ const std::string& object_path);
+ virtual ~MockExportedObject();
+
+ MOCK_METHOD3(ExportMethodAndBlock,
+ bool(const std::string& interface_name,
+ const std::string& method_name,
+ MethodCallCallback method_call_callback));
+ MOCK_METHOD4(ExportMethod,
+ void(const std::string& interface_name,
+ const std::string& method_name,
+ MethodCallCallback method_call_callback,
+ OnExportedCallback on_exported_callback));
+ MOCK_METHOD1(SendSignal, void(Signal* signal));
+ MOCK_METHOD0(Unregister, void());
+};
+
+} // namespace dbus
+
+#endif // DBUS_MOCK_EXPORTED_OBJECT_H_