Commit 861b1d69 authored by satorux@chromium.org's avatar satorux@chromium.org

gdata: Add GDataFileSystem::GetEntryByPathAsync()

In preparation for making FindEntryByPathAsync() private.
The new function is not used in production code yet.

This function is needed as we get metadata of a file or
a directory in gdata_file_system_proxy.cc, without knowing
if the file path points to a file or a directory.

BUG=chromium-os:30251
TEST=add unit tests

Review URL: https://chromiumcodereview.appspot.com/10274025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134727 0039d316-1c4b-4281-b951-d872f2087c98
parent 639c40b9
...@@ -809,6 +809,17 @@ void RelaySetMountedStateCallback( ...@@ -809,6 +809,17 @@ void RelaySetMountedStateCallback(
base::Bind(callback, error, file_path)); base::Bind(callback, error, file_path));
} }
// Ditto for GetEntryInfoCallback.
void RelayGetEntryInfoCallback(
scoped_refptr<base::MessageLoopProxy> relay_proxy,
const GetEntryInfoCallback& callback,
base::PlatformFileError error,
scoped_ptr<GDataEntryProto> entry_proto) {
relay_proxy->PostTask(
FROM_HERE,
base::Bind(callback, error, base::Passed(&entry_proto)));
}
// Ditto for GetFileInfoCallback. // Ditto for GetFileInfoCallback.
void RelayGetFileInfoCallback( void RelayGetFileInfoCallback(
scoped_refptr<base::MessageLoopProxy> relay_proxy, scoped_refptr<base::MessageLoopProxy> relay_proxy,
...@@ -2127,6 +2138,59 @@ void GDataFileSystem::ResumeUpload( ...@@ -2127,6 +2138,59 @@ void GDataFileSystem::ResumeUpload(
documents_service_->ResumeUpload(params, callback); documents_service_->ResumeUpload(params, callback);
} }
void GDataFileSystem::GetEntryInfoByPathAsync(
const FilePath& file_path,
const GetEntryInfoCallback& callback) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
const bool posted = BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&GDataFileSystem::GetEntryInfoByPathAsyncOnUIThread,
ui_weak_ptr_,
file_path,
base::Bind(&RelayGetEntryInfoCallback,
base::MessageLoopProxy::current(),
callback)));
DCHECK(posted);
return;
}
GetEntryInfoByPathAsyncOnUIThread(file_path, callback);
}
void GDataFileSystem::GetEntryInfoByPathAsyncOnUIThread(
const FilePath& file_path,
const GetEntryInfoCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
FindEntryByPathAsyncOnUIThread(
file_path,
base::Bind(&GDataFileSystem::OnGetEntryInfo,
ui_weak_ptr_,
callback));
}
void GDataFileSystem::OnGetEntryInfo(const GetEntryInfoCallback& callback,
base::PlatformFileError error,
const FilePath& directory_path,
GDataEntry* entry) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (error != base::PLATFORM_FILE_OK) {
if (!callback.is_null())
callback.Run(error, scoped_ptr<GDataEntryProto>());
return;
}
DCHECK(entry);
scoped_ptr<GDataEntryProto> entry_proto(new GDataEntryProto);
entry->ToProto(entry_proto.get());
if (!callback.is_null())
callback.Run(base::PLATFORM_FILE_OK, entry_proto.Pass());
}
void GDataFileSystem::GetFileInfoByPathAsync( void GDataFileSystem::GetFileInfoByPathAsync(
const FilePath& file_path, const FilePath& file_path,
const GetFileInfoCallback& callback) { const GetFileInfoCallback& callback) {
...@@ -2171,6 +2235,7 @@ void GDataFileSystem::OnGetFileInfo(const GetFileInfoCallback& callback, ...@@ -2171,6 +2235,7 @@ void GDataFileSystem::OnGetFileInfo(const GetFileInfoCallback& callback,
callback.Run(error, scoped_ptr<GDataFileProto>()); callback.Run(error, scoped_ptr<GDataFileProto>());
return; return;
} }
DCHECK(entry);
GDataFile* file = entry->AsGDataFile(); GDataFile* file = entry->AsGDataFile();
if (!file) { if (!file) {
...@@ -2231,6 +2296,7 @@ void GDataFileSystem::OnReadDirectory(const ReadDirectoryCallback& callback, ...@@ -2231,6 +2296,7 @@ void GDataFileSystem::OnReadDirectory(const ReadDirectoryCallback& callback,
callback.Run(error, scoped_ptr<GDataDirectoryProto>()); callback.Run(error, scoped_ptr<GDataDirectoryProto>());
return; return;
} }
DCHECK(entry);
GDataDirectory* directory = entry->AsGDataDirectory(); GDataDirectory* directory = entry->AsGDataDirectory();
if (!directory) { if (!directory) {
......
...@@ -75,8 +75,14 @@ typedef base::Callback<void(base::PlatformFileError error, ...@@ -75,8 +75,14 @@ typedef base::Callback<void(base::PlatformFileError error,
scoped_ptr<GDataFileProto> file_proto)> scoped_ptr<GDataFileProto> file_proto)>
GetFileInfoCallback; GetFileInfoCallback;
// Used to get entry info from the file system.
// If |error| is not PLATFORM_FILE_OK, |entry_info| is set to NULL.
typedef base::Callback<void(base::PlatformFileError error,
scoped_ptr<GDataEntryProto> entry_proto)>
GetEntryInfoCallback;
// Used to read a directory from the file system. // Used to read a directory from the file system.
// If |error| is not PLATFORM_FILE_OK, |file_info| is set to NULL. // If |error| is not PLATFORM_FILE_OK, |directory_info| is set to NULL.
typedef base::Callback<void(base::PlatformFileError error, typedef base::Callback<void(base::PlatformFileError error,
scoped_ptr<GDataDirectoryProto> directory_proto)> scoped_ptr<GDataDirectoryProto> directory_proto)>
ReadDirectoryCallback; ReadDirectoryCallback;
...@@ -319,6 +325,14 @@ class GDataFileSystemInterface { ...@@ -319,6 +325,14 @@ class GDataFileSystemInterface {
const std::string& md5, const std::string& md5,
const GetCacheStateCallback& callback) = 0; const GetCacheStateCallback& callback) = 0;
// Finds an entry (a file or a directory) by |file_path|. This call will also
// retrieve and refresh file system content from server and disk cache.
//
// Can be called from UI/IO thread. |callback| is run on the calling thread.
virtual void GetEntryInfoByPathAsync(
const FilePath& file_path,
const GetEntryInfoCallback& callback) = 0;
// Finds a file (not a directory) by |file_path|. This call will also // Finds a file (not a directory) by |file_path|. This call will also
// retrieve and refresh file system content from server and disk cache. // retrieve and refresh file system content from server and disk cache.
// //
...@@ -426,6 +440,9 @@ class GDataFileSystem : public GDataFileSystemInterface, ...@@ -426,6 +440,9 @@ class GDataFileSystem : public GDataFileSystemInterface,
virtual void GetCacheState(const std::string& resource_id, virtual void GetCacheState(const std::string& resource_id,
const std::string& md5, const std::string& md5,
const GetCacheStateCallback& callback) OVERRIDE; const GetCacheStateCallback& callback) OVERRIDE;
virtual void GetEntryInfoByPathAsync(
const FilePath& file_path,
const GetEntryInfoCallback& callback) OVERRIDE;
virtual void GetFileInfoByPathAsync( virtual void GetFileInfoByPathAsync(
const FilePath& file_path, const FilePath& file_path,
const GetFileInfoCallback& callback) OVERRIDE; const GetFileInfoCallback& callback) OVERRIDE;
...@@ -1230,6 +1247,12 @@ class GDataFileSystem : public GDataFileSystemInterface, ...@@ -1230,6 +1247,12 @@ class GDataFileSystem : public GDataFileSystemInterface,
// Initializes preference change observer. // Initializes preference change observer.
void InitializePreferenceObserver(); void InitializePreferenceObserver();
// Called when an entry is found for GetEntryInfoByPathAsync().
void OnGetEntryInfo(const GetEntryInfoCallback& callback,
base::PlatformFileError error,
const FilePath& entry_path,
GDataEntry* entry);
// Called when an entry is found for GetFileInfoByPathAsync(). // Called when an entry is found for GetFileInfoByPathAsync().
void OnGetFileInfo(const GetFileInfoCallback& callback, void OnGetFileInfo(const GetFileInfoCallback& callback,
base::PlatformFileError error, base::PlatformFileError error,
...@@ -1267,6 +1290,9 @@ class GDataFileSystem : public GDataFileSystemInterface, ...@@ -1267,6 +1290,9 @@ class GDataFileSystem : public GDataFileSystemInterface,
const std::string& resource_id, const std::string& resource_id,
const GetFileCallback& get_file_callback, const GetFileCallback& get_file_callback,
const GetDownloadDataCallback& get_download_data_callback); const GetDownloadDataCallback& get_download_data_callback);
void GetEntryInfoByPathAsyncOnUIThread(
const FilePath& file_path,
const GetEntryInfoCallback& callback);
void GetFileInfoByPathAsyncOnUIThread( void GetFileInfoByPathAsyncOnUIThread(
const FilePath& file_path, const FilePath& file_path,
const GetFileInfoCallback& callback); const GetFileInfoCallback& callback);
......
...@@ -275,6 +275,31 @@ class GDataFileSystemTest : public testing::Test { ...@@ -275,6 +275,31 @@ class GDataFileSystemTest : public testing::Test {
return search_delegate.entry(); return search_delegate.entry();
} }
// Gets the entry info for |file_path| and compares the contents against
// |entry|. Returns true if the entry info matches |entry|.
bool GetEntryInfoAndCompare(const FilePath& file_path,
GDataEntry* entry) {
file_system_->GetEntryInfoByPathAsync(
file_path,
base::Bind(&CallbackHelper::GetEntryInfoCallback,
callback_helper_.get()));
message_loop_.RunAllPending();
if (entry == NULL) {
// Entry info is expected not to be found.
return (callback_helper_->last_error_ ==
base::PLATFORM_FILE_ERROR_NOT_FOUND &&
callback_helper_->entry_proto_ == NULL);
}
if (callback_helper_->last_error_ != base::PLATFORM_FILE_OK)
return false;
scoped_ptr<GDataEntryProto> entry_proto =
callback_helper_->entry_proto_.Pass();
return (entry->resource_id() == entry_proto->resource_id());
}
// Gets the file info for |file_path| and compares the contents against // Gets the file info for |file_path| and compares the contents against
// |file|. Returns true if the file info matches |file|. // |file|. Returns true if the file info matches |file|.
bool GetFileInfoAndCompare(const FilePath& file_path, bool GetFileInfoAndCompare(const FilePath& file_path,
...@@ -1029,6 +1054,13 @@ class GDataFileSystemTest : public testing::Test { ...@@ -1029,6 +1054,13 @@ class GDataFileSystemTest : public testing::Test {
quota_bytes_used_ = bytes_used; quota_bytes_used_ = bytes_used;
} }
virtual void GetEntryInfoCallback(
base::PlatformFileError error,
scoped_ptr<GDataEntryProto> entry_proto) {
last_error_ = error;
entry_proto_ = entry_proto.Pass();
}
virtual void GetFileInfoCallback( virtual void GetFileInfoCallback(
base::PlatformFileError error, base::PlatformFileError error,
scoped_ptr<GDataFileProto> file_proto) { scoped_ptr<GDataFileProto> file_proto) {
...@@ -1049,6 +1081,7 @@ class GDataFileSystemTest : public testing::Test { ...@@ -1049,6 +1081,7 @@ class GDataFileSystemTest : public testing::Test {
GDataFileType file_type_; GDataFileType file_type_;
int64 quota_bytes_total_; int64 quota_bytes_total_;
int64 quota_bytes_used_; int64 quota_bytes_used_;
scoped_ptr<GDataEntryProto> entry_proto_;
scoped_ptr<GDataFileProto> file_proto_; scoped_ptr<GDataFileProto> file_proto_;
scoped_ptr<GDataDirectoryProto> directory_proto_; scoped_ptr<GDataDirectoryProto> directory_proto_;
}; };
...@@ -1119,6 +1152,7 @@ TEST_F(GDataFileSystemTest, SearchRootDirectory) { ...@@ -1119,6 +1152,7 @@ TEST_F(GDataFileSystemTest, SearchRootDirectory) {
GDataEntry* entry = FindEntry(FilePath(FILE_PATH_LITERAL(kFilePath))); GDataEntry* entry = FindEntry(FilePath(FILE_PATH_LITERAL(kFilePath)));
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath, entry->GetFilePath()); EXPECT_EQ(kFilePath, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry));
EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory()));
} }
...@@ -1130,6 +1164,7 @@ TEST_F(GDataFileSystemTest, SearchExistingFile) { ...@@ -1130,6 +1164,7 @@ TEST_F(GDataFileSystemTest, SearchExistingFile) {
GDataEntry* entry = FindEntry(kFilePath); GDataEntry* entry = FindEntry(kFilePath);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath, entry->GetFilePath()); EXPECT_EQ(kFilePath, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile()));
} }
...@@ -1141,6 +1176,7 @@ TEST_F(GDataFileSystemTest, SearchExistingDocument) { ...@@ -1141,6 +1176,7 @@ TEST_F(GDataFileSystemTest, SearchExistingDocument) {
GDataEntry* entry = FindEntry(kFilePath); GDataEntry* entry = FindEntry(kFilePath);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath, entry->GetFilePath()); EXPECT_EQ(kFilePath, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile()));
} }
...@@ -1151,6 +1187,7 @@ TEST_F(GDataFileSystemTest, SearchNonExistingFile) { ...@@ -1151,6 +1187,7 @@ TEST_F(GDataFileSystemTest, SearchNonExistingFile) {
FILE_PATH_LITERAL("gdata/nonexisting.file")); FILE_PATH_LITERAL("gdata/nonexisting.file"));
GDataEntry* entry = FindEntry(kFilePath); GDataEntry* entry = FindEntry(kFilePath);
ASSERT_FALSE(entry); ASSERT_FALSE(entry);
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, NULL)); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, NULL));
} }
...@@ -1161,12 +1198,15 @@ TEST_F(GDataFileSystemTest, SearchEncodedFileNames) { ...@@ -1161,12 +1198,15 @@ TEST_F(GDataFileSystemTest, SearchEncodedFileNames) {
FILE_PATH_LITERAL("gdata/Slash / in file 1.txt")); FILE_PATH_LITERAL("gdata/Slash / in file 1.txt"));
GDataEntry* entry = FindEntry(kFilePath1); GDataEntry* entry = FindEntry(kFilePath1);
ASSERT_FALSE(entry); ASSERT_FALSE(entry);
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath1, NULL));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath1, NULL));
const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( const FilePath kFilePath2 = FilePath::FromUTF8Unsafe(
"gdata/Slash \xE2\x88\x95 in file 1.txt"); "gdata/Slash \xE2\x88\x95 in file 1.txt");
entry = FindEntry(kFilePath2); entry = FindEntry(kFilePath2);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath2, entry->GetFilePath()); EXPECT_EQ(kFilePath2, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath2, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile()));
const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( const FilePath kFilePath3 = FilePath::FromUTF8Unsafe(
...@@ -1174,6 +1214,7 @@ TEST_F(GDataFileSystemTest, SearchEncodedFileNames) { ...@@ -1174,6 +1214,7 @@ TEST_F(GDataFileSystemTest, SearchEncodedFileNames) {
entry = FindEntry(kFilePath3); entry = FindEntry(kFilePath3);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath3, entry->GetFilePath()); EXPECT_EQ(kFilePath3, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath3, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath3, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath3, entry->AsGDataFile()));
} }
...@@ -1184,12 +1225,15 @@ TEST_F(GDataFileSystemTest, SearchEncodedFileNamesLoadingRoot) { ...@@ -1184,12 +1225,15 @@ TEST_F(GDataFileSystemTest, SearchEncodedFileNamesLoadingRoot) {
FILE_PATH_LITERAL("gdata/Slash / in file 1.txt")); FILE_PATH_LITERAL("gdata/Slash / in file 1.txt"));
GDataEntry* entry = FindEntry(kFilePath1); GDataEntry* entry = FindEntry(kFilePath1);
ASSERT_FALSE(entry); ASSERT_FALSE(entry);
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath1, NULL));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath1, NULL));
const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( const FilePath kFilePath2 = FilePath::FromUTF8Unsafe(
"gdata/Slash \xE2\x88\x95 in file 1.txt"); "gdata/Slash \xE2\x88\x95 in file 1.txt");
entry = FindEntry(kFilePath2); entry = FindEntry(kFilePath2);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath2, entry->GetFilePath()); EXPECT_EQ(kFilePath2, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath2, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile()));
const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( const FilePath kFilePath3 = FilePath::FromUTF8Unsafe(
...@@ -1197,6 +1241,7 @@ TEST_F(GDataFileSystemTest, SearchEncodedFileNamesLoadingRoot) { ...@@ -1197,6 +1241,7 @@ TEST_F(GDataFileSystemTest, SearchEncodedFileNamesLoadingRoot) {
entry = FindEntry(kFilePath3); entry = FindEntry(kFilePath3);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath3, entry->GetFilePath()); EXPECT_EQ(kFilePath3, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath3, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath3, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath3, entry->AsGDataFile()));
} }
...@@ -1208,6 +1253,7 @@ TEST_F(GDataFileSystemTest, SearchDuplicateNames) { ...@@ -1208,6 +1253,7 @@ TEST_F(GDataFileSystemTest, SearchDuplicateNames) {
GDataEntry* entry = FindEntry(kFilePath1); GDataEntry* entry = FindEntry(kFilePath1);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath1, entry->GetFilePath()); EXPECT_EQ(kFilePath1, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath1, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath1, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath1, entry->AsGDataFile()));
const FilePath kFilePath2 = FilePath( const FilePath kFilePath2 = FilePath(
...@@ -1215,6 +1261,7 @@ TEST_F(GDataFileSystemTest, SearchDuplicateNames) { ...@@ -1215,6 +1261,7 @@ TEST_F(GDataFileSystemTest, SearchDuplicateNames) {
entry = FindEntry(kFilePath2); entry = FindEntry(kFilePath2);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath2, entry->GetFilePath()); EXPECT_EQ(kFilePath2, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath2, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile()));
} }
...@@ -1226,6 +1273,7 @@ TEST_F(GDataFileSystemTest, SearchExistingDirectory) { ...@@ -1226,6 +1273,7 @@ TEST_F(GDataFileSystemTest, SearchExistingDirectory) {
GDataEntry* entry = FindEntry(kFilePath); GDataEntry* entry = FindEntry(kFilePath);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath, entry->GetFilePath()); EXPECT_EQ(kFilePath, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry));
EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory()));
} }
...@@ -1237,6 +1285,7 @@ TEST_F(GDataFileSystemTest, SearchInSubdir) { ...@@ -1237,6 +1285,7 @@ TEST_F(GDataFileSystemTest, SearchInSubdir) {
GDataEntry* entry = FindEntry(kFilePath); GDataEntry* entry = FindEntry(kFilePath);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath, entry->GetFilePath()); EXPECT_EQ(kFilePath, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry));
EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile()));
} }
...@@ -1250,6 +1299,7 @@ TEST_F(GDataFileSystemTest, SearchInSubSubdir) { ...@@ -1250,6 +1299,7 @@ TEST_F(GDataFileSystemTest, SearchInSubSubdir) {
GDataEntry* entry = FindEntry(kFilePath); GDataEntry* entry = FindEntry(kFilePath);
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
EXPECT_EQ(kFilePath, entry->GetFilePath()); EXPECT_EQ(kFilePath, entry->GetFilePath());
EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry));
EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory()));
} }
......
...@@ -63,6 +63,9 @@ class MockGDataFileSystem : public GDataFileSystemInterface { ...@@ -63,6 +63,9 @@ class MockGDataFileSystem : public GDataFileSystemInterface {
MOCK_METHOD2(GetFileInfoByPathAsync, MOCK_METHOD2(GetFileInfoByPathAsync,
void(const FilePath& file_path, void(const FilePath& file_path,
const GetFileInfoCallback& callback)); const GetFileInfoCallback& callback));
MOCK_METHOD2(GetEntryInfoByPathAsync,
void(const FilePath& file_path,
const GetEntryInfoCallback& callback));
MOCK_METHOD2(ReadDirectoryByPathAsync, MOCK_METHOD2(ReadDirectoryByPathAsync,
void(const FilePath& file_path, void(const FilePath& file_path,
const ReadDirectoryCallback& callback)); const ReadDirectoryCallback& callback));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment