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

Unified Diff: Source/web/tests/FrameTestHelpers.cpp

Issue 962053003: tests: Use runPendingTasks instead of WebThread::enterRunLoop()/exitRunLoop() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 years, 10 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
Index: Source/web/tests/FrameTestHelpers.cpp
diff --git a/Source/web/tests/FrameTestHelpers.cpp b/Source/web/tests/FrameTestHelpers.cpp
index 77dfd071132810570cea429fb631f08142142706..ae5bbbc373c31e14d4b54952d4a82173c654ce24 100644
--- a/Source/web/tests/FrameTestHelpers.cpp
+++ b/Source/web/tests/FrameTestHelpers.cpp
@@ -32,6 +32,7 @@
#include "web/tests/FrameTestHelpers.h"
#include "core/testing/URLTestHelpers.h"
+#include "core/testing/UnitTestHelpers.h"
#include "public/platform/Platform.h"
#include "public/platform/WebData.h"
#include "public/platform/WebString.h"
@@ -69,23 +70,6 @@ TestWebFrameClient* testClientForFrame(WebFrame* frame)
return static_cast<TestWebFrameClient*>(toWebLocalFrameImpl(frame)->client());
}
-class QuitTask : public WebThread::Task {
-public:
- void PostThis(Timer<QuitTask>*)
- {
- // We don't just quit here because the SharedTimer may be part-way
- // through the current queue of tasks when runPendingTasks was called,
- // and we can't miss the tasks that were behind it.
- // Takes ownership of |this|.
- Platform::current()->currentThread()->postTask(FROM_HERE, this);
- }
-
- virtual void run()
- {
- Platform::current()->currentThread()->exitRunLoop();
- }
-};
-
class ServeAsyncRequestsTask : public WebThread::Task {
public:
explicit ServeAsyncRequestsTask(TestWebFrameClient* client)
@@ -243,15 +227,6 @@ void pumpPendingRequestsDoNotUse(WebFrame* frame)
pumpPendingRequests(frame);
}
-// FIXME: There's a duplicate implementation in UnitTestHelpers.cpp. Remove one.
-void runPendingTasks()
-{
- // Pending tasks include Timers that have been scheduled.
- Timer<QuitTask> quitOnTimeout(new QuitTask, &QuitTask::PostThis);
- quitOnTimeout.startOneShot(0, FROM_HERE);
- Platform::current()->currentThread()->enterRunLoop();
-}
-
WebViewHelper::WebViewHelper()
: m_webView(0)
{
@@ -337,7 +312,7 @@ void TestWebFrameClient::waitForLoadToComplete()
// runPendingTasks may not be enough.
// runPendingTasks only ensures that main thread task queue is empty,
// and asynchronous parsing make use of off main thread HTML parser.
- FrameTestHelpers::runPendingTasks();
+ testing::runPendingTasks();
if (!isLoading())
break;

Powered by Google App Engine
This is Rietveld 408576698