Correct implementation of the ability to observe and modify resource redirects (issue #346).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@419 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-12-15 14:47:23 +00:00
parent bd84c988cf
commit 2bbd89f97d
8 changed files with 321 additions and 75 deletions

View File

@@ -6,6 +6,7 @@
#define _TEST_HANDLER_H
#include "include/cef.h"
#include "include/cef_runnable.h"
#include "base/synchronization/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -186,4 +187,22 @@ private:
IMPLEMENT_LOCKING(TestHandler);
};
static void NotifyEvent(base::WaitableEvent* event)
{
event->Signal();
}
// Post a task to the specified thread and wait for the task to execute as
// indication that all previously pending tasks on that thread have completed.
static void WaitForThread(CefThreadId thread_id)
{
base::WaitableEvent event(true, false);
CefPostTask(thread_id, NewCefRunnableFunction(&NotifyEvent, &event));
event.Wait();
}
#define WaitForIOThread() WaitForThread(TID_IO)
#define WaitForUIThread() WaitForThread(TID_UI)
#endif // _TEST_HANDLER_H