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

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

Issue 1983783002: Remove OwnPtr::release() calls in modules/ (part 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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/FetchDataLoader.h" 5 #include "modules/fetch/FetchDataLoader.h"
6 6
7 #include "modules/fetch/DataConsumerHandleTestUtil.h" 7 #include "modules/fetch/DataConsumerHandleTestUtil.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 checkpoint.Call(2); 136 checkpoint.Call(2);
137 fetchDataLoader->cancel(); 137 fetchDataLoader->cancel();
138 checkpoint.Call(3); 138 checkpoint.Call(3);
139 } 139 }
140 140
141 TEST(FetchDataLoaderTest, LoadAsBlobViaDrainAsBlobDataHandleWithSameContentType) 141 TEST(FetchDataLoaderTest, LoadAsBlobViaDrainAsBlobDataHandleWithSameContentType)
142 { 142 {
143 OwnPtr<BlobData> blobData = BlobData::create(); 143 OwnPtr<BlobData> blobData = BlobData::create();
144 blobData->appendBytes(kQuickBrownFox, kQuickBrownFoxLengthWithTerminatingNul l); 144 blobData->appendBytes(kQuickBrownFox, kQuickBrownFoxLengthWithTerminatingNul l);
145 blobData->setContentType("text/test"); 145 blobData->setContentType("text/test");
146 RefPtr<BlobDataHandle> inputBlobDataHandle = BlobDataHandle::create(blobData .release(), kQuickBrownFoxLengthWithTerminatingNull); 146 RefPtr<BlobDataHandle> inputBlobDataHandle = BlobDataHandle::create(std::mov e(blobData), kQuickBrownFoxLengthWithTerminatingNull);
147 147
148 Checkpoint checkpoint; 148 Checkpoint checkpoint;
149 149
150 OwnPtr<MockHandle> handle = MockHandle::create(); 150 OwnPtr<MockHandle> handle = MockHandle::create();
151 OwnPtr<MockReader> reader = MockReader::create(); 151 OwnPtr<MockReader> reader = MockReader::create();
152 FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle ("text/test"); 152 FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle ("text/test");
153 MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient ::create(); 153 MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient ::create();
154 RefPtr<BlobDataHandle> blobDataHandle; 154 RefPtr<BlobDataHandle> blobDataHandle;
155 155
156 InSequence s; 156 InSequence s;
(...skipping 18 matching lines...) Expand all
175 EXPECT_EQ(inputBlobDataHandle, blobDataHandle); 175 EXPECT_EQ(inputBlobDataHandle, blobDataHandle);
176 EXPECT_EQ(kQuickBrownFoxLengthWithTerminatingNull, blobDataHandle->size()); 176 EXPECT_EQ(kQuickBrownFoxLengthWithTerminatingNull, blobDataHandle->size());
177 EXPECT_EQ(String("text/test"), blobDataHandle->type()); 177 EXPECT_EQ(String("text/test"), blobDataHandle->type());
178 } 178 }
179 179
180 TEST(FetchDataLoaderTest, LoadAsBlobViaDrainAsBlobDataHandleWithDifferentContent Type) 180 TEST(FetchDataLoaderTest, LoadAsBlobViaDrainAsBlobDataHandleWithDifferentContent Type)
181 { 181 {
182 OwnPtr<BlobData> blobData = BlobData::create(); 182 OwnPtr<BlobData> blobData = BlobData::create();
183 blobData->appendBytes(kQuickBrownFox, kQuickBrownFoxLengthWithTerminatingNul l); 183 blobData->appendBytes(kQuickBrownFox, kQuickBrownFoxLengthWithTerminatingNul l);
184 blobData->setContentType("text/different"); 184 blobData->setContentType("text/different");
185 RefPtr<BlobDataHandle> inputBlobDataHandle = BlobDataHandle::create(blobData .release(), kQuickBrownFoxLengthWithTerminatingNull); 185 RefPtr<BlobDataHandle> inputBlobDataHandle = BlobDataHandle::create(std::mov e(blobData), kQuickBrownFoxLengthWithTerminatingNull);
186 186
187 Checkpoint checkpoint; 187 Checkpoint checkpoint;
188 188
189 OwnPtr<MockHandle> handle = MockHandle::create(); 189 OwnPtr<MockHandle> handle = MockHandle::create();
190 OwnPtr<MockReader> reader = MockReader::create(); 190 OwnPtr<MockReader> reader = MockReader::create();
191 FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle ("text/test"); 191 FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle ("text/test");
192 MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient ::create(); 192 MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient ::create();
193 RefPtr<BlobDataHandle> blobDataHandle; 193 RefPtr<BlobDataHandle> blobDataHandle;
194 194
195 InSequence s; 195 InSequence s;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 checkpoint.Call(1); 444 checkpoint.Call(1);
445 fetchDataLoader->start(handle.get(), fetchDataLoaderClient); 445 fetchDataLoader->start(handle.get(), fetchDataLoaderClient);
446 checkpoint.Call(2); 446 checkpoint.Call(2);
447 fetchDataLoader->cancel(); 447 fetchDataLoader->cancel();
448 checkpoint.Call(3); 448 checkpoint.Call(3);
449 } 449 }
450 450
451 } // namespace 451 } // namespace
452 452
453 } // namespace blink 453 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698