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

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

Issue 2870543002: Removed PassRefPtr to RefPtr copies from unit tests. (Closed)
Patch Set: Created 3 years, 7 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 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/BytesConsumer.h" 5 #include "modules/fetch/BytesConsumer.h"
6 6
7 #include "core/testing/DummyPageHolder.h" 7 #include "core/testing/DummyPageHolder.h"
8 #include "modules/fetch/BytesConsumerTestUtil.h" 8 #include "modules/fetch/BytesConsumerTestUtil.h"
9 #include "platform/blob/BlobData.h" 9 #include "platform/blob/BlobData.h"
10 #include "platform/testing/UnitTestHelpers.h" 10 #include "platform/testing/UnitTestHelpers.h"
(...skipping 30 matching lines...) Expand all
41 41
42 Document* GetDocument() { return &page_->GetDocument(); } 42 Document* GetDocument() { return &page_->GetDocument(); }
43 43
44 private: 44 private:
45 std::unique_ptr<DummyPageHolder> page_; 45 std::unique_ptr<DummyPageHolder> page_;
46 }; 46 };
47 47
48 class FakeBlobBytesConsumer : public BytesConsumer { 48 class FakeBlobBytesConsumer : public BytesConsumer {
49 public: 49 public:
50 explicit FakeBlobBytesConsumer(PassRefPtr<BlobDataHandle> handle) 50 explicit FakeBlobBytesConsumer(PassRefPtr<BlobDataHandle> handle)
51 : blob_handle_(handle) {} 51 : blob_handle_(std::move(handle)) {}
52 ~FakeBlobBytesConsumer() override {} 52 ~FakeBlobBytesConsumer() override {}
53 53
54 Result BeginRead(const char** buffer, size_t* available) override { 54 Result BeginRead(const char** buffer, size_t* available) override {
55 if (state_ == PublicState::kClosed) 55 if (state_ == PublicState::kClosed)
56 return Result::kDone; 56 return Result::kDone;
57 blob_handle_ = nullptr; 57 blob_handle_ = nullptr;
58 state_ = PublicState::kErrored; 58 state_ = PublicState::kErrored;
59 return Result::kError; 59 return Result::kError;
60 } 60 }
61 Result EndRead(size_t read_size) override { 61 Result EndRead(size_t read_size) override {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 EXPECT_EQ(BytesConsumer::PublicState::kErrored, consumer->GetPublicState()); 427 EXPECT_EQ(BytesConsumer::PublicState::kErrored, consumer->GetPublicState());
428 EXPECT_EQ(error.Message(), consumer->GetError().Message()); 428 EXPECT_EQ(error.Message(), consumer->GetError().Message());
429 429
430 consumer->Cancel(); 430 consumer->Cancel();
431 EXPECT_EQ(BytesConsumer::PublicState::kErrored, consumer->GetPublicState()); 431 EXPECT_EQ(BytesConsumer::PublicState::kErrored, consumer->GetPublicState());
432 } 432 }
433 433
434 } // namespace 434 } // namespace
435 435
436 } // namespace blink 436 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698