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

Unified Diff: third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp

Issue 1656673003: Factor out MockThreadableLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added an include guard Created 4 years, 11 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: third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
index b79f4ea2e6f87910c434df582563b098a14f3e1b..a23ea8cfd725ac9b3cfe11ce8d4451c81331e7d7 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
@@ -6,13 +6,14 @@
#include "core/dom/DOMTypedArray.h"
#include "core/html/FormData.h"
-#include "core/loader/ThreadableLoader.h"
+#include "core/loader/MockThreadableLoader.h"
#include "core/loader/ThreadableLoaderClient.h"
#include "core/testing/DummyPageHolder.h"
#include "modules/fetch/DataConsumerHandleTestUtil.h"
#include "platform/network/ResourceResponse.h"
#include "platform/testing/UnitTestHelpers.h"
#include "platform/weborigin/KURL.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
@@ -42,20 +43,14 @@ String toString(const Vector<char>& data)
return String(data.data(), data.size());
}
-class NoopLoader final : public ThreadableLoader {
-public:
- static PassRefPtr<ThreadableLoader> create() { return adoptRef(new NoopLoader); }
- void overrideTimeout(unsigned long) override {}
- void cancel() override {}
-};
-
class LoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory {
public:
explicit LoaderFactory(PassOwnPtr<WebDataConsumerHandle> handle) : m_handle(handle) {}
PassRefPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient* client, const ResourceRequest&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override
{
- RefPtr<ThreadableLoader> loader = NoopLoader::create();
+ RefPtr<MockThreadableLoader> loader = MockThreadableLoader::create();
client->didReceiveResponse(0, ResourceResponse(), m_handle.release());
+ EXPECT_CALL(*loader, cancel()).Times(1);
hiroshige 2016/02/05 05:42:09 nit: perhaps it would be better to place EXPECT_CA
tyoshino (SeeGerritForStatus) 2016/02/05 07:22:10 I see. Fixed
return loader.release();
}

Powered by Google App Engine
This is Rietveld 408576698