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

Side by Side Diff: chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 base::Bind(&MediaFileValidatorTest::OnCheckFilesFirstResult, 170 base::Bind(&MediaFileValidatorTest::OnCheckFilesFirstResult,
171 base::Unretained(this), !src_expected, callback)); 171 base::Unretained(this), !src_expected, callback));
172 } 172 }
173 173
174 // Helper that checks a file has the |expected_size|, which may be 174 // Helper that checks a file has the |expected_size|, which may be
175 // |kNoFileSize| if the file should not exist. |callback| is called 175 // |kNoFileSize| if the file should not exist. |callback| is called
176 // with success/failure. 176 // with success/failure.
177 void CheckFile(storage::FileSystemURL url, 177 void CheckFile(storage::FileSystemURL url,
178 int64 expected_size, 178 int64 expected_size,
179 const base::Callback<void(bool success)>& callback) { 179 const base::Callback<void(bool success)>& callback) {
180 operation_runner()->GetMetadata(url, 180 operation_runner()->GetMetadata(
181 base::Bind(&HandleCheckFileResult, 181 url, storage::FileSystemOperation::GET_METADATA_FIELD_SIZE,
182 expected_size, callback)); 182 base::Bind(&HandleCheckFileResult, expected_size, callback));
183 } 183 }
184 184
185 // Helper that checks the result of |move_src_| lookup and then checks 185 // Helper that checks the result of |move_src_| lookup and then checks
186 // |move_dest_| if all is as expected. 186 // |move_dest_| if all is as expected.
187 void OnCheckFilesFirstResult(bool dest_expected, 187 void OnCheckFilesFirstResult(bool dest_expected,
188 const base::Callback<void(bool)>& callback, 188 const base::Callback<void(bool)>& callback,
189 bool src_result) { 189 bool src_result) {
190 EXPECT_TRUE(src_result); 190 EXPECT_TRUE(src_result);
191 if (!src_result) { 191 if (!src_result) {
192 callback.Run(false); 192 callback.Run(false);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 test_file = test_file.AppendASCII("no_streams.webm"); 277 test_file = test_file.AppendASCII("no_streams.webm");
278 MoveTestFromFile("no_streams.webm", test_file, false); 278 MoveTestFromFile("no_streams.webm", test_file, false);
279 } 279 }
280 280
281 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { 281 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) {
282 base::FilePath test_file = GetMediaTestDir(); 282 base::FilePath test_file = GetMediaTestDir();
283 ASSERT_FALSE(test_file.empty()); 283 ASSERT_FALSE(test_file.empty());
284 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); 284 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm");
285 MoveTestFromFile("multitrack.webm", test_file, true); 285 MoveTestFromFile("multitrack.webm", test_file, true);
286 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698