1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570
|
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <array>
#include "base/containers/span.h"
#include "chrome/browser/media_galleries/fileapi/native_media_file_util.h"
#include <stddef.h>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "storage/browser/blob/shareable_file_reference.h"
#include "storage/browser/file_system/copy_or_move_hook_delegate.h"
#include "storage/browser/file_system/external_mount_points.h"
#include "storage/browser/file_system/file_system_backend.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_operation.h"
#include "storage/browser/file_system/file_system_operation_runner.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/browser/file_system/isolated_context.h"
#include "storage/browser/file_system/native_file_util.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/mock_special_storage_policy.h"
#include "storage/browser/test/test_file_system_options.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/gurl.h"
#include "url/origin.h"
#define FPL(x) FILE_PATH_LITERAL(x)
using storage::FileSystemOperation;
using storage::FileSystemURL;
namespace {
typedef FileSystemOperation::FileEntryList FileEntryList;
struct FilteringTestCase {
const base::FilePath::CharType* path;
bool is_directory;
bool visible;
bool media_file;
const char* content;
};
const auto kFilteringTestCases = std::to_array<FilteringTestCase>({
// Directory should always be visible.
{FPL("hoge"), true, true, false, nullptr},
{FPL("fuga.jpg"), true, true, false, nullptr},
{FPL("piyo.txt"), true, true, false, nullptr},
{FPL("moga.cod"), true, true, false, nullptr},
// File should be visible if it's a supported media file.
// File without extension.
{FPL("foo"), false, false, false, "abc"},
// Supported media file.
{FPL("bar.jpg"), false, true, true, "\xFF\xD8\xFF"},
// Unsupported masquerading file.
{FPL("sna.jpg"), false, true, false, "abc"},
// Non-media file.
{FPL("baz.txt"), false, false, false, "abc"},
// Unsupported media file.
{FPL("foobar.cod"), false, false, false, "abc"},
});
void ExpectEqHelper(const std::string& test_name,
base::File::Error expected,
base::File::Error actual) {
EXPECT_EQ(expected, actual) << test_name;
}
void ExpectMetadataEqHelper(const std::string& test_name,
base::File::Error expected,
bool expected_is_directory,
base::File::Error actual,
const base::File::Info& file_info) {
EXPECT_EQ(expected, actual) << test_name;
if (actual == base::File::FILE_OK)
EXPECT_EQ(expected_is_directory, file_info.is_directory) << test_name;
}
void DidReadDirectory(std::set<base::FilePath::StringType>* content,
bool* completed,
base::File::Error error,
FileEntryList file_list,
bool has_more) {
EXPECT_TRUE(!*completed);
*completed = !has_more;
for (const auto& entry : file_list)
EXPECT_TRUE(content->insert(entry.name.value()).second);
}
void PopulateDirectoryWithTestCases(
const base::FilePath& dir,
base::span<const FilteringTestCase> test_cases,
size_t n) {
for (size_t i = 0; i < n; ++i) {
base::FilePath path = dir.Append(test_cases[i].path);
if (test_cases[i].is_directory) {
ASSERT_TRUE(base::CreateDirectory(path));
} else {
ASSERT_TRUE(test_cases[i].content);
ASSERT_TRUE(base::WriteFile(path, test_cases[i].content));
}
}
}
} // namespace
class NativeMediaFileUtilTest : public testing::Test {
public:
NativeMediaFileUtilTest() = default;
NativeMediaFileUtilTest(const NativeMediaFileUtilTest&) = delete;
NativeMediaFileUtilTest& operator=(const NativeMediaFileUtilTest&) = delete;
void SetUp() override {
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
ASSERT_TRUE(base::CreateDirectory(root_path()));
auto storage_policy =
base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
std::vector<std::unique_ptr<storage::FileSystemBackend>>
additional_providers;
additional_providers.push_back(std::make_unique<MediaFileSystemBackend>(
data_dir_.GetPath(), base::NullCallback()));
file_system_context_ = storage::FileSystemContext::Create(
content::GetIOThreadTaskRunner({}),
base::SequencedTaskRunner::GetCurrentDefault(),
storage::ExternalMountPoints::CreateRefCounted(),
std::move(storage_policy),
/* quota_manager_proxy=*/nullptr, std::move(additional_providers),
std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.GetPath(),
storage::CreateAllowFileAccessOptions());
filesystem_ = isolated_context()->RegisterFileSystemForPath(
storage::kFileSystemTypeLocalMedia, std::string(), root_path(),
nullptr);
filesystem_id_ = filesystem_.id();
}
void TearDown() override { file_system_context_.reset(); }
protected:
storage::FileSystemContext* file_system_context() {
return file_system_context_.get();
}
FileSystemURL CreateURL(const base::FilePath::CharType* test_case_path) {
return file_system_context_->CreateCrackedFileSystemURL(
blink::StorageKey::CreateFirstParty(url::Origin::Create(origin())),
storage::kFileSystemTypeIsolated, GetVirtualPath(test_case_path));
}
storage::IsolatedContext* isolated_context() {
return storage::IsolatedContext::GetInstance();
}
base::FilePath root_path() {
return data_dir_.GetPath().Append(FPL("Media Directory"));
}
base::FilePath GetVirtualPath(
const base::FilePath::CharType* test_case_path) {
return base::FilePath::FromUTF8Unsafe(filesystem_id_)
.Append(FPL("Media Directory"))
.Append(base::FilePath(test_case_path));
}
GURL origin() { return GURL("http://example.com"); }
storage::FileSystemType type() { return storage::kFileSystemTypeLocalMedia; }
storage::FileSystemOperationRunner* operation_runner() {
return file_system_context_->operation_runner();
}
content::BrowserTaskEnvironment task_environment_;
private:
base::ScopedTempDir data_dir_;
scoped_refptr<storage::FileSystemContext> file_system_context_;
std::string filesystem_id_;
storage::IsolatedContext::ScopedFSHandle filesystem_;
};
TEST_F(NativeMediaFileUtilTest, DirectoryExistsAndFileExistsFiltering) {
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
base::File::Error expectation = kFilteringTestCases[i].visible
? base::File::FILE_OK
: base::File::FILE_ERROR_NOT_FOUND;
std::string test_name =
base::StringPrintf("DirectoryExistsAndFileExistsFiltering %" PRIuS, i);
if (kFilteringTestCases[i].is_directory) {
operation_runner()->DirectoryExists(
url, base::BindOnce(&ExpectEqHelper, test_name, expectation));
} else {
operation_runner()->FileExists(
url, base::BindOnce(&ExpectEqHelper, test_name, expectation));
}
content::RunAllTasksUntilIdle();
}
}
TEST_F(NativeMediaFileUtilTest, ReadDirectoryFiltering) {
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
std::set<base::FilePath::StringType> content;
FileSystemURL url = CreateURL(FPL(""));
bool completed = false;
operation_runner()->ReadDirectory(
url, base::BindRepeating(&DidReadDirectory, &content, &completed));
content::RunAllTasksUntilIdle();
EXPECT_TRUE(completed);
EXPECT_EQ(6u, content.size());
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
base::FilePath::StringType name =
base::FilePath(kFilteringTestCases[i].path).BaseName().value();
auto found = content.find(name);
EXPECT_EQ(kFilteringTestCases[i].visible, found != content.end());
}
}
TEST_F(NativeMediaFileUtilTest, CreateDirectoryFiltering) {
// Run the loop twice. The second loop attempts to create directories that are
// pre-existing. Though the result should be the same.
for (int loop_count = 0; loop_count < 2; ++loop_count) {
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
if (kFilteringTestCases[i].is_directory) {
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
std::string test_name = base::StringPrintf(
"CreateFileAndCreateDirectoryFiltering run %d, test %" PRIuS,
loop_count, i);
base::File::Error expectation = kFilteringTestCases[i].visible
? base::File::FILE_OK
: base::File::FILE_ERROR_SECURITY;
operation_runner()->CreateDirectory(
url, false, false,
base::BindOnce(&ExpectEqHelper, test_name, expectation));
}
content::RunAllTasksUntilIdle();
}
}
}
TEST_F(NativeMediaFileUtilTest, CopySourceFiltering) {
base::FilePath dest_path = root_path().AppendASCII("dest");
FileSystemURL dest_url = CreateURL(FPL("dest"));
// Run the loop twice. The first run has no source files. The second run does.
for (int loop_count = 0; loop_count < 2; ++loop_count) {
if (loop_count == 1) {
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
}
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
// Always start with an empty destination directory.
// Copying to a non-empty destination directory is an invalid operation.
ASSERT_TRUE(base::DeletePathRecursively(dest_path));
ASSERT_TRUE(base::CreateDirectory(dest_path));
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
std::string test_name = base::StringPrintf(
"CopySourceFiltering run %d test %" PRIuS, loop_count, i);
base::File::Error expectation = base::File::FILE_OK;
if (loop_count == 0 || !kFilteringTestCases[i].visible) {
// If the source does not exist or is not visible.
expectation = base::File::FILE_ERROR_NOT_FOUND;
} else if (!kFilteringTestCases[i].is_directory) {
// Cannot copy a visible file to a directory.
expectation = base::File::FILE_ERROR_INVALID_OPERATION;
}
operation_runner()->Copy(
url, dest_url, storage::FileSystemOperation::CopyOrMoveOptionSet(),
storage::FileSystemOperation::ERROR_BEHAVIOR_ABORT,
std::make_unique<storage::CopyOrMoveHookDelegate>(),
base::BindOnce(&ExpectEqHelper, test_name, expectation));
content::RunAllTasksUntilIdle();
}
}
}
TEST_F(NativeMediaFileUtilTest, CopyDestFiltering) {
// Run the loop twice. The first run has no destination files.
// The second run does.
for (int loop_count = 0; loop_count < 2; ++loop_count) {
if (loop_count == 1) {
// Reset the test directory between the two loops to remove old
// directories and create new ones that should pre-exist.
ASSERT_TRUE(base::DeletePathRecursively(root_path()));
ASSERT_TRUE(base::CreateDirectory(root_path()));
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
}
// Always create a dummy source data file.
base::FilePath src_path = root_path().AppendASCII("foo.jpg");
FileSystemURL src_url = CreateURL(FPL("foo.jpg"));
static const char kDummyData[] = "dummy";
ASSERT_TRUE(base::WriteFile(src_path, kDummyData));
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
if (loop_count == 0 && kFilteringTestCases[i].is_directory) {
// These directories do not exist in this case, so Copy() will not
// treat them as directories. Thus invalidating these test cases.
continue;
}
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
std::string test_name = base::StringPrintf(
"CopyDestFiltering run %d test %" PRIuS, loop_count, i);
base::File::Error expectation;
if (loop_count == 0) {
// The destination path is a file here. The directory case has been
// handled above.
// If the destination path does not exist and is not visible, then
// creating it would be a security violation.
expectation = kFilteringTestCases[i].visible
? base::File::FILE_OK
: base::File::FILE_ERROR_SECURITY;
} else {
if (!kFilteringTestCases[i].visible) {
// If the destination path exist and is not visible, then to the copy
// operation, it looks like the file needs to be created, which is a
// security violation.
expectation = base::File::FILE_ERROR_SECURITY;
} else if (kFilteringTestCases[i].is_directory) {
// Cannot copy a file to a directory.
expectation = base::File::FILE_ERROR_INVALID_OPERATION;
} else {
// Copying from a file to a visible file that exists is ok.
expectation = base::File::FILE_OK;
}
}
operation_runner()->Copy(
src_url, url, storage::FileSystemOperation::CopyOrMoveOptionSet(),
storage::FileSystemOperation::ERROR_BEHAVIOR_ABORT,
std::make_unique<storage::CopyOrMoveHookDelegate>(),
base::BindOnce(&ExpectEqHelper, test_name, expectation));
content::RunAllTasksUntilIdle();
}
}
}
TEST_F(NativeMediaFileUtilTest, MoveSourceFiltering) {
base::FilePath dest_path = root_path().AppendASCII("dest");
FileSystemURL dest_url = CreateURL(FPL("dest"));
// Run the loop twice. The first run has no source files. The second run does.
for (int loop_count = 0; loop_count < 2; ++loop_count) {
if (loop_count == 1) {
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
}
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
// Always start with an empty destination directory.
// Moving to a non-empty destination directory is an invalid operation.
ASSERT_TRUE(base::DeletePathRecursively(dest_path));
ASSERT_TRUE(base::CreateDirectory(dest_path));
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
std::string test_name = base::StringPrintf(
"MoveSourceFiltering run %d test %" PRIuS, loop_count, i);
base::File::Error expectation = base::File::FILE_OK;
if (loop_count == 0 || !kFilteringTestCases[i].visible) {
// If the source does not exist or is not visible.
expectation = base::File::FILE_ERROR_NOT_FOUND;
} else if (!kFilteringTestCases[i].is_directory) {
// Cannot move a visible file to a directory.
expectation = base::File::FILE_ERROR_INVALID_OPERATION;
}
operation_runner()->Move(
url, dest_url, storage::FileSystemOperation::CopyOrMoveOptionSet(),
storage::FileSystemOperation::ERROR_BEHAVIOR_ABORT,
std::make_unique<storage::CopyOrMoveHookDelegate>(),
base::BindOnce(&ExpectEqHelper, test_name, expectation));
content::RunAllTasksUntilIdle();
}
}
}
TEST_F(NativeMediaFileUtilTest, MoveDestFiltering) {
// Run the loop twice. The first run has no destination files.
// The second run does.
for (int loop_count = 0; loop_count < 2; ++loop_count) {
if (loop_count == 1) {
// Reset the test directory between the two loops to remove old
// directories and create new ones that should pre-exist.
ASSERT_TRUE(base::DeletePathRecursively(root_path()));
ASSERT_TRUE(base::CreateDirectory(root_path()));
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
}
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
if (loop_count == 0 && kFilteringTestCases[i].is_directory) {
// These directories do not exist in this case, so Copy() will not
// treat them as directories. Thus invalidating these test cases.
continue;
}
// Create the source file for every test case because it might get moved.
base::FilePath src_path = root_path().AppendASCII("foo.jpg");
FileSystemURL src_url = CreateURL(FPL("foo.jpg"));
static const char kDummyData[] = "dummy";
ASSERT_TRUE(base::WriteFile(src_path, kDummyData));
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
std::string test_name = base::StringPrintf(
"MoveDestFiltering run %d test %" PRIuS, loop_count, i);
base::File::Error expectation;
if (loop_count == 0) {
// The destination path is a file here. The directory case has been
// handled above.
// If the destination path does not exist and is not visible, then
// creating it would be a security violation.
expectation = kFilteringTestCases[i].visible
? base::File::FILE_OK
: base::File::FILE_ERROR_SECURITY;
} else {
if (!kFilteringTestCases[i].visible) {
// If the destination path exist and is not visible, then to the move
// operation, it looks like the file needs to be created, which is a
// security violation.
expectation = base::File::FILE_ERROR_SECURITY;
} else if (kFilteringTestCases[i].is_directory) {
// Cannot move a file to a directory.
expectation = base::File::FILE_ERROR_INVALID_OPERATION;
} else {
// Moving from a file to a visible file that exists is ok.
expectation = base::File::FILE_OK;
}
}
operation_runner()->Move(
src_url, url, storage::FileSystemOperation::CopyOrMoveOptionSet(),
storage::FileSystemOperation::ERROR_BEHAVIOR_ABORT,
std::make_unique<storage::CopyOrMoveHookDelegate>(),
base::BindOnce(&ExpectEqHelper, test_name, expectation));
content::RunAllTasksUntilIdle();
}
}
}
TEST_F(NativeMediaFileUtilTest, GetMetadataFiltering) {
// Run the loop twice. The first run has no files. The second run does.
for (int loop_count = 0; loop_count < 2; ++loop_count) {
if (loop_count == 1) {
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
}
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
std::string test_name = base::StringPrintf(
"GetMetadataFiltering run %d test %" PRIuS, loop_count, i);
base::File::Error expectation = base::File::FILE_OK;
if (loop_count == 0 || !kFilteringTestCases[i].visible) {
// Cannot get metadata from files that do not exist or are not visible.
expectation = base::File::FILE_ERROR_NOT_FOUND;
}
operation_runner()->GetMetadata(
url, {storage::FileSystemOperation::GetMetadataField::kIsDirectory},
base::BindOnce(&ExpectMetadataEqHelper, test_name, expectation,
kFilteringTestCases[i].is_directory));
content::RunAllTasksUntilIdle();
}
}
}
TEST_F(NativeMediaFileUtilTest, RemoveFileFiltering) {
// Run the loop twice. The first run has no files. The second run does.
for (int loop_count = 0; loop_count < 2; ++loop_count) {
if (loop_count == 1) {
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
}
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
std::string test_name = base::StringPrintf(
"RemoveFiltering run %d test %" PRIuS, loop_count, i);
base::File::Error expectation = base::File::FILE_OK;
if (loop_count == 0 || !kFilteringTestCases[i].visible) {
// Cannot remove files that do not exist or are not visible.
expectation = base::File::FILE_ERROR_NOT_FOUND;
} else if (kFilteringTestCases[i].is_directory) {
expectation = base::File::FILE_ERROR_NOT_A_FILE;
}
operation_runner()->RemoveFile(
url, base::BindOnce(&ExpectEqHelper, test_name, expectation));
content::RunAllTasksUntilIdle();
}
}
}
void CreateSnapshotCallback(base::File::Error* error,
base::File::Error result,
const base::File::Info&,
const base::FilePath&,
scoped_refptr<storage::ShareableFileReference>) {
*error = result;
}
TEST_F(NativeMediaFileUtilTest, CreateSnapshot) {
PopulateDirectoryWithTestCases(root_path(), kFilteringTestCases,
std::size(kFilteringTestCases));
for (size_t i = 0; i < std::size(kFilteringTestCases); ++i) {
if (kFilteringTestCases[i].is_directory ||
!kFilteringTestCases[i].visible) {
continue;
}
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
base::File::Error expected_error, error;
if (kFilteringTestCases[i].media_file)
expected_error = base::File::FILE_OK;
else
expected_error = base::File::FILE_ERROR_SECURITY;
error = base::File::FILE_ERROR_FAILED;
operation_runner()->CreateSnapshotFile(
url, base::BindOnce(CreateSnapshotCallback, &error));
content::RunAllTasksUntilIdle();
ASSERT_EQ(expected_error, error);
}
}
|