summaryrefslogtreecommitdiffstats
path: root/dbus
Commit message (Collapse)AuthorAgeFilesLines
* dbus: verify object path of incoming signalskeybuk@chromium.org2012-03-012-12/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | The existing behavior, while convenient for debugging, is wrong. D-Bus will not call any further filter functions once one returns DBUS_HANDLER_RESULT_HANDLED, in order for the next to be called a filter must return DBUS_HANDLER_RESULT_NOT_YET_HANDLED if it does not handle the incoming signal. We also can't defer this to the signal function since we have to post that to a different thread, and return values get hard. Since object proxies are constructed per-path, and match common interfaces and members, this means signals must be matched on an object otherwise only the first registered object proxy for any client will be called, and will be called for all signals. BUG=chromium-os:27113 TEST=ran unit tests, and manually verified existing code that uses ConnectToSignal Change-Id: Ia4cbc064dff0421a37fe4c4b7c719acf25eb630c Review URL: http://codereview.chromium.org/9508005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124357 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Add keybuk to dbus OWNERS files.satorux@chromium.org2012-02-251-0/+1
| | | | | | | | | | BUG=none TEST=he's proven to be awesome Review URL: http://codereview.chromium.org/9459002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123618 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: slight cleanup to Property codekeybuk@chromium.org2012-02-172-18/+11
| | | | | | | | | | | | | | | | | | | | | Correct comments based on practice that worked best for the bluetooth adapter and device clients, in particular adding the virtual destructor to the struct and cleaning up the return values of GetObject() in the documentation. Drop VLOG() calls, there's no need to debug at this level, you can use dbus-monitor to see the incoming and outgoing calls to Chromium and can add logging in upper layers when there are real values to log. BUG=none TEST=built on try bots Change-Id: I2ac6b55e288626b5f9cd843935887e261d386dec Review URL: http://codereview.chromium.org/9418035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122522 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Property<>.value() should be constkeybuk@chromium.org2012-02-171-1/+1
| | | | | | | | | | | | | | | Constant references to PropertySets are a useful way to avoid someone calling Get() and Set(), but we should allow them to call value(). BUG=none TEST=built and tested Change-Id: Ic8e5449e87ba3cebbe6a3534596bb53016236333 Review URL: http://codereview.chromium.org/9414029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122467 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: ProperySet destructor must be virtualkeybuk@chromium.org2012-02-171-1/+1
| | | | | | | | | | | | | | | clang requires us to have a destructor for this "complex" class, but that destructor will need to be virtual later. BUG=none TEST=git try -b linux_chromeos_clang Change-Id: Ia0efd34f205ab090cd7f2092d47fc0288b1f4e0c Review URL: http://codereview.chromium.org/9420027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122417 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: add Property handling for clientskeybuk@chromium.org2012-02-156-3/+1253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | D-Bus properties can be tricky to handle due to their reliance on variants, and since they use a common interface, result in a lot of copy and paste code to deal with. Add an API that simplifies matters somewhat; detailed documentation is in dbus/property.h, but fundamentally you add a struct Properties to the client implementation derived from dbus::PropertySet, and in it declare members of dbus::Property<property type> and connect them in the constructor with RegisterProperty(name, ptr). The API works on two levels, from a higher-level each member of the structure is a type-safe way to obtain the current value of the property, update the value, and set a new value. From the lower-level, it uses a generic reader/writer based interface so that the parent structure's GetAll and signal handling methods can update the values without requiring knowledge of the contained type. BUG=chromium:109194 TEST=unit tests included in CL change-Id: I111b9e60a2c6c35edd9e0ea9f6976928c6c6474b Review URL: http://codereview.chromium.org/9380053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122039 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: add ObjectPath typekeybuk@google.com2012-02-1422-112/+205
| | | | | | | | | | | | | | | | | | Rather than use std::string for object paths, add a dbus::ObjectPath type that wraps one while allowing more type-safety. This solves all sorts of issues with confusing object paths for strings, and allows us to do Properties code using templates disambiguating them from strings. BUG=chromium:109194 TEST=built and run tests Change-Id: Icaf6f19daea4af23a9d2ec0ed76d2cbd379d680e Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=121920 Review URL: https://chromiumcodereview.appspot.com/9378039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121941 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 121920 - dbus: add ObjectPath typedpapad@chromium.org2012-02-1422-205/+112
| | | | | | | | | | | | | | | | | | | | Rather than use std::string for object paths, add a dbus::ObjectPath type that wraps one while allowing more type-safety. This solves all sorts of issues with confusing object paths for strings, and allows us to do Properties code using templates disambiguating them from strings. BUG=chromium:109194 TEST=built and run tests Change-Id: Icaf6f19daea4af23a9d2ec0ed76d2cbd379d680e Review URL: http://codereview.chromium.org/9378039 TBR=keybuk@chromium.org Review URL: https://chromiumcodereview.appspot.com/9363045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121923 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: add ObjectPath typekeybuk@chromium.org2012-02-1422-112/+205
| | | | | | | | | | | | | | | | | Rather than use std::string for object paths, add a dbus::ObjectPath type that wraps one while allowing more type-safety. This solves all sorts of issues with confusing object paths for strings, and allows us to do Properties code using templates disambiguating them from strings. BUG=chromium:109194 TEST=built and run tests Change-Id: Icaf6f19daea4af23a9d2ec0ed76d2cbd379d680e Review URL: http://codereview.chromium.org/9378039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121920 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Add dbus/OWNERS.satorux@chromium.org2012-02-141-0/+3
| | | | | | | | | | | | Forgot to put this. BUG=none TEST=none Review URL: http://codereview.chromium.org/9392009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121835 0039d316-1c4b-4281-b951-d872f2087c98
* Coverity: Initialize member variables.jhawkins@chromium.org2012-02-131-0/+2
| | | | | | | | | | | | CID_COUNT=3 CID=103278,103279,103280 BUG=none TEST=none R=groby Review URL: https://chromiumcodereview.appspot.com/9385039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121682 0039d316-1c4b-4281-b951-d872f2087c98
* Allow dbus clients to silence logging when a service is unavailable.adamk@chromium.org2012-02-108-23/+106
| | | | | | | | BUG=109696 Review URL: https://chromiumcodereview.appspot.com/9373039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121544 0039d316-1c4b-4281-b951-d872f2087c98
* Adding support for sending/receiving proto bufs to dbus library.rharrison@chromium.org2012-02-096-1/+103
| | | | | | | | | | | | | | | | | | | This CL add in support to dbus wrapping classes to send and receive protocol buffers. They take in a generic MessageLite, which all protocol buffers inherit from. It will then serialize the buffer and send it out as an array of bytes. On receiving the array of bytes will be parsed back into a protocol buffer. The operations for doing this are very canned and these methods are designed to allow devs to skip writing boilerplate. The methods are just wrappers around the appopriate byte array methods. BUG=chromium:112127 TEST=Ran new unittests Review URL: http://codereview.chromium.org/9315006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121248 0039d316-1c4b-4281-b951-d872f2087c98
* chrome: dbus: add default MessageReader constructorkeybuk@chromium.org2012-02-073-24/+28
| | | | | | | | | | | | | | | | | | | | | There's no need for a dbus::MessageReader to be initialized with a message, the underlying DBusMessageIter is fully initialized by dbus_message_iter_recurse() as called by PopArray, etc. This allows for: dbus::MessageReader reader; other_reader->PopArray(&reader); BUG=none TEST=verified with arrays, variants and dictionary types. Change-Id: Id4a9d2de2b28ec3a2da42f822934a39865d9e9ef Review URL: http://codereview.chromium.org/9342009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120864 0039d316-1c4b-4281-b951-d872f2087c98
* Convert use of int ms to TimeDelta in files owned by brettw.tedvessenes@gmail.com2012-01-271-2/+2
| | | | | | | | | | BUG=108171 TEST= Review URL: http://codereview.chromium.org/9233018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119321 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 117824 - Convert use of int ms to TimeDelta in files owned by brettw.hbono@chromium.org2012-01-161-2/+2
| | | | | | | | | | | | | | | | | | | | This change broke Linux and Mac bots. I would recommend to ask committers to run your next change on trybots. (*1) http://chromegw.corp.google.com/i/chromium/builders/Mac/builds/10788/steps/compile/logs/stdio (*2) http://chromegw.corp.google.com/i/chromium/builders/Linux/builds/19313/steps/compile/logs/stdio (*3) http://chromegw.corp.google.com/i/chromium/builders/Linux%20x64/builds/21385/steps/compile/logs/stdio R=brettw@chromium.org BUG=108171 TEST= Review URL: http://codereview.chromium.org/9185026 TBR=tedvessenes@gmail.com Review URL: http://codereview.chromium.org/9215005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117825 0039d316-1c4b-4281-b951-d872f2087c98
* Convert use of int ms to TimeDelta in files owned by brettw.tedvessenes@gmail.com2012-01-161-2/+2
| | | | | | | | | | | R=brettw@chromium.org BUG=108171 TEST= Review URL: http://codereview.chromium.org/9185026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117824 0039d316-1c4b-4281-b951-d872f2087c98
* Fix flaky tests in EndToEndAsyncTest in dbus_unittests.satorux@chromium.org2011-12-131-4/+5
| | | | | | | | | | | | | | | | We should wait for signal connection, for each signal. Otherwise, 2nd call to OnConnected() may quit the message loop instead of OnTestSignal(). FWIW, the flakiness was introduced in crrev.com/111423 BUG=106796,107301 TEST=confirm the test no longer fails by: while true; do out/Release/dbus_unittests --gtest_filter=EndToEndAsyncTest.TestSignal || break ; done Review URL: http://codereview.chromium.org/8907010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114223 0039d316-1c4b-4281-b951-d872f2087c98
* Mark EndToEndAsyncTest.TestSignal as flakywillchan@chromium.org2011-12-131-1/+2
| | | | | | | | | | BUG=107301 TEST=none Review URL: http://codereview.chromium.org/8926009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114166 0039d316-1c4b-4281-b951-d872f2087c98
* Mark dbus EndToEndAsyncTest.TestSignalFromRoot flakyarthurhsu@chromium.org2011-12-081-1/+2
| | | | | | | | | BUG=106796 TEST=none Review URL: http://codereview.chromium.org/8866009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113516 0039d316-1c4b-4281-b951-d872f2087c98
* chrome: dbus: support asynchronous method repliesvlaviano@chromium.org2011-11-306-32/+117
| | | | | | | | | | | | BUG=chromium-os:23241 TEST=Unit tests and manual testing on device. Change-Id: Iab009ddbd12dea1e12299ae0ddccd4e430d9cf97 Review URL: http://codereview.chromium.org/8728020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112131 0039d316-1c4b-4281-b951-d872f2087c98
* CrOS: Remove a DCHECK causing test failures in DBus on Aurajamescook@chromium.org2011-11-241-1/+4
| | | | | | | | | | | | The tests run fine without this check, and we've filed a bug to investigate further. BUG=chromium-os:23416 TEST=browser_tests Review URL: http://codereview.chromium.org/8682028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111498 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 111479 - chrome: dbus: support asynchronous method repliesthestig@chromium.org2011-11-246-117/+32
| | | | | | | | | | | | | | | BUG=chromium-os:23241 TEST=Unit tests and manual testing on device. Change-Id: I4d665897687030f4ab2379e4f6ddb9b3ebe02af4 Review URL: http://codereview.chromium.org/8637002 TBR=vlaviano@chromium.org Review URL: http://codereview.chromium.org/8682032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111487 0039d316-1c4b-4281-b951-d872f2087c98
* chrome: dbus: support asynchronous method repliesvlaviano@chromium.org2011-11-246-32/+117
| | | | | | | | | | | | BUG=chromium-os:23241 TEST=Unit tests and manual testing on device. Change-Id: I4d665897687030f4ab2379e4f6ddb9b3ebe02af4 Review URL: http://codereview.chromium.org/8637002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111479 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Fix a bug where we were emitting spurious error messages.satorux@chromium.org2011-11-233-13/+42
| | | | | | | | | | | | | | Error messages like "Requested to remove an unknown match rule: type='signal', interface='...'" were emitted at shutdown of Bus object if an object proxy was connected to more than one signal of the same interface. TEST=changed the end_to_end_async_unittest to reproduce this bug, and confirm that the error messages were gone after fixing object_proxy.{cc,h} BUG=chromium-os:23382 Review URL: http://codereview.chromium.org/8681002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111423 0039d316-1c4b-4281-b951-d872f2087c98
* Add OVERRIDE to base/, dbus/.avi@chromium.org2011-11-231-1/+1
| | | | | | | | | BUG=104314 TEST=no change Review URL: http://codereview.chromium.org/8684001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111411 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup: Remove unneeded forward declarations in base, dbug, gpu, ipc, ↵thestig@chromium.org2011-11-152-8/+5
| | | | | | | | | | jingle, and media. BUG=none TEST=none Review URL: http://codereview.chromium.org/8511045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109998 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Add ObjectProxy::EmptyResponseCallback().satorux@chromium.org2011-11-113-4/+42
| | | | | | | | | | | | | This can be used when the caller is not interested in the response from the D-bus method. BUG=none TEST=added a unit test Review URL: http://codereview.chromium.org/8536007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109598 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Fix a bug where we rejected an empty array in PopArrayOfBytes()satorux@chromium.org2011-11-112-1/+22
| | | | | | | | | | | | | An empty array should be allowed. Sometimes, you need to send an empty array from methods and signals. BUG=103793 TEST=added a test in dbus_unittests Review URL: http://codereview.chromium.org/8525012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109561 0039d316-1c4b-4281-b951-d872f2087c98
* Thread::Stop() must be called before any subclass's destructor completes.joi@chromium.org2011-11-021-0/+1
| | | | | | | | | | | Update base::Thread documentation, fix all subclasses I could find that had a problem, and remove no-longer-necessary suppressions. BUG=102134 Review URL: http://codereview.chromium.org/8427007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108296 0039d316-1c4b-4281-b951-d872f2087c98
* Make sure the dependency on base is exported to components that depend on dbus.sadrul@chromium.org2011-10-301-0/+3
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/8414048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107900 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Silence VLOG(1) spam from ObjectProxy::HandleMessage().satorux@chromium.org2011-10-141-2/+1
| | | | | | | | | | | | Having VLOG(1) there resulted in log spam from all objectProxy objects that connected to some signal. BUG=none TEST=dbus_unittests Review URL: http://codereview.chromium.org/8296005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105597 0039d316-1c4b-4281-b951-d872f2087c98
* Make ExportedObject and ObjectProxy own Bus as scoped_refptr.satorux@chromium.org2011-10-134-2/+12
| | | | | | | | | | | | | | | | They should own Bus as scoped_refptr, rather than raw pointer. Otherwise, they may reference |bus_| after Bus is deleted. I know this is convoluted. I'm planning to minimize use of scoped_refptr from dbus/* but this change is necessary until then. TEST=run dbus_unittest under valgrind and confirm no memory leaks BUG=chromium-os:21379 Review URL: http://codereview.chromium.org/8201023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105222 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Eliminate an irrelevant LOG(ERROR) from Bus::AddMatch().satorux@chromium.org2011-10-122-2/+3
| | | | | | | | | | | | | | Clients of the library cannot tell if a match rule has been already added or not (we could expose such a function but not so useful). Hence LOG(ERROR) is irrelevant here. Also update the comment in bus.h. TEST=dbus_unittests BUG=none Review URL: http://codereview.chromium.org/8223021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105205 0039d316-1c4b-4281-b951-d872f2087c98
* Eliminate a timed wait from ExportedObject::HandleMessage().satorux@chromium.org2011-10-074-44/+57
| | | | | | | | | | | | | | | | | Previouslly, we blocked in D-Bus thread until the method call is handled in the UI thread. Turned out this was a bad idea, and caused a crash when the UI thread is hanging (crosbug.com/21341). This patch will eliminate the timed wait and incoming methods will be handled completely asynchronously. BUG=chromium-os:21341 TEST=run dbus_unittests under valgrind Review URL: http://codereview.chromium.org/8175009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104497 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a bug in dbus::Bus::AddFilterFunction().satorux@chromium.org2011-10-064-20/+70
| | | | | | | | | | | We should not reject the same function if it's associated with different data. BUG=99258 TEST=adde a unit test and confirmed it passed. Review URL: http://codereview.chromium.org/8161005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104208 0039d316-1c4b-4281-b951-d872f2087c98
* Eliminate hacks needed to work around a limitation of base::Bind()satorux@chromium.org2011-10-044-25/+11
| | | | | | | | | | | | | base::Bind() used to be unable to handle opaque type pointers, but the limitation was fixed in crrev.com/103627. BUG=crosbug.com/21166 TEST=build and run dbus_unittests Review URL: http://codereview.chromium.org/8124002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103881 0039d316-1c4b-4281-b951-d872f2087c98
* Linux: add two new DBus client library utility functions, to be used by KWallet.mdm@chromium.org2011-09-193-7/+66
| | | | | | | | The new functions are AppendArrayOfStrings and PopArrayOfStrings, which have self-explanatory names. Currently the KWallet code does this looping itself. Review URL: http://codereview.chromium.org/7941009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101781 0039d316-1c4b-4281-b951-d872f2087c98
* Stop restricting the sender object path for incoming signals.satorux@chromium.org2011-09-144-6/+46
| | | | | | | | | | | | | | | | | | Restricting the sender path makes it impossible to test signal handling with dbus-send --type=signal, as it uses "/" as the sender object path. For now, let's remove the restriction. We can make this restriction customizable when it becomes necessary. This is for http://codereview.chromium.org/7862020/ TEST=dbus_unittests BUG=none Review URL: http://codereview.chromium.org/7845029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101171 0039d316-1c4b-4281-b951-d872f2087c98
* Use MessageLoopProxy for the origin message loop as well.satorux@chromium.org2011-09-082-11/+31
| | | | | | | | | | | | | Inspired by mdm's patch to use the message loop proxy for the D-Bus thread. Using MessageLoopProxy is a great way to make shutdown safer. We should use this for the origin message loop as well. BUG=chromium:90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7847013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100279 0039d316-1c4b-4281-b951-d872f2087c98
* Add some histograms to the D-Bus library:satorux@chromium.org2011-09-065-21/+90
| | | | | | | | | | | | | | | | | | - DBus.SyncMethodCallTime: time spent to perform synchronos method calls - DBus.AsyncMethodCallTime: time spent to perform asynchronos method calls - DBus.SyncMethodCallSuccess: success ratio of synchronous method calls - DBus.AsyncMethodCallSuccess: success ratio of asynchronous method calls - DBus.ExportedMethodHandleTime: time spent to handle calls to export methods - DBus.ExportedMethodHandleSuccess: success ratio of the exported method calls - DBus.SignalHandleTime: time spent to handle signals - DBus.SignalSendTime: time spent to send signals BUG=chromium:90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7824054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99811 0039d316-1c4b-4281-b951-d872f2087c98
* Linux: use MessageLoopProxy instead of base::Thread in our DBus client library. mdm@chromium.org2011-09-067-45/+40
| | | | | | | | | This allows us to use BrowserThread::GetMessageLoopProxyForThread() to specify the DBus thread. Also do a little bit of unrelated comment cleanup. BUG=90036 Review URL: http://codereview.chromium.org/7800023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99794 0039d316-1c4b-4281-b951-d872f2087c98
* Add Bus::ShutdownOnDBusThreadAndBlock() and remove bus::Shutdown()satorux@chromium.org2011-09-028-70/+92
| | | | | | | | | | | | | | | | This function is intended to use at the the very end of the browser shutdown, where it it makes more sense to shut down the bus synchronously, than trying to make it asynchronous. Remove Bus::Shutdown() as we are unlikely to need it for the production code. BUG=chromium:90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7830009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99331 0039d316-1c4b-4281-b951-d872f2087c98
* Fix typos in the D-Bus library.satorux@chromium.org2011-08-317-17/+17
| | | | | | | | | | | | Just wanted to remove the blank line in bus.h, but fixed typos along the way. BUG=chromium:90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7792049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99006 0039d316-1c4b-4281-b951-d872f2087c98
* Minor cleanups and improvements for the D-Bus library.satorux@chromium.org2011-08-276-15/+35
| | | | | | | | | | | | | | | | | - Add mock_export_object.{cc,h} to dbus.gyp, which were missing. - Add a comment about shutdown of Bus in bus.h. - Update mock_unittest.cc to call ShutdownAndBlock(). - Replace DCHECKs with LOG(ERROR)s followed by early exit. - Add virtual to SetUp() and TearDown() in tests. - Renamed a member variable to make it clearer. BUG=chromium:90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7745044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98560 0039d316-1c4b-4281-b951-d872f2087c98
* Add mock classes for Bus, ObjectProxy, and ExportedObject.satorux@chromium.org2011-08-2511-7/+411
| | | | | | | | | | | | 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
* Fix design shortcomings in Message classes.satorux@chromium.org2011-08-246-202/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Prohibit to instantiate Message class. Rationale: this is not corresponding to any D-Bus message types. - Get rid of Message::reset_raw_message() Rationale: this was breaking encapsulation. For instance, It was possible to inject a DBUS_MESSAGE_TYPE_ERROR raw message to a MethodCall message, which should not be allowed. - Prohibit to instantiate Response/ErrorResponse with NULL raw message. Rationale: Message objects should be backed up by valid raw messages. - Change Object::CallMethodAndBlock() to return Response*. Rationale: the original API requred a Response object with raw_message_ set to NULL, which we no longer allow. - Add message_type header to ToString(). BUG=90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7709009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97983 0039d316-1c4b-4281-b951-d872f2087c98
* Reuse existing object proxies and exported objects, if these exist.satorux@chromium.org2011-08-234-16/+118
| | | | | | | | | | | | The Bus object shouldn't return new objects if the bus object already owns the requested object proxies, or the exported objects. BUG=90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7702001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97898 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for sending and receiving D-Bus signals.satorux@chromium.org2011-08-2312-18/+599
| | | | | | | | | | | | | | | | ObjectProxy is used to receive signals from the remote object. ExportedObject is used to send signals from the exported object. Note that signals are asynchronos so we don't have a test in end_to_end_sync_unittest.cc BUG=90036 TEST=run unit tests Review URL: http://codereview.chromium.org/7655033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97831 0039d316-1c4b-4281-b951-d872f2087c98
* Add AppendArrayOfObjectPaths, which was missing.satorux@chromium.org2011-08-223-0/+36
| | | | | | | | | | | It was an oversight not to have this function. BUG=90036 TEST=dbus_unittests Review URL: http://codereview.chromium.org/7686013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97689 0039d316-1c4b-4281-b951-d872f2087c98