Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: webrtc/rtc_base/messagequeue_unittest.cc

Issue 2968753002: Support re-entrant calls to MessageQueueManager::Clear. (Closed)
Patch Set: Rebased Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/rtc_base/messagequeue.cc ('K') | « webrtc/rtc_base/messagequeue.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/rtc_base/messagequeue_unittest.cc
diff --git a/webrtc/rtc_base/messagequeue_unittest.cc b/webrtc/rtc_base/messagequeue_unittest.cc
index 78bcfcbea9abbf6070285dde1dc73d9f81cb2ccd..679f95ca8a6f95598b1059b1f45d03a8651aba0b 100644
--- a/webrtc/rtc_base/messagequeue_unittest.cc
+++ b/webrtc/rtc_base/messagequeue_unittest.cc
@@ -18,6 +18,8 @@
#include "webrtc/rtc_base/gunit.h"
#include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/nullsocketserver.h"
+#include "webrtc/rtc_base/refcount.h"
+#include "webrtc/rtc_base/refcountedobject.h"
#include "webrtc/rtc_base/thread.h"
#include "webrtc/rtc_base/timeutils.h"
@@ -215,3 +217,23 @@ TEST(MessageQueueManager, ProcessAllMessageQueuesWithClearedQueue) {
rtc::Thread::Current()->Post(RTC_FROM_HERE, &event_signaler);
MessageQueueManager::ProcessAllMessageQueues();
}
+
+class RefCountedHandler
+ : public MessageHandler,
+ public rtc::RefCountInterface {
+ public:
+ void OnMessage(Message* msg) override {}
+};
+
+class EmptyHandler : public MessageHandler {
+ public:
+ void OnMessage(Message* msg) override {}
+};
+
+TEST(MessageQueueManager, ClearReentrant) {
Taylor Brandstetter 2017/07/05 22:41:48 Can you leave a comment summarizing how this test
joachim 2017/07/05 23:03:11 Done.
Taylor Brandstetter 2017/07/06 15:51:09 That's what I'm talking about. The thread's messag
joachim 2017/07/06 16:54:57 Ah sorry, that was a misunderstanding then - updat
+ Thread t;
+ EmptyHandler handler;
+ t.Post(RTC_FROM_HERE, &handler, 0,
+ new ScopedRefMessageData<RefCountedHandler>(
+ new rtc::RefCountedObject<RefCountedHandler>()));
+}
« webrtc/rtc_base/messagequeue.cc ('K') | « webrtc/rtc_base/messagequeue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698