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

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

Issue 13579005: chromeos: Fix FilePath handling incompatibility between FakeDriveFileSystem::GetEntryInfoByResource… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 7 years, 8 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
« no previous file with comments | « chrome/browser/chromeos/drive/fake_drive_file_system.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fake_drive_file_system.h" 5 #include "chrome/browser/chromeos/drive/fake_drive_file_system.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" 8 #include "chrome/browser/chromeos/drive/drive_file_system_util.h"
9 #include "chrome/browser/google_apis/fake_drive_service.h" 9 #include "chrome/browser/google_apis/fake_drive_service.h"
10 #include "chrome/browser/google_apis/test_util.h" 10 #include "chrome/browser/google_apis/test_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 google_apis::test_util::RunBlockingPoolTask(); 56 google_apis::test_util::RunBlockingPoolTask();
57 57
58 ASSERT_EQ(DRIVE_FILE_OK, error); 58 ASSERT_EQ(DRIVE_FILE_OK, error);
59 EXPECT_EQ( 59 EXPECT_EQ(
60 util::GetDriveMyDriveRootPath().AppendASCII( 60 util::GetDriveMyDriveRootPath().AppendASCII(
61 "Directory 1/Sub Directory Folder"), 61 "Directory 1/Sub Directory Folder"),
62 file_path); 62 file_path);
63 EXPECT_TRUE(entry); // Just make sure something is returned. 63 EXPECT_TRUE(entry); // Just make sure something is returned.
64 } 64 }
65 65
66 TEST_F(FakeDriveFileSystemTest,
67 GetEntryInfoByResourceId_PathCompatibleWithGetEntryInfoByPath) {
68 const std::string document_resource_id = "document:5_document_resource_id";
69
70 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
71 scoped_ptr<DriveEntryProto> entry;
72 base::FilePath file_path;
73
74 // Get entry info by resource id.
75 fake_drive_file_system_->GetEntryInfoByResourceId(
76 document_resource_id,
77 google_apis::test_util::CreateCopyResultCallback(
78 &error, &file_path, &entry));
79 google_apis::test_util::RunBlockingPoolTask();
80
81 ASSERT_EQ(DRIVE_FILE_OK, error);
82 ASSERT_TRUE(entry);
83 EXPECT_TRUE(entry->file_specific_info().is_hosted_document());
84
85 // Get entry info by path given by GetEntryInfoByResourceId.
86 error = DRIVE_FILE_ERROR_FAILED;
87 entry.reset();
88 fake_drive_file_system_->GetEntryInfoByPath(
89 file_path,
90 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
91 google_apis::test_util::RunBlockingPoolTask();
92
93 ASSERT_EQ(DRIVE_FILE_OK, error);
94 ASSERT_TRUE(entry);
95 EXPECT_EQ(document_resource_id, entry->resource_id());
96 }
97
66 TEST_F(FakeDriveFileSystemTest, GetEntryInfoByPath) { 98 TEST_F(FakeDriveFileSystemTest, GetEntryInfoByPath) {
67 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 99 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
68 scoped_ptr<DriveEntryProto> entry; 100 scoped_ptr<DriveEntryProto> entry;
69 fake_drive_file_system_->GetEntryInfoByPath( 101 fake_drive_file_system_->GetEntryInfoByPath(
70 util::GetDriveMyDriveRootPath().AppendASCII( 102 util::GetDriveMyDriveRootPath().AppendASCII(
71 "Directory 1/Sub Directory Folder"), 103 "Directory 1/Sub Directory Folder"),
72 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 104 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
73 google_apis::test_util::RunBlockingPoolTask(); 105 google_apis::test_util::RunBlockingPoolTask();
74 106
75 ASSERT_EQ(DRIVE_FILE_OK, error); 107 ASSERT_EQ(DRIVE_FILE_OK, error);
(...skipping 23 matching lines...) Expand all
99 util::GetDriveMyDriveRootPath().AppendASCII("Invalid File Name"), 131 util::GetDriveMyDriveRootPath().AppendASCII("Invalid File Name"),
100 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 132 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
101 google_apis::test_util::RunBlockingPoolTask(); 133 google_apis::test_util::RunBlockingPoolTask();
102 134
103 ASSERT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 135 ASSERT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
104 ASSERT_FALSE(entry); 136 ASSERT_FALSE(entry);
105 } 137 }
106 138
107 } // namespace test_util 139 } // namespace test_util
108 } // namespace drive 140 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/fake_drive_file_system.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698