summaryrefslogtreecommitdiffstats
path: root/dbus/bus_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Allow Chromium's DBus service ownership to be stealablecmasone@chromium.org2013-07-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | We've seen some cases in tests where a Chromium process winds up in a temporarily unkillable state, causing the dbus-daemon to believe that it still actively owns org.chromium.LibCrosService. This makes attempts to restart the UI fail, as the browser dies when it cannot take ownership of this service name. The reason it can't is because Chromium currently doesn't allow other processes to steal ownership -- and the unkillable process is holding onto the token. This can be remedied by providing certain options when ownership of the service name is taken, options that allow other processes to seize ownership if they so choose. The ramifications of this are discussed further in the bug. BUG=chromium:261381 TEST=new unit test in dbus_unittest TEST=run the following as chronos on a device: "gdbus call --system --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.RequestName org.chromium.LibCrosService 7" TEST=This should return (uint32 1,) Review URL: https://chromiumcodereview.appspot.com/20555003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214589 0039d316-1c4b-4281-b951-d872f2087c98
* Use a direct include of the message_loop header in dbus/, device/, ↵avi@chromium.org2013-07-171-1/+1
| | | | | | | | | | | | extensions/, google_apis/, gpu/, ipc/, jingle/. BUG=260807 TEST=none TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/19607005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212157 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup: Put DBus unit tests in the dbus namespace, so one does not need to ↵thestig@chromium.org2013-06-131-56/+60
| | | | | | | | write dbus:: everywhere. Remove some other dbus:: usages in the dbus namespace. Review URL: https://chromiumcodereview.appspot.com/16012018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206010 0039d316-1c4b-4281-b951-d872f2087c98
* Linux/CrOS: Listen for mtpd service owner change events and communicate with ↵thestig@chromium.org2013-06-101-0/+122
| | | | | | | | | | | | | the new service owner. The mtpd dbus service may not start right away. Any attempts to use it may be racy due to the lack of a service owner. Listening for service owner changes fixes this race. BUG=241302 TEST=Manual, see bug for repro case. Review URL: https://chromiumcodereview.appspot.com/15741025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205331 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: Use base::MessageLoop.xhwang@chromium.org2013-05-011-4/+4
| | | | | | | | | BUG=236029 R=keybuk@chromium.org Review URL: https://chromiumcodereview.appspot.com/14386016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197629 0039d316-1c4b-4281-b951-d872f2087c98
* DBus: Use TaskRunners instead of MessageLoopProxies.thestig@chromium.org2013-02-201-3/+3
| | | | | | Review URL: https://chromiumcodereview.appspot.com/12255043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183362 0039d316-1c4b-4281-b951-d872f2087c98
* DBus: Bus::AddMatch and RemoveMatch support repeated rules.deymo@chromium.org2013-01-311-0/+40
| | | | | | | | | | | | | | This fix counts the number of times the same rule is added to a dbus::Bus and removes the rule from the real DBus connection when all the copies of the same match rule have been removed. BUG=chromium:173054 TEST=BusTest.DoubleAddAndRemoveMatch passes. Review URL: https://chromiumcodereview.appspot.com/12088068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179809 0039d316-1c4b-4281-b951-d872f2087c98
* D-Bus: ObjectProxy remove function for Bus object.deymo@chromium.org2013-01-291-0/+59
| | | | | | | | | | | | | | | | This implements a remove function for an ObjectProxy owned by a bus object. Although the Bus object removes all the objects at shutdown, this functions permits to reduce the memory usage for objects no longer needed and reduce the number of dbus matching rules used in the bus connection. BUG=chromium:170182 TEST=BusTest.RemoveObjectProxy (run out/Debug/dbus_unittests) Review URL: https://chromiumcodereview.appspot.com/12022004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179400 0039d316-1c4b-4281-b951-d872f2087c98
* DBus: Fixes a flaky test case.deymo@chromium.org2013-01-241-3/+11
| | | | | | | | | | | | | | | | | | In the UnregisterExportedObject test, an ExportedObject is created, destroyed and created again as a new object. The test assumes the new object is different from the first one just comparing the memory pointers to those objects. Nevertheless, the memory manager could possibly alloc the same memory address for the second object since the first one was already destroyed. This fixes this situation preventing the first object from being destroyed incrementing its reference count. BUG=chromium:137846 TEST=test enabled. Review URL: https://chromiumcodereview.appspot.com/12039033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178450 0039d316-1c4b-4281-b951-d872f2087c98
* GTTF: No more FLAKY_ .phajdan.jr@chromium.org2012-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Please note that FLAKY_ tests have been ignored anyway. When tests started crashing, people just flipped that to DISABLED_ . Why not go straight to DISABLED_ then, so that we avoid wasting time on stupid test prefix games? With DISABLED_ it is clear to everyone that there is no coverage from given test. FLAKY_ creates an illusion of coverage, while in fact the test is still ignored. If a FLAKY_ test fails and nobody notices, does it still make a sound? ;-) Finally, note that gtest has a --gtest_also_run_disabled_tests if you need to run tests manually. TBR=jam BUG=none Review URL: https://codereview.chromium.org/11664013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174472 0039d316-1c4b-4281-b951-d872f2087c98
* Marking BusTest.UnregisterExportedObject as flakyjochen@chromium.org2012-07-181-1/+2
| | | | | | | | | | BUG=137846 TEST=none TBR=keybuk@chromium.org Review URL: https://chromiumcodereview.appspot.com/10797009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147234 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: allow unregistering of exported objectskeybuk@chromium.org2012-03-141-0/+31
| | | | | | | | | | | | | | | | Not all objects are permanent, some are transient and if we ever re-use the object path, we want a new instance of the exported object to be created rather than re-use an existing one. BUG=chromium-os:21320 TEST=dbus_unittests and included change to agent service provider Change-Id: I09882bbe2f70356182ac301c4260473051333424 Review URL: http://codereview.chromium.org/9691025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126527 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: remove service name from ExportedObjectkeybuk@chromium.org2012-03-101-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | Well-known names in D-Bus are merely aliases to unique connection ids maintained by the bus, they have no purpose in qualifying object paths or interfaces and it's perfectly legimiate for a client to make requests to the unique connection id (e.g. in response to a signal, which does not reference the well-known name of the origin connection). Remove the service_name member from dbus::ExportedObject, from its constructor and from dbus::Bus::GetExportedObject and require code to call dbus::Bus::RequestOwnership if a well-known name is desired. This requires making that function callable from the origin thread with a callback for the return value. BUG=chromium-os:27101 TEST=dbus_unittests Change-Id: Ib91de8b68ad9c3b432e224a2c715f0c2ca1af463 Review URL: http://codereview.chromium.org/9668018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125970 0039d316-1c4b-4281-b951-d872f2087c98
* dbus: add ObjectPath typekeybuk@google.com2012-02-141-11/+14
| | | | | | | | | | | | | | | | | | 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-141-14/+11
| | | | | | | | | | | | | | | | | | | | 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-141-11/+14
| | | | | | | | | | | | | | | | | 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
* Allow dbus clients to silence logging when a service is unavailable.adamk@chromium.org2012-02-101-1/+33
| | | | | | | | 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
* Make ExportedObject and ObjectProxy own Bus as scoped_refptr.satorux@chromium.org2011-10-131-0/+4
| | | | | | | | | | | | | | | | 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
* Fix a bug in dbus::Bus::AddFilterFunction().satorux@chromium.org2011-10-061-0/+32
| | | | | | | | | | | 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
* Linux: use MessageLoopProxy instead of base::Thread in our DBus client library. mdm@chromium.org2011-09-061-1/+1
| | | | | | | | | 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-021-0/+32
| | | | | | | | | | | | | | | | 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
* Reuse existing object proxies and exported objects, if these exist.satorux@chromium.org2011-08-231-0/+59
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