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

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

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/BytesConsumerForDataConsumerHandle.h" 5 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h"
6 6
7 #include "core/testing/DummyPageHolder.h" 7 #include "core/testing/DummyPageHolder.h"
8 #include "modules/fetch/BytesConsumer.h" 8 #include "modules/fetch/BytesConsumer.h"
9 #include "modules/fetch/DataConsumerHandleTestUtil.h" 9 #include "modules/fetch/DataConsumerHandleTestUtil.h"
10 #include "platform/testing/UnitTestHelpers.h" 10 #include "platform/testing/UnitTestHelpers.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Result endRead(size_t readSize) override { 79 Result endRead(size_t readSize) override {
80 return m_proxy->endRead(readSize); 80 return m_proxy->endRead(readSize);
81 } 81 }
82 82
83 private: 83 private:
84 Persistent<MockReaderProxy> m_proxy; 84 Persistent<MockReaderProxy> m_proxy;
85 }; 85 };
86 86
87 std::unique_ptr<WebDataConsumerHandle::Reader> obtainReader( 87 std::unique_ptr<WebDataConsumerHandle::Reader> obtainReader(
88 Client*) override { 88 Client*) override {
89 return makeUnique<Reader>(m_proxy); 89 return WTF::makeUnique<Reader>(m_proxy);
90 } 90 }
91 Persistent<MockReaderProxy> m_proxy; 91 Persistent<MockReaderProxy> m_proxy;
92 }; 92 };
93 93
94 TEST_F(BytesConsumerForDataConsumerHandleTest, Create) { 94 TEST_F(BytesConsumerForDataConsumerHandleTest, Create) {
95 std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); 95 std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create();
96 handle->add(Command(Command::Data, "hello")); 96 handle->add(Command(Command::Data, "hello"));
97 handle->add(Command(Command::Done)); 97 handle->add(Command(Command::Done));
98 Persistent<BytesConsumer> consumer = 98 Persistent<BytesConsumer> consumer =
99 new BytesConsumerForDataConsumerHandle(document(), std::move(handle)); 99 new BytesConsumerForDataConsumerHandle(document(), std::move(handle));
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 consumer->cancel(); 250 consumer->cancel();
251 const char* buffer = nullptr; 251 const char* buffer = nullptr;
252 size_t available = 0; 252 size_t available = 0;
253 ASSERT_EQ(Result::Done, consumer->beginRead(&buffer, &available)); 253 ASSERT_EQ(Result::Done, consumer->beginRead(&buffer, &available));
254 } 254 }
255 255
256 TEST_F(BytesConsumerForDataConsumerHandleTest, drainAsBlobDataHandle) { 256 TEST_F(BytesConsumerForDataConsumerHandleTest, drainAsBlobDataHandle) {
257 // WebDataConsumerHandle::Reader::drainAsBlobDataHandle should return 257 // WebDataConsumerHandle::Reader::drainAsBlobDataHandle should return
258 // nullptr from the second time, but we don't care that here. 258 // nullptr from the second time, but we don't care that here.
259 std::unique_ptr<MockDataConsumerHandle> handle = 259 std::unique_ptr<MockDataConsumerHandle> handle =
260 wrapUnique(new MockDataConsumerHandle); 260 WTF::wrapUnique(new MockDataConsumerHandle);
261 Persistent<MockDataConsumerHandle::MockReaderProxy> proxy = handle->proxy(); 261 Persistent<MockDataConsumerHandle::MockReaderProxy> proxy = handle->proxy();
262 Persistent<BytesConsumer> consumer = 262 Persistent<BytesConsumer> consumer =
263 new BytesConsumerForDataConsumerHandle(document(), std::move(handle)); 263 new BytesConsumerForDataConsumerHandle(document(), std::move(handle));
264 consumer->setClient(MockClient::create()); 264 consumer->setClient(MockClient::create());
265 265
266 Checkpoint checkpoint; 266 Checkpoint checkpoint;
267 InSequence s; 267 InSequence s;
268 268
269 EXPECT_FALSE(consumer->drainAsBlobDataHandle( 269 EXPECT_FALSE(consumer->drainAsBlobDataHandle(
270 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize)); 270 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize));
271 EXPECT_FALSE(consumer->drainAsBlobDataHandle( 271 EXPECT_FALSE(consumer->drainAsBlobDataHandle(
272 BytesConsumer::BlobSizePolicy::AllowBlobWithInvalidSize)); 272 BytesConsumer::BlobSizePolicy::AllowBlobWithInvalidSize));
273 EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting, 273 EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting,
274 consumer->getPublicState()); 274 consumer->getPublicState());
275 } 275 }
276 276
277 TEST_F(BytesConsumerForDataConsumerHandleTest, drainAsFormData) { 277 TEST_F(BytesConsumerForDataConsumerHandleTest, drainAsFormData) {
278 std::unique_ptr<MockDataConsumerHandle> handle = 278 std::unique_ptr<MockDataConsumerHandle> handle =
279 wrapUnique(new MockDataConsumerHandle); 279 WTF::wrapUnique(new MockDataConsumerHandle);
280 Persistent<MockDataConsumerHandle::MockReaderProxy> proxy = handle->proxy(); 280 Persistent<MockDataConsumerHandle::MockReaderProxy> proxy = handle->proxy();
281 Persistent<BytesConsumer> consumer = 281 Persistent<BytesConsumer> consumer =
282 new BytesConsumerForDataConsumerHandle(document(), std::move(handle)); 282 new BytesConsumerForDataConsumerHandle(document(), std::move(handle));
283 consumer->setClient(MockClient::create()); 283 consumer->setClient(MockClient::create());
284 284
285 Checkpoint checkpoint; 285 Checkpoint checkpoint;
286 InSequence s; 286 InSequence s;
287 287
288 EXPECT_FALSE(consumer->drainAsFormData()); 288 EXPECT_FALSE(consumer->drainAsFormData());
289 EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting, 289 EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting,
290 consumer->getPublicState()); 290 consumer->getPublicState());
291 } 291 }
292 292
293 } // namespace 293 } // namespace
294 294
295 } // namespace blink 295 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698