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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp

Issue 1264453002: Split the constructor of ThreadableLoader into two methods (ctor and start()) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/fetch/FetchFormDataConsumerHandle.h" 5 #include "modules/fetch/FetchFormDataConsumerHandle.h"
6 6
7 #include "core/dom/DOMTypedArray.h" 7 #include "core/dom/DOMTypedArray.h"
8 #include "core/html/FormData.h" 8 #include "core/html/FormData.h"
9 #include "core/loader/ThreadableLoader.h" 9 #include "core/loader/ThreadableLoader.h"
10 #include "core/loader/ThreadableLoaderClient.h" 10 #include "core/loader/ThreadableLoaderClient.h"
(...skipping 27 matching lines...) Expand all
38 using Command = DataConsumerHandleTestUtil::Command; 38 using Command = DataConsumerHandleTestUtil::Command;
39 39
40 String toString(const Vector<char>& data) 40 String toString(const Vector<char>& data)
41 { 41 {
42 return String(data.data(), data.size()); 42 return String(data.data(), data.size());
43 } 43 }
44 44
45 class NoopLoader final : public ThreadableLoader { 45 class NoopLoader final : public ThreadableLoader {
46 public: 46 public:
47 static PassRefPtr<ThreadableLoader> create() { return adoptRef(new NoopLoade r); } 47 static PassRefPtr<ThreadableLoader> create() { return adoptRef(new NoopLoade r); }
48 void start(const ResourceRequest&) override {}
48 void overrideTimeout(unsigned long) override {} 49 void overrideTimeout(unsigned long) override {}
49 void cancel() override {} 50 void cancel() override {}
50 }; 51 };
51 52
52 class LoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory { 53 class LoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory {
53 public: 54 public:
54 explicit LoaderFactory(PassOwnPtr<WebDataConsumerHandle> handle) : m_handle( handle) {} 55 explicit LoaderFactory(PassOwnPtr<WebDataConsumerHandle> handle) : m_handle( handle) {}
55 PassRefPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClien t* client, const ResourceRequest&, const ThreadableLoaderOptions&, const Resourc eLoaderOptions&) override 56 PassRefPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClien t* client, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) overrid e
56 { 57 {
57 RefPtr<ThreadableLoader> loader = NoopLoader::create(); 58 RefPtr<ThreadableLoader> loader = NoopLoader::create();
58 client->didReceiveResponse(0, ResourceResponse(), m_handle.release()); 59 client->didReceiveResponse(0, ResourceResponse(), m_handle.release());
hiroshige 2016/01/26 08:44:50 Please call didReceiveResponse() in NoopLoader::st
tyoshino (SeeGerritForStatus) 2016/01/29 12:36:52 Oh, good point. Fixed.
59 return loader.release(); 60 return loader.release();
60 } 61 }
61 62
62 private: 63 private:
63 OwnPtr<WebDataConsumerHandle> m_handle; 64 OwnPtr<WebDataConsumerHandle> m_handle;
64 }; 65 };
65 66
66 class FetchFormDataConsumerHandleTest : public ::testing::Test { 67 class FetchFormDataConsumerHandleTest : public ::testing::Test {
67 public: 68 public:
68 FetchFormDataConsumerHandleTest() : m_page(DummyPageHolder::create(IntSize(1 , 1))) {} 69 FetchFormDataConsumerHandleTest() : m_page(DummyPageHolder::create(IntSize(1 , 1))) {}
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 EXPECT_EQ(kShouldWait, reader->beginRead(&buffer, kNone, &available)); 429 EXPECT_EQ(kShouldWait, reader->beginRead(&buffer, kNone, &available));
429 testing::runPendingTasks(); 430 testing::runPendingTasks();
430 EXPECT_EQ(kOk, reader->beginRead(&buffer, kNone, &available)); 431 EXPECT_EQ(kOk, reader->beginRead(&buffer, kNone, &available));
431 EXPECT_FALSE(reader->drainAsFormData()); 432 EXPECT_FALSE(reader->drainAsFormData());
432 reader->endRead(0); 433 reader->endRead(0);
433 EXPECT_FALSE(reader->drainAsFormData()); 434 EXPECT_FALSE(reader->drainAsFormData());
434 } 435 }
435 436
436 } // namespace 437 } // namespace
437 } // namespace blink 438 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698