summaryrefslogtreecommitdiffstats
path: root/chrome/test/ui_test_utils.h
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-23 22:29:09 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-23 22:29:09 +0000
commit02e916564377084a66da758a7ff42ad4eaf10626 (patch)
tree0098a7d2a8f63d6991bcdca0b99ddcdc5ca1e159 /chrome/test/ui_test_utils.h
parentd5c23bed766a0182441bfe487345c1fa448cfe82 (diff)
downloadchromium_src-02e916564377084a66da758a7ff42ad4eaf10626.zip
chromium_src-02e916564377084a66da758a7ff42ad4eaf10626.tar.gz
chromium_src-02e916564377084a66da758a7ff42ad4eaf10626.tar.bz2
Changes ui_test_utils::WindowedNotificationObserver to allow Wait to
work for any source. BUG=none TEST=none R=phajdan.jr@chromium.org Review URL: http://codereview.chromium.org/6722027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui_test_utils.h')
-rw-r--r--chrome/test/ui_test_utils.h48
1 files changed, 25 insertions, 23 deletions
diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h
index c896dc4..42e5542 100644
--- a/chrome/test/ui_test_utils.h
+++ b/chrome/test/ui_test_utils.h
@@ -393,40 +393,42 @@ class TestNotificationObserver : public NotificationObserver {
// signal.Wait()
class WindowedNotificationObserver : public NotificationObserver {
public:
- /* Register to listen for notifications of the given type from either
- * a specific source, or from all sources if |source| is
- * NotificationService::AllSources(). */
+ // Register to listen for notifications of the given type from either a
+ // specific source, or from all sources if |source| is
+ // NotificationService::AllSources().
WindowedNotificationObserver(NotificationType notification_type,
const NotificationSource& source);
virtual ~WindowedNotificationObserver();
- /* Wait until the specified notification occurs. You must have specified a
- * source in the arguments to the constructor in order to use this function.
- * Otherwise, you should use WaitFor. */
+ // Wait until the specified notification occurs. If the notification was
+ // emitted between the construction of this object and this call then it
+ // returns immediately.
void Wait();
- /* WaitFor waits until the given notification type is received from the
- * given object. If the notification was emitted between the construction of
- * this object and this call then it returns immediately.
- *
- * Beware that this is inheriently plagued by ABA issues. Consider:
- * WindowedNotificationObserver is created, listening for notifications from
- * all sources
- * Object A is created with address x and fires a notification
- * Object A is freed
- * Object B is created with the same address
- * WaitFor is called with the address of B
- *
- * In this case, WaitFor will return immediately because of the
- * notification from A (because they shared an address), despite being
- * different objects.
- */
+ // WaitFor waits until the given notification type is received from the
+ // given object. If the notification was emitted between the construction of
+ // this object and this call then it returns immediately.
+ //
+ // Use this variant when you supply AllSources to the constructor but want
+ // to wait for notification from a specific observer.
+ //
+ // Beware that this is inheriently plagued by ABA issues. Consider:
+ // WindowedNotificationObserver is created, listening for notifications from
+ // all sources
+ // Object A is created with address x and fires a notification
+ // Object A is freed
+ // Object B is created with the same address
+ // WaitFor is called with the address of B
+ //
+ // In this case, WaitFor will return immediately because of the
+ // notification from A (because they shared an address), despite being
+ // different objects.
void WaitFor(const NotificationSource& source);
// NotificationObserver:
virtual void Observe(NotificationType type,
const NotificationSource& source,
- const NotificationDetails& details);
+ const NotificationDetails& details) OVERRIDE;
private:
bool seen_;