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

Side by Side Diff: chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc

Issue 1455403003: Add an option to specify requested fields for fetching metadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up. Created 5 years, 1 month 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 (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/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 FileSystemURL url = CreateURL(kFilteringTestCases[i].path); 493 FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
494 494
495 std::string test_name = base::StringPrintf( 495 std::string test_name = base::StringPrintf(
496 "GetMetadataFiltering run %d test %" PRIuS, loop_count, i); 496 "GetMetadataFiltering run %d test %" PRIuS, loop_count, i);
497 base::File::Error expectation = base::File::FILE_OK; 497 base::File::Error expectation = base::File::FILE_OK;
498 if (loop_count == 0 || !kFilteringTestCases[i].visible) { 498 if (loop_count == 0 || !kFilteringTestCases[i].visible) {
499 // Cannot get metadata from files that do not exist or are not visible. 499 // Cannot get metadata from files that do not exist or are not visible.
500 expectation = base::File::FILE_ERROR_NOT_FOUND; 500 expectation = base::File::FILE_ERROR_NOT_FOUND;
501 } 501 }
502 operation_runner()->GetMetadata( 502 operation_runner()->GetMetadata(
503 url, 503 url, storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY,
504 base::Bind(&ExpectMetadataEqHelper, 504 base::Bind(&ExpectMetadataEqHelper, test_name, expectation,
505 test_name,
506 expectation,
507 kFilteringTestCases[i].is_directory)); 505 kFilteringTestCases[i].is_directory));
508 base::MessageLoop::current()->RunUntilIdle(); 506 base::MessageLoop::current()->RunUntilIdle();
509 } 507 }
510 } 508 }
511 } 509 }
512 510
513 TEST_F(NativeMediaFileUtilTest, RemoveFileFiltering) { 511 TEST_F(NativeMediaFileUtilTest, RemoveFileFiltering) {
514 // Run the loop twice. The first run has no files. The second run does. 512 // Run the loop twice. The first run has no files. The second run does.
515 for (int loop_count = 0; loop_count < 2; ++loop_count) { 513 for (int loop_count = 0; loop_count < 2; ++loop_count) {
516 if (loop_count == 1) { 514 if (loop_count == 1) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 expected_error = base::File::FILE_OK; 561 expected_error = base::File::FILE_OK;
564 else 562 else
565 expected_error = base::File::FILE_ERROR_SECURITY; 563 expected_error = base::File::FILE_ERROR_SECURITY;
566 error = base::File::FILE_ERROR_FAILED; 564 error = base::File::FILE_ERROR_FAILED;
567 operation_runner()->CreateSnapshotFile(url, 565 operation_runner()->CreateSnapshotFile(url,
568 base::Bind(CreateSnapshotCallback, &error)); 566 base::Bind(CreateSnapshotCallback, &error));
569 base::MessageLoop::current()->RunUntilIdle(); 567 base::MessageLoop::current()->RunUntilIdle();
570 ASSERT_EQ(expected_error, error); 568 ASSERT_EQ(expected_error, error);
571 } 569 }
572 } 570 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698