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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_unittest.cc

Issue 18355004: google_apis: Move data files out of chrome/test/data/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix extension tests Created 7 years, 5 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 (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 "chrome/browser/chromeos/drive/file_system.h" 5 #include "chrome/browser/chromeos/drive/file_system.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 protected: 64 protected:
65 virtual void SetUp() OVERRIDE { 65 virtual void SetUp() OVERRIDE {
66 profile_.reset(new TestingProfile); 66 profile_.reset(new TestingProfile);
67 67
68 fake_network_change_notifier_.reset( 68 fake_network_change_notifier_.reset(
69 new test_util::FakeNetworkChangeNotifier); 69 new test_util::FakeNetworkChangeNotifier);
70 70
71 // The fake object will be manually deleted in TearDown(). 71 // The fake object will be manually deleted in TearDown().
72 fake_drive_service_.reset(new FakeDriveService); 72 fake_drive_service_.reset(new FakeDriveService);
73 fake_drive_service_->LoadResourceListForWapi( 73 fake_drive_service_->LoadResourceListForWapi(
74 "chromeos/gdata/root_feed.json"); 74 "gdata/root_feed.json");
75 fake_drive_service_->LoadAccountMetadataForWapi( 75 fake_drive_service_->LoadAccountMetadataForWapi(
76 "chromeos/gdata/account_metadata.json"); 76 "gdata/account_metadata.json");
77 77
78 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); 78 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter);
79 79
80 scheduler_.reset(new JobScheduler(profile_.get(), 80 scheduler_.reset(new JobScheduler(profile_.get(),
81 fake_drive_service_.get(), 81 fake_drive_service_.get(),
82 base::MessageLoopProxy::current())); 82 base::MessageLoopProxy::current()));
83 83
84 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath( 84 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath(
85 profile_.get()).Append(util::kMetadataDirectory))); 85 profile_.get()).Append(util::kMetadataDirectory)));
86 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath( 86 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath(
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 ASSERT_TRUE(LoadFullResourceList()); 823 ASSERT_TRUE(LoadFullResourceList());
824 824
825 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); 825 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt"));
826 scoped_ptr<ResourceEntry> entry(GetResourceEntryByPathSync(file_in_root)); 826 scoped_ptr<ResourceEntry> entry(GetResourceEntryByPathSync(file_in_root));
827 ASSERT_TRUE(entry); 827 ASSERT_TRUE(entry);
828 828
829 // Write to cache. 829 // Write to cache.
830 ASSERT_EQ(FILE_ERROR_OK, cache_->Store( 830 ASSERT_EQ(FILE_ERROR_OK, cache_->Store(
831 entry->resource_id(), 831 entry->resource_id(),
832 entry->file_specific_info().md5(), 832 entry->file_specific_info().md5(),
833 google_apis::test_util::GetTestFilePath("chromeos/gdata/root_feed.json"), 833 google_apis::test_util::GetTestFilePath("gdata/root_feed.json"),
834 internal::FileCache::FILE_OPERATION_COPY)); 834 internal::FileCache::FILE_OPERATION_COPY));
835 835
836 // Test for mounting. 836 // Test for mounting.
837 FileError error = FILE_ERROR_FAILED; 837 FileError error = FILE_ERROR_FAILED;
838 base::FilePath file_path; 838 base::FilePath file_path;
839 file_system_->MarkCacheFileAsMounted( 839 file_system_->MarkCacheFileAsMounted(
840 file_in_root, 840 file_in_root,
841 google_apis::test_util::CreateCopyResultCallback(&error, &file_path)); 841 google_apis::test_util::CreateCopyResultCallback(&error, &file_path));
842 google_apis::test_util::RunBlockingPoolTask(); 842 google_apis::test_util::RunBlockingPoolTask();
843 EXPECT_EQ(FILE_ERROR_OK, error); 843 EXPECT_EQ(FILE_ERROR_OK, error);
844 844
845 // Cannot remove a cache entry while it's being mounted. 845 // Cannot remove a cache entry while it's being mounted.
846 EXPECT_EQ(FILE_ERROR_IN_USE, cache_->Remove(entry->resource_id())); 846 EXPECT_EQ(FILE_ERROR_IN_USE, cache_->Remove(entry->resource_id()));
847 847
848 // Test for unmounting. 848 // Test for unmounting.
849 error = FILE_ERROR_FAILED; 849 error = FILE_ERROR_FAILED;
850 file_system_->MarkCacheFileAsUnmounted( 850 file_system_->MarkCacheFileAsUnmounted(
851 file_path, 851 file_path,
852 google_apis::test_util::CreateCopyResultCallback(&error)); 852 google_apis::test_util::CreateCopyResultCallback(&error));
853 google_apis::test_util::RunBlockingPoolTask(); 853 google_apis::test_util::RunBlockingPoolTask();
854 EXPECT_EQ(FILE_ERROR_OK, error); 854 EXPECT_EQ(FILE_ERROR_OK, error);
855 855
856 // Now able to remove the cache entry. 856 // Now able to remove the cache entry.
857 EXPECT_EQ(FILE_ERROR_OK, cache_->Remove(entry->resource_id())); 857 EXPECT_EQ(FILE_ERROR_OK, cache_->Remove(entry->resource_id()));
858 } 858 }
859 859
860 } // namespace drive 860 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698