OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <deque> | 5 #include <deque> |
6 #include <limits> | 6 #include <limits> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 EXPECT_FALSE(quota_file_io_->Write( | 127 EXPECT_FALSE(quota_file_io_->Write( |
128 0, "data", std::numeric_limits<int32_t>::min(), | 128 0, "data", std::numeric_limits<int32_t>::min(), |
129 base::Bind(&QuotaFileIOTest::DidWrite, weak_factory_.GetWeakPtr()))); | 129 base::Bind(&QuotaFileIOTest::DidWrite, weak_factory_.GetWeakPtr()))); |
130 | 130 |
131 quota_plugin_delegate()->set_available_space(100); | 131 quota_plugin_delegate()->set_available_space(100); |
132 std::string read_buffer; | 132 std::string read_buffer; |
133 | 133 |
134 // Write 8 bytes at offset 0 (-> length=8). | 134 // Write 8 bytes at offset 0 (-> length=8). |
135 std::string data("12345678"); | 135 std::string data("12345678"); |
136 Write(0, data, will_operation); | 136 Write(0, data, will_operation); |
137 MessageLoop::current()->RunAllPending(); | 137 MessageLoop::current()->RunUntilIdle(); |
138 ASSERT_EQ(1U, num_results()); | 138 ASSERT_EQ(1U, num_results()); |
139 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); | 139 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); |
140 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 140 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
141 EXPECT_EQ(100 - 8, quota_plugin_delegate()->available_space()); | 141 EXPECT_EQ(100 - 8, quota_plugin_delegate()->available_space()); |
142 reset_results(); | 142 reset_results(); |
143 | 143 |
144 if (will_operation) { | 144 if (will_operation) { |
145 // WillWrite doesn't actually write. | 145 // WillWrite doesn't actually write. |
146 EXPECT_EQ(0, GetPlatformFileSize()); | 146 EXPECT_EQ(0, GetPlatformFileSize()); |
147 // Adjust the actual file size to 'fake' write to proceed testing. | 147 // Adjust the actual file size to 'fake' write to proceed testing. |
148 SetPlatformFileSize(8); | 148 SetPlatformFileSize(8); |
149 } else { | 149 } else { |
150 EXPECT_EQ(8, GetPlatformFileSize()); | 150 EXPECT_EQ(8, GetPlatformFileSize()); |
151 ReadPlatformFile(&read_buffer); | 151 ReadPlatformFile(&read_buffer); |
152 EXPECT_EQ(data, read_buffer); | 152 EXPECT_EQ(data, read_buffer); |
153 } | 153 } |
154 | 154 |
155 // Write 5 bytes at offset 5 (-> length=10). | 155 // Write 5 bytes at offset 5 (-> length=10). |
156 data = "55555"; | 156 data = "55555"; |
157 Write(5, data, will_operation); | 157 Write(5, data, will_operation); |
158 MessageLoop::current()->RunAllPending(); | 158 MessageLoop::current()->RunUntilIdle(); |
159 ASSERT_EQ(1U, num_results()); | 159 ASSERT_EQ(1U, num_results()); |
160 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); | 160 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); |
161 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 161 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
162 EXPECT_EQ(100 - 10, quota_plugin_delegate()->available_space()); | 162 EXPECT_EQ(100 - 10, quota_plugin_delegate()->available_space()); |
163 reset_results(); | 163 reset_results(); |
164 | 164 |
165 if (will_operation) { | 165 if (will_operation) { |
166 EXPECT_EQ(8, GetPlatformFileSize()); | 166 EXPECT_EQ(8, GetPlatformFileSize()); |
167 SetPlatformFileSize(10); | 167 SetPlatformFileSize(10); |
168 } else { | 168 } else { |
169 EXPECT_EQ(10, GetPlatformFileSize()); | 169 EXPECT_EQ(10, GetPlatformFileSize()); |
170 ReadPlatformFile(&read_buffer); | 170 ReadPlatformFile(&read_buffer); |
171 EXPECT_EQ("1234555555", read_buffer); | 171 EXPECT_EQ("1234555555", read_buffer); |
172 } | 172 } |
173 | 173 |
174 // Write 7 bytes at offset 8 (-> length=15). | 174 // Write 7 bytes at offset 8 (-> length=15). |
175 data = "9012345"; | 175 data = "9012345"; |
176 Write(8, data, will_operation); | 176 Write(8, data, will_operation); |
177 MessageLoop::current()->RunAllPending(); | 177 MessageLoop::current()->RunUntilIdle(); |
178 ASSERT_EQ(1U, num_results()); | 178 ASSERT_EQ(1U, num_results()); |
179 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); | 179 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); |
180 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 180 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
181 EXPECT_EQ(100 - 15, quota_plugin_delegate()->available_space()); | 181 EXPECT_EQ(100 - 15, quota_plugin_delegate()->available_space()); |
182 reset_results(); | 182 reset_results(); |
183 | 183 |
184 if (will_operation) { | 184 if (will_operation) { |
185 EXPECT_EQ(10, GetPlatformFileSize()); | 185 EXPECT_EQ(10, GetPlatformFileSize()); |
186 SetPlatformFileSize(15); | 186 SetPlatformFileSize(15); |
187 } else { | 187 } else { |
188 EXPECT_EQ(15, GetPlatformFileSize()); | 188 EXPECT_EQ(15, GetPlatformFileSize()); |
189 ReadPlatformFile(&read_buffer); | 189 ReadPlatformFile(&read_buffer); |
190 EXPECT_EQ("123455559012345", read_buffer); | 190 EXPECT_EQ("123455559012345", read_buffer); |
191 } | 191 } |
192 | 192 |
193 // Write 2 bytes at offset 2 (-> length=15). | 193 // Write 2 bytes at offset 2 (-> length=15). |
194 data = "33"; | 194 data = "33"; |
195 Write(2, data, will_operation); | 195 Write(2, data, will_operation); |
196 MessageLoop::current()->RunAllPending(); | 196 MessageLoop::current()->RunUntilIdle(); |
197 ASSERT_EQ(1U, num_results()); | 197 ASSERT_EQ(1U, num_results()); |
198 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); | 198 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); |
199 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 199 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
200 EXPECT_EQ(100 - 15, quota_plugin_delegate()->available_space()); | 200 EXPECT_EQ(100 - 15, quota_plugin_delegate()->available_space()); |
201 reset_results(); | 201 reset_results(); |
202 | 202 |
203 if (will_operation) { | 203 if (will_operation) { |
204 EXPECT_EQ(15, GetPlatformFileSize()); | 204 EXPECT_EQ(15, GetPlatformFileSize()); |
205 } else { | 205 } else { |
206 EXPECT_EQ(15, GetPlatformFileSize()); | 206 EXPECT_EQ(15, GetPlatformFileSize()); |
207 ReadPlatformFile(&read_buffer); | 207 ReadPlatformFile(&read_buffer); |
208 EXPECT_EQ("123355559012345", read_buffer); | 208 EXPECT_EQ("123355559012345", read_buffer); |
209 } | 209 } |
210 | 210 |
211 // Write 4 bytes at offset 20 (-> length=24). | 211 // Write 4 bytes at offset 20 (-> length=24). |
212 data = "XXXX"; | 212 data = "XXXX"; |
213 Write(20, data, will_operation); | 213 Write(20, data, will_operation); |
214 MessageLoop::current()->RunAllPending(); | 214 MessageLoop::current()->RunUntilIdle(); |
215 ASSERT_EQ(1U, num_results()); | 215 ASSERT_EQ(1U, num_results()); |
216 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); | 216 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); |
217 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 217 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
218 EXPECT_EQ(100 - 24, quota_plugin_delegate()->available_space()); | 218 EXPECT_EQ(100 - 24, quota_plugin_delegate()->available_space()); |
219 reset_results(); | 219 reset_results(); |
220 | 220 |
221 if (will_operation) { | 221 if (will_operation) { |
222 EXPECT_EQ(15, GetPlatformFileSize()); | 222 EXPECT_EQ(15, GetPlatformFileSize()); |
223 SetPlatformFileSize(24); | 223 SetPlatformFileSize(24); |
224 } else { | 224 } else { |
225 EXPECT_EQ(24, GetPlatformFileSize()); | 225 EXPECT_EQ(24, GetPlatformFileSize()); |
226 ReadPlatformFile(&read_buffer); | 226 ReadPlatformFile(&read_buffer); |
227 EXPECT_EQ(std::string("123355559012345\0\0\0\0\0XXXX", 24), read_buffer); | 227 EXPECT_EQ(std::string("123355559012345\0\0\0\0\0XXXX", 24), read_buffer); |
228 } | 228 } |
229 | 229 |
230 quota_plugin_delegate()->set_available_space(5); | 230 quota_plugin_delegate()->set_available_space(5); |
231 | 231 |
232 // Quota error case. Write 7 bytes at offset 23 (-> length is unchanged) | 232 // Quota error case. Write 7 bytes at offset 23 (-> length is unchanged) |
233 data = "ABCDEFG"; | 233 data = "ABCDEFG"; |
234 Write(23, data, will_operation); | 234 Write(23, data, will_operation); |
235 MessageLoop::current()->RunAllPending(); | 235 MessageLoop::current()->RunUntilIdle(); |
236 ASSERT_EQ(1U, num_results()); | 236 ASSERT_EQ(1U, num_results()); |
237 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status().front()); | 237 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status().front()); |
238 EXPECT_EQ(5, quota_plugin_delegate()->available_space()); | 238 EXPECT_EQ(5, quota_plugin_delegate()->available_space()); |
239 reset_results(); | 239 reset_results(); |
240 | 240 |
241 // Overlapping write. Write 6 bytes at offset 2 (-> length is unchanged) | 241 // Overlapping write. Write 6 bytes at offset 2 (-> length is unchanged) |
242 data = "ABCDEF"; | 242 data = "ABCDEF"; |
243 Write(2, data, will_operation); | 243 Write(2, data, will_operation); |
244 MessageLoop::current()->RunAllPending(); | 244 MessageLoop::current()->RunUntilIdle(); |
245 ASSERT_EQ(1U, num_results()); | 245 ASSERT_EQ(1U, num_results()); |
246 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); | 246 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); |
247 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 247 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
248 EXPECT_EQ(5, quota_plugin_delegate()->available_space()); | 248 EXPECT_EQ(5, quota_plugin_delegate()->available_space()); |
249 reset_results(); | 249 reset_results(); |
250 | 250 |
251 // Overlapping + extending the file size, but within the quota. | 251 // Overlapping + extending the file size, but within the quota. |
252 // Write 6 bytes at offset 23 (-> length=29). | 252 // Write 6 bytes at offset 23 (-> length=29). |
253 Write(23, data, will_operation); | 253 Write(23, data, will_operation); |
254 MessageLoop::current()->RunAllPending(); | 254 MessageLoop::current()->RunUntilIdle(); |
255 ASSERT_EQ(1U, num_results()); | 255 ASSERT_EQ(1U, num_results()); |
256 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); | 256 EXPECT_EQ(static_cast<int>(data.size()), bytes_written().front()); |
257 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 257 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
258 EXPECT_EQ(0, quota_plugin_delegate()->available_space()); | 258 EXPECT_EQ(0, quota_plugin_delegate()->available_space()); |
259 reset_results(); | 259 reset_results(); |
260 | 260 |
261 if (!will_operation) { | 261 if (!will_operation) { |
262 EXPECT_EQ(29, GetPlatformFileSize()); | 262 EXPECT_EQ(29, GetPlatformFileSize()); |
263 ReadPlatformFile(&read_buffer); | 263 ReadPlatformFile(&read_buffer); |
264 EXPECT_EQ(std::string("12ABCDEF9012345\0\0\0\0\0XXXABCDEF", 29), | 264 EXPECT_EQ(std::string("12ABCDEF9012345\0\0\0\0\0XXXABCDEF", 29), |
265 read_buffer); | 265 read_buffer); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 void SetLengthTestBody(bool will_operation) { | 269 void SetLengthTestBody(bool will_operation) { |
270 quota_plugin_delegate()->set_available_space(100); | 270 quota_plugin_delegate()->set_available_space(100); |
271 | 271 |
272 SetLength(0, will_operation); | 272 SetLength(0, will_operation); |
273 MessageLoop::current()->RunAllPending(); | 273 MessageLoop::current()->RunUntilIdle(); |
274 ASSERT_EQ(1U, num_results()); | 274 ASSERT_EQ(1U, num_results()); |
275 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 275 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
276 EXPECT_EQ(0, GetPlatformFileSize()); | 276 EXPECT_EQ(0, GetPlatformFileSize()); |
277 EXPECT_EQ(100, quota_plugin_delegate()->available_space()); | 277 EXPECT_EQ(100, quota_plugin_delegate()->available_space()); |
278 reset_results(); | 278 reset_results(); |
279 | 279 |
280 SetLength(8, will_operation); | 280 SetLength(8, will_operation); |
281 MessageLoop::current()->RunAllPending(); | 281 MessageLoop::current()->RunUntilIdle(); |
282 ASSERT_EQ(1U, num_results()); | 282 ASSERT_EQ(1U, num_results()); |
283 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 283 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
284 EXPECT_EQ(100 - 8, quota_plugin_delegate()->available_space()); | 284 EXPECT_EQ(100 - 8, quota_plugin_delegate()->available_space()); |
285 reset_results(); | 285 reset_results(); |
286 | 286 |
287 if (will_operation) { | 287 if (will_operation) { |
288 EXPECT_EQ(0, GetPlatformFileSize()); | 288 EXPECT_EQ(0, GetPlatformFileSize()); |
289 SetPlatformFileSize(8); | 289 SetPlatformFileSize(8); |
290 } else { | 290 } else { |
291 EXPECT_EQ(8, GetPlatformFileSize()); | 291 EXPECT_EQ(8, GetPlatformFileSize()); |
292 } | 292 } |
293 | 293 |
294 SetLength(16, will_operation); | 294 SetLength(16, will_operation); |
295 MessageLoop::current()->RunAllPending(); | 295 MessageLoop::current()->RunUntilIdle(); |
296 ASSERT_EQ(1U, num_results()); | 296 ASSERT_EQ(1U, num_results()); |
297 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 297 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
298 EXPECT_EQ(100 - 16, quota_plugin_delegate()->available_space()); | 298 EXPECT_EQ(100 - 16, quota_plugin_delegate()->available_space()); |
299 reset_results(); | 299 reset_results(); |
300 | 300 |
301 if (will_operation) { | 301 if (will_operation) { |
302 EXPECT_EQ(8, GetPlatformFileSize()); | 302 EXPECT_EQ(8, GetPlatformFileSize()); |
303 SetPlatformFileSize(16); | 303 SetPlatformFileSize(16); |
304 } else { | 304 } else { |
305 EXPECT_EQ(16, GetPlatformFileSize()); | 305 EXPECT_EQ(16, GetPlatformFileSize()); |
306 } | 306 } |
307 | 307 |
308 SetLength(4, will_operation); | 308 SetLength(4, will_operation); |
309 MessageLoop::current()->RunAllPending(); | 309 MessageLoop::current()->RunUntilIdle(); |
310 ASSERT_EQ(1U, num_results()); | 310 ASSERT_EQ(1U, num_results()); |
311 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 311 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
312 EXPECT_EQ(100 - 4, quota_plugin_delegate()->available_space()); | 312 EXPECT_EQ(100 - 4, quota_plugin_delegate()->available_space()); |
313 reset_results(); | 313 reset_results(); |
314 | 314 |
315 if (will_operation) { | 315 if (will_operation) { |
316 EXPECT_EQ(16, GetPlatformFileSize()); | 316 EXPECT_EQ(16, GetPlatformFileSize()); |
317 SetPlatformFileSize(4); | 317 SetPlatformFileSize(4); |
318 } else { | 318 } else { |
319 EXPECT_EQ(4, GetPlatformFileSize()); | 319 EXPECT_EQ(4, GetPlatformFileSize()); |
320 } | 320 } |
321 | 321 |
322 SetLength(0, will_operation); | 322 SetLength(0, will_operation); |
323 MessageLoop::current()->RunAllPending(); | 323 MessageLoop::current()->RunUntilIdle(); |
324 ASSERT_EQ(1U, num_results()); | 324 ASSERT_EQ(1U, num_results()); |
325 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 325 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
326 EXPECT_EQ(100, quota_plugin_delegate()->available_space()); | 326 EXPECT_EQ(100, quota_plugin_delegate()->available_space()); |
327 reset_results(); | 327 reset_results(); |
328 | 328 |
329 if (will_operation) { | 329 if (will_operation) { |
330 EXPECT_EQ(4, GetPlatformFileSize()); | 330 EXPECT_EQ(4, GetPlatformFileSize()); |
331 SetPlatformFileSize(0); | 331 SetPlatformFileSize(0); |
332 } else { | 332 } else { |
333 EXPECT_EQ(0, GetPlatformFileSize()); | 333 EXPECT_EQ(0, GetPlatformFileSize()); |
334 } | 334 } |
335 | 335 |
336 quota_plugin_delegate()->set_available_space(5); | 336 quota_plugin_delegate()->set_available_space(5); |
337 | 337 |
338 // Quota error case. | 338 // Quota error case. |
339 SetLength(7, will_operation); | 339 SetLength(7, will_operation); |
340 MessageLoop::current()->RunAllPending(); | 340 MessageLoop::current()->RunUntilIdle(); |
341 ASSERT_EQ(1U, num_results()); | 341 ASSERT_EQ(1U, num_results()); |
342 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status().front()); | 342 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status().front()); |
343 EXPECT_EQ(5, quota_plugin_delegate()->available_space()); | 343 EXPECT_EQ(5, quota_plugin_delegate()->available_space()); |
344 reset_results(); | 344 reset_results(); |
345 } | 345 } |
346 | 346 |
347 QuotaMockPluginDelegate* quota_plugin_delegate() { | 347 QuotaMockPluginDelegate* quota_plugin_delegate() { |
348 return static_cast<QuotaMockPluginDelegate*>(delegate()); | 348 return static_cast<QuotaMockPluginDelegate*>(delegate()); |
349 } | 349 } |
350 | 350 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 std::string read_buffer; | 451 std::string read_buffer; |
452 | 452 |
453 const std::string data1[] = { | 453 const std::string data1[] = { |
454 std::string("12345678"), | 454 std::string("12345678"), |
455 std::string("55555"), | 455 std::string("55555"), |
456 std::string("9012345"), | 456 std::string("9012345"), |
457 }; | 457 }; |
458 Write(0, data1[0], false); | 458 Write(0, data1[0], false); |
459 Write(5, data1[1], false); | 459 Write(5, data1[1], false); |
460 Write(8, data1[2], false); | 460 Write(8, data1[2], false); |
461 MessageLoop::current()->RunAllPending(); | 461 MessageLoop::current()->RunUntilIdle(); |
462 | 462 |
463 ASSERT_EQ(ARRAYSIZE_UNSAFE(data1), num_results()); | 463 ASSERT_EQ(ARRAYSIZE_UNSAFE(data1), num_results()); |
464 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data1); ++i) { | 464 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data1); ++i) { |
465 EXPECT_EQ(static_cast<int>(data1[i].size()), bytes_written().front()); | 465 EXPECT_EQ(static_cast<int>(data1[i].size()), bytes_written().front()); |
466 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 466 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
467 pop_result(); | 467 pop_result(); |
468 } | 468 } |
469 | 469 |
470 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); | 470 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); |
471 EXPECT_EQ(15, GetPlatformFileSize()); | 471 EXPECT_EQ(15, GetPlatformFileSize()); |
472 ReadPlatformFile(&read_buffer); | 472 ReadPlatformFile(&read_buffer); |
473 EXPECT_EQ("123455559012345", read_buffer); | 473 EXPECT_EQ("123455559012345", read_buffer); |
474 | 474 |
475 // The second write will fail for quota error. | 475 // The second write will fail for quota error. |
476 const std::string data2[] = { | 476 const std::string data2[] = { |
477 std::string("33"), | 477 std::string("33"), |
478 std::string("XXXX"), | 478 std::string("XXXX"), |
479 }; | 479 }; |
480 Write(2, data2[0], false); | 480 Write(2, data2[0], false); |
481 Write(20, data2[1], false); | 481 Write(20, data2[1], false); |
482 MessageLoop::current()->RunAllPending(); | 482 MessageLoop::current()->RunUntilIdle(); |
483 | 483 |
484 ASSERT_EQ(ARRAYSIZE_UNSAFE(data2), num_results()); | 484 ASSERT_EQ(ARRAYSIZE_UNSAFE(data2), num_results()); |
485 EXPECT_EQ(static_cast<int>(data2[0].size()), bytes_written().front()); | 485 EXPECT_EQ(static_cast<int>(data2[0].size()), bytes_written().front()); |
486 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); | 486 EXPECT_EQ(base::PLATFORM_FILE_OK, status().front()); |
487 pop_result(); | 487 pop_result(); |
488 EXPECT_EQ(0, bytes_written().front()); | 488 EXPECT_EQ(0, bytes_written().front()); |
489 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status().front()); | 489 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status().front()); |
490 pop_result(); | 490 pop_result(); |
491 | 491 |
492 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); | 492 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); |
493 EXPECT_EQ(15, GetPlatformFileSize()); | 493 EXPECT_EQ(15, GetPlatformFileSize()); |
494 ReadPlatformFile(&read_buffer); | 494 ReadPlatformFile(&read_buffer); |
495 EXPECT_EQ("123355559012345", read_buffer); | 495 EXPECT_EQ("123355559012345", read_buffer); |
496 } | 496 } |
497 | 497 |
498 } // namespace ppapi | 498 } // namespace ppapi |
499 } // namespace webkit | 499 } // namespace webkit |
OLD | NEW |