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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc

Issue 10538071: gdata: Convert FindEntryByResourceIdSync() to asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 (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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return entry; 321 return entry;
322 } 322 }
323 323
324 void FindAndTestFilePath(const FilePath& file_path) { 324 void FindAndTestFilePath(const FilePath& file_path) {
325 GDataEntry* entry = FindEntry(file_path); 325 GDataEntry* entry = FindEntry(file_path);
326 ASSERT_TRUE(entry) << "Entry can't be found " << file_path.value(); 326 ASSERT_TRUE(entry) << "Entry can't be found " << file_path.value();
327 EXPECT_EQ(entry->GetFilePath(), file_path); 327 EXPECT_EQ(entry->GetFilePath(), file_path);
328 } 328 }
329 329
330 GDataEntry* FindEntryByResourceId(const std::string& resource_id) { 330 GDataEntry* FindEntryByResourceId(const std::string& resource_id) {
331 GDataEntry* entry = NULL; 331 GDataEntry* entry = file_system_->root_->GetEntryByResourceId(resource_id);
332 file_system_->FindEntryByResourceIdSync( 332 return entry ? entry->AsGDataFile() : NULL;
333 resource_id, base::Bind(&ReadOnlyFindEntryCallback, &entry));
334 return entry;
335 } 333 }
336 334
337 // Gets the entry info for |file_path| and compares the contents against 335 // Gets the entry info for |file_path| and compares the contents against
338 // |entry|. Returns true if the entry info matches |entry|. 336 // |entry|. Returns true if the entry info matches |entry|.
339 bool GetEntryInfoAndCompare(const FilePath& file_path, 337 bool GetEntryInfoAndCompare(const FilePath& file_path,
340 GDataEntry* entry) { 338 GDataEntry* entry) {
341 file_system_->GetEntryInfoByPathAsync( 339 file_system_->GetEntryInfoByPathAsync(
342 file_path, 340 file_path,
343 base::Bind(&CallbackHelper::GetEntryInfoCallback, 341 base::Bind(&CallbackHelper::GetEntryInfoCallback,
344 callback_helper_.get())); 342 callback_helper_.get()));
(...skipping 3470 matching lines...) Expand 10 before | Expand all | Expand 10 after
3815 // Verify that the file was properly closed. 3813 // Verify that the file was properly closed.
3816 EXPECT_EQ(base::PLATFORM_FILE_OK, callback_helper_->last_error_); 3814 EXPECT_EQ(base::PLATFORM_FILE_OK, callback_helper_->last_error_);
3817 3815
3818 // Verify that the cache state was changed as expected. 3816 // Verify that the cache state was changed as expected.
3819 VerifyCacheStateAfterCloseFile(callback_helper_->last_error_, 3817 VerifyCacheStateAfterCloseFile(callback_helper_->last_error_,
3820 file_resource_id, 3818 file_resource_id,
3821 file_md5); 3819 file_md5);
3822 } 3820 }
3823 3821
3824 } // namespace gdata 3822 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698