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 <errno.h> | 5 #include <errno.h> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 file_system_->GetFileFromCacheByResourceIdAndMd5(resource_id, md5, | 360 file_system_->GetFileFromCacheByResourceIdAndMd5(resource_id, md5, |
361 base::Bind(&GDataFileSystemTest::VerifyGetFromCache, | 361 base::Bind(&GDataFileSystemTest::VerifyGetFromCache, |
362 base::Unretained(this))); | 362 base::Unretained(this))); |
363 | 363 |
364 RunAllPendingForIO(); | 364 RunAllPendingForIO(); |
365 } | 365 } |
366 | 366 |
367 void VerifyGetFromCache(base::PlatformFileError error, | 367 void VerifyGetFromCache(base::PlatformFileError error, |
368 const std::string& resource_id, | 368 const std::string& resource_id, |
369 const std::string& md5, | 369 const std::string& md5, |
370 const FilePath& gdata_file_path, | |
371 const FilePath& cache_file_path) { | 370 const FilePath& cache_file_path) { |
372 ++num_callback_invocations_; | 371 ++num_callback_invocations_; |
373 | 372 |
374 EXPECT_EQ(expected_error_, error); | 373 EXPECT_EQ(expected_error_, error); |
375 | 374 |
376 if (error == base::PLATFORM_FILE_OK) { | 375 if (error == base::PLATFORM_FILE_OK) { |
377 // Verify filename of |cache_file_path|. | 376 // Verify filename of |cache_file_path|. |
378 FilePath base_name = cache_file_path.BaseName(); | 377 FilePath base_name = cache_file_path.BaseName(); |
379 EXPECT_EQ(GDataEntry::EscapeUtf8FileName(resource_id) + | 378 EXPECT_EQ(GDataEntry::EscapeUtf8FileName(resource_id) + |
380 FilePath::kExtensionSeparator + | 379 FilePath::kExtensionSeparator + |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 file_system_->MarkDirtyInCache(resource_id, md5, | 567 file_system_->MarkDirtyInCache(resource_id, md5, |
569 base::Bind(&GDataFileSystemTest::VerifyMarkDirty, | 568 base::Bind(&GDataFileSystemTest::VerifyMarkDirty, |
570 base::Unretained(this))); | 569 base::Unretained(this))); |
571 | 570 |
572 RunAllPendingForIO(); | 571 RunAllPendingForIO(); |
573 } | 572 } |
574 | 573 |
575 void VerifyMarkDirty(base::PlatformFileError error, | 574 void VerifyMarkDirty(base::PlatformFileError error, |
576 const std::string& resource_id, | 575 const std::string& resource_id, |
577 const std::string& md5, | 576 const std::string& md5, |
578 const FilePath& gdata_file_path, | |
579 const FilePath& cache_file_path) { | 577 const FilePath& cache_file_path) { |
580 VerifyCacheFileState(error, resource_id, md5); | 578 VerifyCacheFileState(error, resource_id, md5); |
581 | 579 |
582 // Verify filename of |cache_file_path|. | 580 // Verify filename of |cache_file_path|. |
583 if (error == base::PLATFORM_FILE_OK) { | 581 if (error == base::PLATFORM_FILE_OK) { |
584 FilePath base_name = cache_file_path.BaseName(); | 582 FilePath base_name = cache_file_path.BaseName(); |
585 EXPECT_EQ(GDataEntry::EscapeUtf8FileName(resource_id) + | 583 EXPECT_EQ(GDataEntry::EscapeUtf8FileName(resource_id) + |
586 FilePath::kExtensionSeparator + | 584 FilePath::kExtensionSeparator + |
587 "local", | 585 "local", |
588 base_name.value()); | 586 base_name.value()); |
(...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 | 2966 |
2969 // Verify account meta feed is saved to cache. | 2967 // Verify account meta feed is saved to cache. |
2970 RunAllPendingForIO(); | 2968 RunAllPendingForIO(); |
2971 FilePath path = file_system_->cache_paths_[ | 2969 FilePath path = file_system_->cache_paths_[ |
2972 GDataRootDirectory::CACHE_TYPE_META].Append( | 2970 GDataRootDirectory::CACHE_TYPE_META].Append( |
2973 FILE_PATH_LITERAL("account_metadata.json")); | 2971 FILE_PATH_LITERAL("account_metadata.json")); |
2974 EXPECT_TRUE(file_util::PathExists(path)); | 2972 EXPECT_TRUE(file_util::PathExists(path)); |
2975 } | 2973 } |
2976 | 2974 |
2977 } // namespace gdata | 2975 } // namespace gdata |
OLD | NEW |