OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 fileapi::FileSystemType type() { | 190 fileapi::FileSystemType type() { |
191 return fileapi::kFileSystemTypeNativeMedia; | 191 return fileapi::kFileSystemTypeNativeMedia; |
192 } | 192 } |
193 | 193 |
194 FileSystemOperation* NewOperation(const FileSystemURL& url) { | 194 FileSystemOperation* NewOperation(const FileSystemURL& url) { |
195 return file_system_context_->CreateFileSystemOperation(url, NULL); | 195 return file_system_context_->CreateFileSystemOperation(url, NULL); |
196 } | 196 } |
197 | 197 |
198 private: | 198 private: |
199 MessageLoop message_loop_; | 199 base::MessageLoop message_loop_; |
200 | 200 |
201 base::ScopedTempDir data_dir_; | 201 base::ScopedTempDir data_dir_; |
202 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 202 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
203 | 203 |
204 fileapi::FileSystemFileUtil* file_util_; | 204 fileapi::FileSystemFileUtil* file_util_; |
205 std::string filesystem_id_; | 205 std::string filesystem_id_; |
206 | 206 |
207 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtilTest); | 207 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtilTest); |
208 }; | 208 }; |
209 | 209 |
(...skipping 13 matching lines...) Expand all Loading... |
223 | 223 |
224 std::string test_name = | 224 std::string test_name = |
225 base::StringPrintf("DirectoryExistsAndFileExistsFiltering %" PRIuS, i); | 225 base::StringPrintf("DirectoryExistsAndFileExistsFiltering %" PRIuS, i); |
226 if (kFilteringTestCases[i].is_directory) { | 226 if (kFilteringTestCases[i].is_directory) { |
227 operation->DirectoryExists( | 227 operation->DirectoryExists( |
228 url, base::Bind(&ExpectEqHelper, test_name, expectation)); | 228 url, base::Bind(&ExpectEqHelper, test_name, expectation)); |
229 } else { | 229 } else { |
230 operation->FileExists( | 230 operation->FileExists( |
231 url, base::Bind(&ExpectEqHelper, test_name, expectation)); | 231 url, base::Bind(&ExpectEqHelper, test_name, expectation)); |
232 } | 232 } |
233 MessageLoop::current()->RunUntilIdle(); | 233 base::MessageLoop::current()->RunUntilIdle(); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 TEST_F(NativeMediaFileUtilTest, ReadDirectoryFiltering) { | 237 TEST_F(NativeMediaFileUtilTest, ReadDirectoryFiltering) { |
238 PopulateDirectoryWithTestCases(root_path(), | 238 PopulateDirectoryWithTestCases(root_path(), |
239 kFilteringTestCases, | 239 kFilteringTestCases, |
240 arraysize(kFilteringTestCases)); | 240 arraysize(kFilteringTestCases)); |
241 | 241 |
242 std::set<base::FilePath::StringType> content; | 242 std::set<base::FilePath::StringType> content; |
243 FileSystemURL url = CreateURL(FPL("")); | 243 FileSystemURL url = CreateURL(FPL("")); |
244 bool completed = false; | 244 bool completed = false; |
245 NewOperation(url)->ReadDirectory( | 245 NewOperation(url)->ReadDirectory( |
246 url, base::Bind(&DidReadDirectory, &content, &completed)); | 246 url, base::Bind(&DidReadDirectory, &content, &completed)); |
247 MessageLoop::current()->RunUntilIdle(); | 247 base::MessageLoop::current()->RunUntilIdle(); |
248 EXPECT_TRUE(completed); | 248 EXPECT_TRUE(completed); |
249 EXPECT_EQ(6u, content.size()); | 249 EXPECT_EQ(6u, content.size()); |
250 | 250 |
251 for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { | 251 for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { |
252 base::FilePath::StringType name = | 252 base::FilePath::StringType name = |
253 base::FilePath(kFilteringTestCases[i].path).BaseName().value(); | 253 base::FilePath(kFilteringTestCases[i].path).BaseName().value(); |
254 std::set<base::FilePath::StringType>::const_iterator found = | 254 std::set<base::FilePath::StringType>::const_iterator found = |
255 content.find(name); | 255 content.find(name); |
256 EXPECT_EQ(kFilteringTestCases[i].visible, found != content.end()); | 256 EXPECT_EQ(kFilteringTestCases[i].visible, found != content.end()); |
257 } | 257 } |
(...skipping 17 matching lines...) Expand all Loading... |
275 base::PLATFORM_FILE_OK : | 275 base::PLATFORM_FILE_OK : |
276 base::PLATFORM_FILE_ERROR_SECURITY; | 276 base::PLATFORM_FILE_ERROR_SECURITY; |
277 if (kFilteringTestCases[i].is_directory) { | 277 if (kFilteringTestCases[i].is_directory) { |
278 operation->CreateDirectory( | 278 operation->CreateDirectory( |
279 url, false, false, | 279 url, false, false, |
280 base::Bind(&ExpectEqHelper, test_name, expectation)); | 280 base::Bind(&ExpectEqHelper, test_name, expectation)); |
281 } else { | 281 } else { |
282 operation->CreateFile( | 282 operation->CreateFile( |
283 url, false, base::Bind(&ExpectEqHelper, test_name, expectation)); | 283 url, false, base::Bind(&ExpectEqHelper, test_name, expectation)); |
284 } | 284 } |
285 MessageLoop::current()->RunUntilIdle(); | 285 base::MessageLoop::current()->RunUntilIdle(); |
286 } | 286 } |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 TEST_F(NativeMediaFileUtilTest, CopySourceFiltering) { | 290 TEST_F(NativeMediaFileUtilTest, CopySourceFiltering) { |
291 base::FilePath dest_path = root_path().AppendASCII("dest"); | 291 base::FilePath dest_path = root_path().AppendASCII("dest"); |
292 FileSystemURL dest_url = CreateURL(FPL("dest")); | 292 FileSystemURL dest_url = CreateURL(FPL("dest")); |
293 | 293 |
294 // Run the loop twice. The first run has no source files. The second run does. | 294 // Run the loop twice. The first run has no source files. The second run does. |
295 for (int loop_count = 0; loop_count < 2; ++loop_count) { | 295 for (int loop_count = 0; loop_count < 2; ++loop_count) { |
(...skipping 18 matching lines...) Expand all Loading... |
314 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; | 314 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; |
315 if (loop_count == 0 || !kFilteringTestCases[i].visible) { | 315 if (loop_count == 0 || !kFilteringTestCases[i].visible) { |
316 // If the source does not exist or is not visible. | 316 // If the source does not exist or is not visible. |
317 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; | 317 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; |
318 } else if (!kFilteringTestCases[i].is_directory) { | 318 } else if (!kFilteringTestCases[i].is_directory) { |
319 // Cannot copy a visible file to a directory. | 319 // Cannot copy a visible file to a directory. |
320 expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 320 expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
321 } | 321 } |
322 operation->Copy( | 322 operation->Copy( |
323 url, dest_url, base::Bind(&ExpectEqHelper, test_name, expectation)); | 323 url, dest_url, base::Bind(&ExpectEqHelper, test_name, expectation)); |
324 MessageLoop::current()->RunUntilIdle(); | 324 base::MessageLoop::current()->RunUntilIdle(); |
325 } | 325 } |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
329 TEST_F(NativeMediaFileUtilTest, CopyDestFiltering) { | 329 TEST_F(NativeMediaFileUtilTest, CopyDestFiltering) { |
330 // Run the loop twice. The first run has no destination files. | 330 // Run the loop twice. The first run has no destination files. |
331 // The second run does. | 331 // The second run does. |
332 for (int loop_count = 0; loop_count < 2; ++loop_count) { | 332 for (int loop_count = 0; loop_count < 2; ++loop_count) { |
333 if (loop_count == 1) { | 333 if (loop_count == 1) { |
334 // Reset the test directory between the two loops to remove old | 334 // Reset the test directory between the two loops to remove old |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } else if (kFilteringTestCases[i].is_directory) { | 380 } else if (kFilteringTestCases[i].is_directory) { |
381 // Cannot copy a file to a directory. | 381 // Cannot copy a file to a directory. |
382 expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 382 expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
383 } else { | 383 } else { |
384 // Copying from a file to a visible file that exists is ok. | 384 // Copying from a file to a visible file that exists is ok. |
385 expectation = base::PLATFORM_FILE_OK; | 385 expectation = base::PLATFORM_FILE_OK; |
386 } | 386 } |
387 } | 387 } |
388 operation->Copy( | 388 operation->Copy( |
389 src_url, url, base::Bind(&ExpectEqHelper, test_name, expectation)); | 389 src_url, url, base::Bind(&ExpectEqHelper, test_name, expectation)); |
390 MessageLoop::current()->RunUntilIdle(); | 390 base::MessageLoop::current()->RunUntilIdle(); |
391 } | 391 } |
392 } | 392 } |
393 } | 393 } |
394 | 394 |
395 TEST_F(NativeMediaFileUtilTest, MoveSourceFiltering) { | 395 TEST_F(NativeMediaFileUtilTest, MoveSourceFiltering) { |
396 base::FilePath dest_path = root_path().AppendASCII("dest"); | 396 base::FilePath dest_path = root_path().AppendASCII("dest"); |
397 FileSystemURL dest_url = CreateURL(FPL("dest")); | 397 FileSystemURL dest_url = CreateURL(FPL("dest")); |
398 | 398 |
399 // Run the loop twice. The first run has no source files. The second run does. | 399 // Run the loop twice. The first run has no source files. The second run does. |
400 for (int loop_count = 0; loop_count < 2; ++loop_count) { | 400 for (int loop_count = 0; loop_count < 2; ++loop_count) { |
(...skipping 18 matching lines...) Expand all Loading... |
419 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; | 419 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; |
420 if (loop_count == 0 || !kFilteringTestCases[i].visible) { | 420 if (loop_count == 0 || !kFilteringTestCases[i].visible) { |
421 // If the source does not exist or is not visible. | 421 // If the source does not exist or is not visible. |
422 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; | 422 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; |
423 } else if (!kFilteringTestCases[i].is_directory) { | 423 } else if (!kFilteringTestCases[i].is_directory) { |
424 // Cannot move a visible file to a directory. | 424 // Cannot move a visible file to a directory. |
425 expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 425 expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
426 } | 426 } |
427 operation->Move( | 427 operation->Move( |
428 url, dest_url, base::Bind(&ExpectEqHelper, test_name, expectation)); | 428 url, dest_url, base::Bind(&ExpectEqHelper, test_name, expectation)); |
429 MessageLoop::current()->RunUntilIdle(); | 429 base::MessageLoop::current()->RunUntilIdle(); |
430 } | 430 } |
431 } | 431 } |
432 } | 432 } |
433 | 433 |
434 TEST_F(NativeMediaFileUtilTest, MoveDestFiltering) { | 434 TEST_F(NativeMediaFileUtilTest, MoveDestFiltering) { |
435 // Run the loop twice. The first run has no destination files. | 435 // Run the loop twice. The first run has no destination files. |
436 // The second run does. | 436 // The second run does. |
437 for (int loop_count = 0; loop_count < 2; ++loop_count) { | 437 for (int loop_count = 0; loop_count < 2; ++loop_count) { |
438 if (loop_count == 1) { | 438 if (loop_count == 1) { |
439 // Reset the test directory between the two loops to remove old | 439 // Reset the test directory between the two loops to remove old |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 } else if (kFilteringTestCases[i].is_directory) { | 487 } else if (kFilteringTestCases[i].is_directory) { |
488 // Cannot move a file to a directory. | 488 // Cannot move a file to a directory. |
489 expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 489 expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
490 } else { | 490 } else { |
491 // Moving from a file to a visible file that exists is ok. | 491 // Moving from a file to a visible file that exists is ok. |
492 expectation = base::PLATFORM_FILE_OK; | 492 expectation = base::PLATFORM_FILE_OK; |
493 } | 493 } |
494 } | 494 } |
495 operation->Move( | 495 operation->Move( |
496 src_url, url, base::Bind(&ExpectEqHelper, test_name, expectation)); | 496 src_url, url, base::Bind(&ExpectEqHelper, test_name, expectation)); |
497 MessageLoop::current()->RunUntilIdle(); | 497 base::MessageLoop::current()->RunUntilIdle(); |
498 } | 498 } |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 TEST_F(NativeMediaFileUtilTest, GetMetadataFiltering) { | 502 TEST_F(NativeMediaFileUtilTest, GetMetadataFiltering) { |
503 // Run the loop twice. The first run has no files. The second run does. | 503 // Run the loop twice. The first run has no files. The second run does. |
504 for (int loop_count = 0; loop_count < 2; ++loop_count) { | 504 for (int loop_count = 0; loop_count < 2; ++loop_count) { |
505 if (loop_count == 1) { | 505 if (loop_count == 1) { |
506 PopulateDirectoryWithTestCases(root_path(), | 506 PopulateDirectoryWithTestCases(root_path(), |
507 kFilteringTestCases, | 507 kFilteringTestCases, |
(...skipping 10 matching lines...) Expand all Loading... |
518 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; | 518 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; |
519 if (loop_count == 0 || !kFilteringTestCases[i].visible) { | 519 if (loop_count == 0 || !kFilteringTestCases[i].visible) { |
520 // Cannot get metadata from files that do not exist or are not visible. | 520 // Cannot get metadata from files that do not exist or are not visible. |
521 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; | 521 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; |
522 } | 522 } |
523 operation->GetMetadata(url, | 523 operation->GetMetadata(url, |
524 base::Bind(&ExpectMetadataEqHelper, | 524 base::Bind(&ExpectMetadataEqHelper, |
525 test_name, | 525 test_name, |
526 expectation, | 526 expectation, |
527 kFilteringTestCases[i].is_directory)); | 527 kFilteringTestCases[i].is_directory)); |
528 MessageLoop::current()->RunUntilIdle(); | 528 base::MessageLoop::current()->RunUntilIdle(); |
529 } | 529 } |
530 } | 530 } |
531 } | 531 } |
532 | 532 |
533 TEST_F(NativeMediaFileUtilTest, RemoveFiltering) { | 533 TEST_F(NativeMediaFileUtilTest, RemoveFiltering) { |
534 // Run the loop twice. The first run has no files. The second run does. | 534 // Run the loop twice. The first run has no files. The second run does. |
535 for (int loop_count = 0; loop_count < 2; ++loop_count) { | 535 for (int loop_count = 0; loop_count < 2; ++loop_count) { |
536 if (loop_count == 1) { | 536 if (loop_count == 1) { |
537 PopulateDirectoryWithTestCases(root_path(), | 537 PopulateDirectoryWithTestCases(root_path(), |
538 kFilteringTestCases, | 538 kFilteringTestCases, |
539 arraysize(kFilteringTestCases)); | 539 arraysize(kFilteringTestCases)); |
540 } | 540 } |
541 for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { | 541 for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { |
542 FileSystemURL root_url = CreateURL(FPL("")); | 542 FileSystemURL root_url = CreateURL(FPL("")); |
543 FileSystemOperation* operation = NewOperation(root_url); | 543 FileSystemOperation* operation = NewOperation(root_url); |
544 | 544 |
545 FileSystemURL url = CreateURL(kFilteringTestCases[i].path); | 545 FileSystemURL url = CreateURL(kFilteringTestCases[i].path); |
546 | 546 |
547 std::string test_name = base::StringPrintf( | 547 std::string test_name = base::StringPrintf( |
548 "RemoveFiltering run %d test %" PRIuS, loop_count, i); | 548 "RemoveFiltering run %d test %" PRIuS, loop_count, i); |
549 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; | 549 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; |
550 if (loop_count == 0 || !kFilteringTestCases[i].visible) { | 550 if (loop_count == 0 || !kFilteringTestCases[i].visible) { |
551 // Cannot remove files that do not exist or are not visible. | 551 // Cannot remove files that do not exist or are not visible. |
552 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; | 552 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; |
553 } | 553 } |
554 operation->Remove( | 554 operation->Remove( |
555 url, false, base::Bind(&ExpectEqHelper, test_name, expectation)); | 555 url, false, base::Bind(&ExpectEqHelper, test_name, expectation)); |
556 MessageLoop::current()->RunUntilIdle(); | 556 base::MessageLoop::current()->RunUntilIdle(); |
557 } | 557 } |
558 } | 558 } |
559 } | 559 } |
560 | 560 |
561 TEST_F(NativeMediaFileUtilTest, TruncateFiltering) { | 561 TEST_F(NativeMediaFileUtilTest, TruncateFiltering) { |
562 // Run the loop twice. The first run has no files. The second run does. | 562 // Run the loop twice. The first run has no files. The second run does. |
563 for (int loop_count = 0; loop_count < 2; ++loop_count) { | 563 for (int loop_count = 0; loop_count < 2; ++loop_count) { |
564 if (loop_count == 1) { | 564 if (loop_count == 1) { |
565 PopulateDirectoryWithTestCases(root_path(), | 565 PopulateDirectoryWithTestCases(root_path(), |
566 kFilteringTestCases, | 566 kFilteringTestCases, |
(...skipping 10 matching lines...) Expand all Loading... |
577 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; | 577 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; |
578 if (loop_count == 0 || !kFilteringTestCases[i].visible) { | 578 if (loop_count == 0 || !kFilteringTestCases[i].visible) { |
579 // Cannot truncate files that do not exist or are not visible. | 579 // Cannot truncate files that do not exist or are not visible. |
580 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; | 580 expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND; |
581 } else if (kFilteringTestCases[i].is_directory) { | 581 } else if (kFilteringTestCases[i].is_directory) { |
582 // Cannot truncate directories. | 582 // Cannot truncate directories. |
583 expectation = base::PLATFORM_FILE_ERROR_ACCESS_DENIED; | 583 expectation = base::PLATFORM_FILE_ERROR_ACCESS_DENIED; |
584 } | 584 } |
585 operation->Truncate( | 585 operation->Truncate( |
586 url, 0, base::Bind(&ExpectEqHelper, test_name, expectation)); | 586 url, 0, base::Bind(&ExpectEqHelper, test_name, expectation)); |
587 MessageLoop::current()->RunUntilIdle(); | 587 base::MessageLoop::current()->RunUntilIdle(); |
588 } | 588 } |
589 } | 589 } |
590 } | 590 } |
591 | 591 |
592 TEST_F(NativeMediaFileUtilTest, TouchFileFiltering) { | 592 TEST_F(NativeMediaFileUtilTest, TouchFileFiltering) { |
593 base::Time time = base::Time::Now(); | 593 base::Time time = base::Time::Now(); |
594 | 594 |
595 // Run the loop twice. The first run has no files. The second run does. | 595 // Run the loop twice. The first run has no files. The second run does. |
596 for (int loop_count = 0; loop_count < 2; ++loop_count) { | 596 for (int loop_count = 0; loop_count < 2; ++loop_count) { |
597 if (loop_count == 1) { | 597 if (loop_count == 1) { |
598 PopulateDirectoryWithTestCases(root_path(), | 598 PopulateDirectoryWithTestCases(root_path(), |
599 kFilteringTestCases, | 599 kFilteringTestCases, |
600 arraysize(kFilteringTestCases)); | 600 arraysize(kFilteringTestCases)); |
601 } | 601 } |
602 for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { | 602 for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { |
603 FileSystemURL root_url = CreateURL(FPL("")); | 603 FileSystemURL root_url = CreateURL(FPL("")); |
604 FileSystemOperation* operation = NewOperation(root_url); | 604 FileSystemOperation* operation = NewOperation(root_url); |
605 | 605 |
606 FileSystemURL url = CreateURL(kFilteringTestCases[i].path); | 606 FileSystemURL url = CreateURL(kFilteringTestCases[i].path); |
607 | 607 |
608 std::string test_name = base::StringPrintf( | 608 std::string test_name = base::StringPrintf( |
609 "TouchFileFiltering run %d test %" PRIuS, loop_count, i); | 609 "TouchFileFiltering run %d test %" PRIuS, loop_count, i); |
610 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; | 610 base::PlatformFileError expectation = base::PLATFORM_FILE_OK; |
611 if (loop_count == 0 || !kFilteringTestCases[i].visible) { | 611 if (loop_count == 0 || !kFilteringTestCases[i].visible) { |
612 // Files do not exists. Touch fails. | 612 // Files do not exists. Touch fails. |
613 expectation = base::PLATFORM_FILE_ERROR_FAILED; | 613 expectation = base::PLATFORM_FILE_ERROR_FAILED; |
614 } | 614 } |
615 operation->TouchFile( | 615 operation->TouchFile( |
616 url, time, time, base::Bind(&ExpectEqHelper, test_name, expectation)); | 616 url, time, time, base::Bind(&ExpectEqHelper, test_name, expectation)); |
617 MessageLoop::current()->RunUntilIdle(); | 617 base::MessageLoop::current()->RunUntilIdle(); |
618 } | 618 } |
619 } | 619 } |
620 } | 620 } |
621 | 621 |
622 void CreateSnapshotCallback(base::PlatformFileError* error, | 622 void CreateSnapshotCallback(base::PlatformFileError* error, |
623 base::PlatformFileError result, const base::PlatformFileInfo&, | 623 base::PlatformFileError result, const base::PlatformFileInfo&, |
624 const base::FilePath&, | 624 const base::FilePath&, |
625 const scoped_refptr<webkit_blob::ShareableFileReference>&) { | 625 const scoped_refptr<webkit_blob::ShareableFileReference>&) { |
626 *error = result; | 626 *error = result; |
627 } | 627 } |
(...skipping 11 matching lines...) Expand all Loading... |
639 FileSystemOperation* operation = NewOperation(root_url); | 639 FileSystemOperation* operation = NewOperation(root_url); |
640 FileSystemURL url = CreateURL(kFilteringTestCases[i].path); | 640 FileSystemURL url = CreateURL(kFilteringTestCases[i].path); |
641 base::PlatformFileError expected_error, error; | 641 base::PlatformFileError expected_error, error; |
642 if (kFilteringTestCases[i].media_file) | 642 if (kFilteringTestCases[i].media_file) |
643 expected_error = base::PLATFORM_FILE_OK; | 643 expected_error = base::PLATFORM_FILE_OK; |
644 else | 644 else |
645 expected_error = base::PLATFORM_FILE_ERROR_SECURITY; | 645 expected_error = base::PLATFORM_FILE_ERROR_SECURITY; |
646 error = base::PLATFORM_FILE_ERROR_FAILED; | 646 error = base::PLATFORM_FILE_ERROR_FAILED; |
647 operation->CreateSnapshotFile(url, | 647 operation->CreateSnapshotFile(url, |
648 base::Bind(CreateSnapshotCallback, &error)); | 648 base::Bind(CreateSnapshotCallback, &error)); |
649 MessageLoop::current()->RunUntilIdle(); | 649 base::MessageLoop::current()->RunUntilIdle(); |
650 ASSERT_EQ(expected_error, error); | 650 ASSERT_EQ(expected_error, error); |
651 } | 651 } |
652 } | 652 } |
653 | 653 |
654 } // namespace chrome | 654 } // namespace chrome |
OLD | NEW |