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

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

Issue 12585003: drive: Add showroot=true to WAPI feed URLs and ignore "no parent" entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser_tests. Created 7 years, 9 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/drive_file_system.h" 5 #include "chrome/browser/chromeos/drive/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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 ASSERT_TRUE(entry.get()); 729 ASSERT_TRUE(entry.get());
730 ASSERT_EQ("folder:sub_sub_directory_folder_id", entry->resource_id()); 730 ASSERT_EQ("folder:sub_sub_directory_folder_id", entry->resource_id());
731 } 731 }
732 732
733 TEST_F(DriveFileSystemTest, ReadDirectoryByPath_Root) { 733 TEST_F(DriveFileSystemTest, ReadDirectoryByPath_Root) {
734 // ReadDirectoryByPath() should kick off the resource list loading. 734 // ReadDirectoryByPath() should kick off the resource list loading.
735 scoped_ptr<DriveEntryProtoVector> entries( 735 scoped_ptr<DriveEntryProtoVector> entries(
736 ReadDirectoryByPathSync(base::FilePath::FromUTF8Unsafe("drive"))); 736 ReadDirectoryByPathSync(base::FilePath::FromUTF8Unsafe("drive")));
737 // The root directory should be read correctly. 737 // The root directory should be read correctly.
738 ASSERT_TRUE(entries.get()); 738 ASSERT_TRUE(entries.get());
739 EXPECT_EQ(9U, entries->size()); 739 EXPECT_EQ(8U, entries->size());
740 } 740 }
741 741
742 TEST_F(DriveFileSystemTest, ReadDirectoryByPath_NonRootDirectory) { 742 TEST_F(DriveFileSystemTest, ReadDirectoryByPath_NonRootDirectory) {
743 // ReadDirectoryByPath() should kick off the resource list loading. 743 // ReadDirectoryByPath() should kick off the resource list loading.
744 scoped_ptr<DriveEntryProtoVector> entries( 744 scoped_ptr<DriveEntryProtoVector> entries(
745 ReadDirectoryByPathSync( 745 ReadDirectoryByPathSync(
746 base::FilePath::FromUTF8Unsafe("drive/Directory 1"))); 746 base::FilePath::FromUTF8Unsafe("drive/Directory 1")));
747 // The non root directory should also be read correctly. 747 // The non root directory should also be read correctly.
748 // There was a bug (crbug.com/181487), which broke this behavior. 748 // There was a bug (crbug.com/181487), which broke this behavior.
749 // Make sure this is fixed. 749 // Make sure this is fixed.
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 const base::FilePath local_src_file_path = 1006 const base::FilePath local_src_file_path =
1007 temp_dir.path().AppendASCII("local.txt"); 1007 temp_dir.path().AppendASCII("local.txt");
1008 const std::string kContent = "hello"; 1008 const std::string kContent = "hello";
1009 file_util::WriteFile(local_src_file_path, kContent.data(), kContent.size()); 1009 file_util::WriteFile(local_src_file_path, kContent.data(), kContent.size());
1010 1010
1011 // Confirm that the remote file does not exist. 1011 // Confirm that the remote file does not exist.
1012 const base::FilePath remote_dest_file_path( 1012 const base::FilePath remote_dest_file_path(
1013 FILE_PATH_LITERAL("drive/remote.txt")); 1013 FILE_PATH_LITERAL("drive/remote.txt"));
1014 EXPECT_FALSE(EntryExists(remote_dest_file_path)); 1014 EXPECT_FALSE(EntryExists(remote_dest_file_path));
1015 1015
1016 scoped_ptr<base::Value> value =
1017 google_apis::test_util::LoadJSONFile(
1018 "chromeos/gdata/document_to_download.json");
1019 scoped_ptr<google_apis::ResourceEntry> resource_entry(
1020 google_apis::ResourceEntry::ExtractAndParse(*value));
1021
1022 // Transfer the local file to Drive. 1016 // Transfer the local file to Drive.
1023 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 1017 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
1024 file_system_->TransferFileFromLocalToRemote( 1018 file_system_->TransferFileFromLocalToRemote(
1025 local_src_file_path, 1019 local_src_file_path,
1026 remote_dest_file_path, 1020 remote_dest_file_path,
1027 base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); 1021 base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error));
1028 google_apis::test_util::RunBlockingPoolTask(); 1022 google_apis::test_util::RunBlockingPoolTask();
1029 1023
1030 EXPECT_EQ(DRIVE_FILE_OK, error); 1024 EXPECT_EQ(DRIVE_FILE_OK, error);
1031 1025
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 2172
2179 // An app for foo.exe should now be found, as the registry was loaded. 2173 // An app for foo.exe should now be found, as the registry was loaded.
2180 drive_webapps_registry_->GetWebAppsForFile( 2174 drive_webapps_registry_->GetWebAppsForFile(
2181 base::FilePath(FILE_PATH_LITERAL("foo.exe")), 2175 base::FilePath(FILE_PATH_LITERAL("foo.exe")),
2182 "" /* mime_type */, 2176 "" /* mime_type */,
2183 &apps); 2177 &apps);
2184 EXPECT_EQ(1U, apps.size()); 2178 EXPECT_EQ(1U, apps.size());
2185 } 2179 }
2186 2180
2187 } // namespace drive 2181 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/change_list_processor.cc ('k') | chrome/browser/chromeos/drive/drive_resource_metadata.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698