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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc

Issue 16628003: drive: Remove FileCacheObserver::OnCacheCommitted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PinAndUnpin Created 7 years, 6 months 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 | Annotate | Revision Log
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 "chrome/browser/chromeos/drive/file_system/download_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/download_operation.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" 8 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
9 #include "chrome/browser/chromeos/drive/file_cache.h" 9 #include "chrome/browser/chromeos/drive/file_cache.h"
10 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" 10 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 396
397 // Prepare a dirty file to store to cache that has a different size than 397 // Prepare a dirty file to store to cache that has a different size than
398 // stored in resource metadata. 398 // stored in resource metadata.
399 base::FilePath dirty_file = temp_dir().AppendASCII("dirty.txt"); 399 base::FilePath dirty_file = temp_dir().AppendASCII("dirty.txt");
400 size_t dirty_size = src_entry.file_info().size() + 10; 400 size_t dirty_size = src_entry.file_info().size() + 10;
401 google_apis::test_util::WriteStringToFile(dirty_file, 401 google_apis::test_util::WriteStringToFile(dirty_file,
402 std::string(dirty_size, 'x')); 402 std::string(dirty_size, 'x'));
403 403
404 // Store the file as a cache, marking it to be dirty. 404 // Store the file as a cache, marking it to be dirty.
405 FileError error = FILE_ERROR_FAILED; 405 FileError error = FILE_ERROR_FAILED;
406 cache()->StoreLocallyModifiedOnUIThread( 406 cache()->StoreOnUIThread(
407 src_entry.resource_id(), 407 src_entry.resource_id(),
408 src_entry.file_specific_info().md5(), 408 src_entry.file_specific_info().md5(),
409 dirty_file, 409 dirty_file,
410 internal::FileCache::FILE_OPERATION_COPY, 410 internal::FileCache::FILE_OPERATION_COPY,
411 google_apis::test_util::CreateCopyResultCallback(&error)); 411 google_apis::test_util::CreateCopyResultCallback(&error));
412 google_apis::test_util::RunBlockingPoolTask(); 412 google_apis::test_util::RunBlockingPoolTask();
413 EXPECT_EQ(FILE_ERROR_OK, error); 413 EXPECT_EQ(FILE_ERROR_OK, error);
414 cache()->MarkDirtyOnUIThread(
415 src_entry.resource_id(),
416 src_entry.file_specific_info().md5(),
417 google_apis::test_util::CreateCopyResultCallback(&error));
418 google_apis::test_util::RunBlockingPoolTask();
419 EXPECT_EQ(FILE_ERROR_OK, error);
414 420
415 // Record values passed to GetFileContentInitializedCallback(). 421 // Record values passed to GetFileContentInitializedCallback().
416 FileError init_error; 422 FileError init_error;
417 base::FilePath init_path; 423 base::FilePath init_path;
418 scoped_ptr<ResourceEntry> init_entry; 424 scoped_ptr<ResourceEntry> init_entry;
419 base::Closure cancel_callback; 425 base::Closure cancel_callback;
420 426
421 base::FilePath file_path; 427 base::FilePath file_path;
422 scoped_ptr<ResourceEntry> entry; 428 scoped_ptr<ResourceEntry> entry;
423 operation_->EnsureFileDownloadedByPath( 429 operation_->EnsureFileDownloadedByPath(
424 file_in_root, 430 file_in_root,
425 ClientContext(USER_INITIATED), 431 ClientContext(USER_INITIATED),
426 google_apis::test_util::CreateCopyResultCallback( 432 google_apis::test_util::CreateCopyResultCallback(
427 &init_error, &init_entry, &init_path, &cancel_callback), 433 &init_error, &init_entry, &init_path, &cancel_callback),
428 google_apis::GetContentCallback(), 434 google_apis::GetContentCallback(),
429 google_apis::test_util::CreateCopyResultCallback( 435 google_apis::test_util::CreateCopyResultCallback(
430 &error, &file_path, &entry)); 436 &error, &file_path, &entry));
431 google_apis::test_util::RunBlockingPoolTask(); 437 google_apis::test_util::RunBlockingPoolTask();
432 438
433 EXPECT_EQ(FILE_ERROR_OK, error); 439 EXPECT_EQ(FILE_ERROR_OK, error);
434 // Check that the result of local modification is propagated. 440 // Check that the result of local modification is propagated.
435 EXPECT_EQ(static_cast<int64>(dirty_size), init_entry->file_info().size()); 441 EXPECT_EQ(static_cast<int64>(dirty_size), init_entry->file_info().size());
436 EXPECT_EQ(static_cast<int64>(dirty_size), entry->file_info().size()); 442 EXPECT_EQ(static_cast<int64>(dirty_size), entry->file_info().size());
437 } 443 }
438 444
439 } // namespace file_system 445 } // namespace file_system
440 } // namespace drive 446 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698