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

Unified Diff: Source/core/page/NetworkStateNotifierTest.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/core/page/NetworkStateNotifierTest.cpp
diff --git a/Source/core/page/NetworkStateNotifierTest.cpp b/Source/core/page/NetworkStateNotifierTest.cpp
index 67dc76f5b2d05c9747c6687e66b2e81c95359486..0e795b47420404bb5e8d63a8fee296e22275fda5 100644
--- a/Source/core/page/NetworkStateNotifierTest.cpp
+++ b/Source/core/page/NetworkStateNotifierTest.cpp
@@ -32,6 +32,7 @@
#include "core/page/NetworkStateNotifier.h"
#include "core/dom/Document.h"
+#include "core/testing/UnitTestHelpers.h"
#include "public/platform/Platform.h"
#include "public/platform/WebConnectionType.h"
#include "public/platform/WebThread.h"
@@ -78,23 +79,7 @@ private:
int m_callbackCount;
};
-class ExitTask
- : public blink::WebThread::Task {
-public:
- ExitTask(blink::WebThread* thread)
- : m_thread(thread)
- {
- }
- virtual void run() override
- {
- m_thread->exitRunLoop();
- }
-
-private:
- blink::WebThread* m_thread;
-};
-
-class NetworkStateNotifierTest : public testing::Test {
+class NetworkStateNotifierTest : public ::testing::Test {
public:
NetworkStateNotifierTest()
: m_document(Document::create())
@@ -116,10 +101,7 @@ protected:
void setType(blink::WebConnectionType type)
{
m_notifier.setWebConnectionType(type);
-
- blink::WebThread* thread = blink::Platform::current()->currentThread();
- thread->postTask(FROM_HERE, new ExitTask(thread));
- thread->enterRunLoop();
+ testing::runPendingTasks();
}
void addObserverOnNotification(StateObserver* observer, StateObserver* observerToAdd)

Powered by Google App Engine
This is Rietveld 408576698