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

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

Issue 2432883002: Replaced PassRefPtr copies with moves in unit tests. (Closed)
Patch Set: Created 4 years, 2 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/BytesConsumerForDataConsumerHandle.h" 7 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h"
8 #include "modules/fetch/BytesConsumerTestUtil.h" 8 #include "modules/fetch/BytesConsumerTestUtil.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 30 matching lines...) Expand all
41 FetchDataLoader::createLoaderAsBlobHandle("text/test"); 41 FetchDataLoader::createLoaderAsBlobHandle("text/test");
42 MockFetchDataLoaderClient* fetchDataLoaderClient = 42 MockFetchDataLoaderClient* fetchDataLoaderClient =
43 MockFetchDataLoaderClient::create(); 43 MockFetchDataLoaderClient::create();
44 RefPtr<BlobDataHandle> blobDataHandle; 44 RefPtr<BlobDataHandle> blobDataHandle;
45 45
46 InSequence s; 46 InSequence s;
47 EXPECT_CALL(checkpoint, Call(1)); 47 EXPECT_CALL(checkpoint, Call(1));
48 EXPECT_CALL(*consumer, 48 EXPECT_CALL(*consumer,
49 drainAsBlobDataHandle( 49 drainAsBlobDataHandle(
50 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize)) 50 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize))
51 .WillOnce(Return(nullptr)); 51 .WillOnce(Return(ByMove(nullptr)));
52 EXPECT_CALL(*consumer, setClient(_)).WillOnce(SaveArg<0>(&client)); 52 EXPECT_CALL(*consumer, setClient(_)).WillOnce(SaveArg<0>(&client));
53 EXPECT_CALL(*consumer, beginRead(_, _)) 53 EXPECT_CALL(*consumer, beginRead(_, _))
54 .WillOnce(DoAll(SetArgPointee<0>(nullptr), SetArgPointee<1>(0), 54 .WillOnce(DoAll(SetArgPointee<0>(nullptr), SetArgPointee<1>(0),
55 Return(Result::ShouldWait))); 55 Return(Result::ShouldWait)));
56 EXPECT_CALL(checkpoint, Call(2)); 56 EXPECT_CALL(checkpoint, Call(2));
57 EXPECT_CALL(*consumer, beginRead(_, _)) 57 EXPECT_CALL(*consumer, beginRead(_, _))
58 .WillOnce(DoAll(SetArgPointee<0>(kQuickBrownFox), 58 .WillOnce(DoAll(SetArgPointee<0>(kQuickBrownFox),
59 SetArgPointee<1>(kQuickBrownFoxLengthWithTerminatingNull), 59 SetArgPointee<1>(kQuickBrownFoxLengthWithTerminatingNull),
60 Return(Result::Ok))); 60 Return(Result::Ok)));
61 EXPECT_CALL(*consumer, endRead(kQuickBrownFoxLengthWithTerminatingNull)) 61 EXPECT_CALL(*consumer, endRead(kQuickBrownFoxLengthWithTerminatingNull))
(...skipping 27 matching lines...) Expand all
89 FetchDataLoader* fetchDataLoader = 89 FetchDataLoader* fetchDataLoader =
90 FetchDataLoader::createLoaderAsBlobHandle("text/test"); 90 FetchDataLoader::createLoaderAsBlobHandle("text/test");
91 MockFetchDataLoaderClient* fetchDataLoaderClient = 91 MockFetchDataLoaderClient* fetchDataLoaderClient =
92 MockFetchDataLoaderClient::create(); 92 MockFetchDataLoaderClient::create();
93 93
94 InSequence s; 94 InSequence s;
95 EXPECT_CALL(checkpoint, Call(1)); 95 EXPECT_CALL(checkpoint, Call(1));
96 EXPECT_CALL(*consumer, 96 EXPECT_CALL(*consumer,
97 drainAsBlobDataHandle( 97 drainAsBlobDataHandle(
98 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize)) 98 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize))
99 .WillOnce(Return(nullptr)); 99 .WillOnce(Return(ByMove(nullptr)));
100 EXPECT_CALL(*consumer, setClient(_)).WillOnce(SaveArg<0>(&client)); 100 EXPECT_CALL(*consumer, setClient(_)).WillOnce(SaveArg<0>(&client));
101 EXPECT_CALL(*consumer, beginRead(_, _)) 101 EXPECT_CALL(*consumer, beginRead(_, _))
102 .WillOnce(DoAll(SetArgPointee<0>(nullptr), SetArgPointee<1>(0), 102 .WillOnce(DoAll(SetArgPointee<0>(nullptr), SetArgPointee<1>(0),
103 Return(Result::ShouldWait))); 103 Return(Result::ShouldWait)));
104 EXPECT_CALL(checkpoint, Call(2)); 104 EXPECT_CALL(checkpoint, Call(2));
105 EXPECT_CALL(*consumer, beginRead(_, _)) 105 EXPECT_CALL(*consumer, beginRead(_, _))
106 .WillOnce(DoAll(SetArgPointee<0>(kQuickBrownFox), 106 .WillOnce(DoAll(SetArgPointee<0>(kQuickBrownFox),
107 SetArgPointee<1>(kQuickBrownFoxLengthWithTerminatingNull), 107 SetArgPointee<1>(kQuickBrownFoxLengthWithTerminatingNull),
108 Return(Result::Ok))); 108 Return(Result::Ok)));
109 EXPECT_CALL(*consumer, endRead(kQuickBrownFoxLengthWithTerminatingNull)) 109 EXPECT_CALL(*consumer, endRead(kQuickBrownFoxLengthWithTerminatingNull))
(...skipping 22 matching lines...) Expand all
132 FetchDataLoader* fetchDataLoader = 132 FetchDataLoader* fetchDataLoader =
133 FetchDataLoader::createLoaderAsBlobHandle("text/test"); 133 FetchDataLoader::createLoaderAsBlobHandle("text/test");
134 MockFetchDataLoaderClient* fetchDataLoaderClient = 134 MockFetchDataLoaderClient* fetchDataLoaderClient =
135 MockFetchDataLoaderClient::create(); 135 MockFetchDataLoaderClient::create();
136 136
137 InSequence s; 137 InSequence s;
138 EXPECT_CALL(checkpoint, Call(1)); 138 EXPECT_CALL(checkpoint, Call(1));
139 EXPECT_CALL(*consumer, 139 EXPECT_CALL(*consumer,
140 drainAsBlobDataHandle( 140 drainAsBlobDataHandle(
141 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize)) 141 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize))
142 .WillOnce(Return(nullptr)); 142 .WillOnce(Return(ByMove(nullptr)));
143 EXPECT_CALL(*consumer, setClient(_)).WillOnce(SaveArg<0>(&client)); 143 EXPECT_CALL(*consumer, setClient(_)).WillOnce(SaveArg<0>(&client));
144 EXPECT_CALL(*consumer, beginRead(_, _)) 144 EXPECT_CALL(*consumer, beginRead(_, _))
145 .WillOnce(DoAll(SetArgPointee<0>(nullptr), SetArgPointee<1>(0), 145 .WillOnce(DoAll(SetArgPointee<0>(nullptr), SetArgPointee<1>(0),
146 Return(Result::ShouldWait))); 146 Return(Result::ShouldWait)));
147 EXPECT_CALL(checkpoint, Call(2)); 147 EXPECT_CALL(checkpoint, Call(2));
148 EXPECT_CALL(*consumer, cancel()); 148 EXPECT_CALL(*consumer, cancel());
149 EXPECT_CALL(checkpoint, Call(3)); 149 EXPECT_CALL(checkpoint, Call(3));
150 150
151 checkpoint.Call(1); 151 checkpoint.Call(1);
152 fetchDataLoader->start(consumer, fetchDataLoaderClient); 152 fetchDataLoader->start(consumer, fetchDataLoaderClient);
(...skipping 18 matching lines...) Expand all
171 FetchDataLoader::createLoaderAsBlobHandle("text/test"); 171 FetchDataLoader::createLoaderAsBlobHandle("text/test");
172 MockFetchDataLoaderClient* fetchDataLoaderClient = 172 MockFetchDataLoaderClient* fetchDataLoaderClient =
173 MockFetchDataLoaderClient::create(); 173 MockFetchDataLoaderClient::create();
174 RefPtr<BlobDataHandle> blobDataHandle; 174 RefPtr<BlobDataHandle> blobDataHandle;
175 175
176 InSequence s; 176 InSequence s;
177 EXPECT_CALL(checkpoint, Call(1)); 177 EXPECT_CALL(checkpoint, Call(1));
178 EXPECT_CALL(*consumer, 178 EXPECT_CALL(*consumer,
179 drainAsBlobDataHandle( 179 drainAsBlobDataHandle(
180 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize)) 180 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize))
181 .WillOnce(Return(inputBlobDataHandle)); 181 .WillOnce(Return(ByMove(inputBlobDataHandle)));
182 EXPECT_CALL(*fetchDataLoaderClient, didFetchDataLoadedBlobHandleMock(_)) 182 EXPECT_CALL(*fetchDataLoaderClient, didFetchDataLoadedBlobHandleMock(_))
183 .WillOnce(SaveArg<0>(&blobDataHandle)); 183 .WillOnce(SaveArg<0>(&blobDataHandle));
184 EXPECT_CALL(checkpoint, Call(2)); 184 EXPECT_CALL(checkpoint, Call(2));
185 EXPECT_CALL(*consumer, cancel()); 185 EXPECT_CALL(*consumer, cancel());
186 EXPECT_CALL(checkpoint, Call(3)); 186 EXPECT_CALL(checkpoint, Call(3));
187 187
188 checkpoint.Call(1); 188 checkpoint.Call(1);
189 fetchDataLoader->start(consumer, fetchDataLoaderClient); 189 fetchDataLoader->start(consumer, fetchDataLoaderClient);
190 checkpoint.Call(2); 190 checkpoint.Call(2);
191 fetchDataLoader->cancel(); 191 fetchDataLoader->cancel();
(...skipping 21 matching lines...) Expand all
213 FetchDataLoader::createLoaderAsBlobHandle("text/test"); 213 FetchDataLoader::createLoaderAsBlobHandle("text/test");
214 MockFetchDataLoaderClient* fetchDataLoaderClient = 214 MockFetchDataLoaderClient* fetchDataLoaderClient =
215 MockFetchDataLoaderClient::create(); 215 MockFetchDataLoaderClient::create();
216 RefPtr<BlobDataHandle> blobDataHandle; 216 RefPtr<BlobDataHandle> blobDataHandle;
217 217
218 InSequence s; 218 InSequence s;
219 EXPECT_CALL(checkpoint, Call(1)); 219 EXPECT_CALL(checkpoint, Call(1));
220 EXPECT_CALL(*consumer, 220 EXPECT_CALL(*consumer,
221 drainAsBlobDataHandle( 221 drainAsBlobDataHandle(
222 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize)) 222 BytesConsumer::BlobSizePolicy::DisallowBlobWithInvalidSize))
223 .WillOnce(Return(inputBlobDataHandle)); 223 .WillOnce(Return(ByMove(inputBlobDataHandle)));
224 EXPECT_CALL(*fetchDataLoaderClient, didFetchDataLoadedBlobHandleMock(_)) 224 EXPECT_CALL(*fetchDataLoaderClient, didFetchDataLoadedBlobHandleMock(_))
225 .WillOnce(SaveArg<0>(&blobDataHandle)); 225 .WillOnce(SaveArg<0>(&blobDataHandle));
226 EXPECT_CALL(checkpoint, Call(2)); 226 EXPECT_CALL(checkpoint, Call(2));
227 EXPECT_CALL(*consumer, cancel()); 227 EXPECT_CALL(*consumer, cancel());
228 EXPECT_CALL(checkpoint, Call(3)); 228 EXPECT_CALL(checkpoint, Call(3));
229 229
230 checkpoint.Call(1); 230 checkpoint.Call(1);
231 fetchDataLoader->start(consumer, fetchDataLoaderClient); 231 fetchDataLoader->start(consumer, fetchDataLoaderClient);
232 checkpoint.Call(2); 232 checkpoint.Call(2);
233 fetchDataLoader->cancel(); 233 fetchDataLoader->cancel();
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 checkpoint.Call(1); 489 checkpoint.Call(1);
490 fetchDataLoader->start(consumer, fetchDataLoaderClient); 490 fetchDataLoader->start(consumer, fetchDataLoaderClient);
491 checkpoint.Call(2); 491 checkpoint.Call(2);
492 fetchDataLoader->cancel(); 492 fetchDataLoader->cancel();
493 checkpoint.Call(3); 493 checkpoint.Call(3);
494 } 494 }
495 495
496 } // namespace 496 } // namespace
497 497
498 } // namespace blink 498 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698