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

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

Issue 14067009: drive: Call LoadIfNeeded before CreateDirectory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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/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 (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 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 .Times(1); 1478 .Times(1);
1479 1479
1480 // Create directory in a sub directory. 1480 // Create directory in a sub directory.
1481 base::FilePath subdir_path( 1481 base::FilePath subdir_path(
1482 FILE_PATH_LITERAL("drive/root/New Folder 1/New Folder 2")); 1482 FILE_PATH_LITERAL("drive/root/New Folder 1/New Folder 2"));
1483 EXPECT_FALSE(EntryExists(subdir_path)); 1483 EXPECT_FALSE(EntryExists(subdir_path));
1484 EXPECT_EQ(FILE_ERROR_OK, AddDirectory(subdir_path)); 1484 EXPECT_EQ(FILE_ERROR_OK, AddDirectory(subdir_path));
1485 EXPECT_TRUE(EntryExists(subdir_path)); 1485 EXPECT_TRUE(EntryExists(subdir_path));
1486 } 1486 }
1487 1487
1488 TEST_F(DriveFileSystemTest, CreateDirectoryByImplicitLoad) {
1489 // Intentionally *not* calling LoadRootFeedDocument(), for testing that
1490 // CreateDirectory ensures feed loading before it runs.
1491
1492 base::FilePath existing_directory(
1493 FILE_PATH_LITERAL("drive/root/Directory 1"));
1494 FileError error = FILE_ERROR_FAILED;
1495 file_system_->CreateDirectory(
1496 existing_directory,
1497 true, // is_exclusive
1498 false, // is_recursive
1499 google_apis::test_util::CreateCopyResultCallback(&error));
1500 google_apis::test_util::RunBlockingPoolTask();
1501
1502 // It should fail because is_exclusive is set to true.
1503 EXPECT_EQ(FILE_ERROR_EXISTS, error);
1504 }
1505
1488 TEST_F(DriveFileSystemTest, PinAndUnpin) { 1506 TEST_F(DriveFileSystemTest, PinAndUnpin) {
1489 ASSERT_TRUE(LoadRootFeedDocument()); 1507 ASSERT_TRUE(LoadRootFeedDocument());
1490 1508
1491 base::FilePath file_path(FILE_PATH_LITERAL("drive/root/File 1.txt")); 1509 base::FilePath file_path(FILE_PATH_LITERAL("drive/root/File 1.txt"));
1492 1510
1493 // Get the file info. 1511 // Get the file info.
1494 scoped_ptr<DriveEntryProto> entry(GetEntryInfoByPathSync(file_path)); 1512 scoped_ptr<DriveEntryProto> entry(GetEntryInfoByPathSync(file_path));
1495 ASSERT_TRUE(entry); 1513 ASSERT_TRUE(entry);
1496 1514
1497 // Pin the file. 1515 // Pin the file.
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 entry->resource_id(), 2192 entry->resource_id(),
2175 entry->file_specific_info().file_md5(), 2193 entry->file_specific_info().file_md5(),
2176 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry)); 2194 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry));
2177 google_apis::test_util::RunBlockingPoolTask(); 2195 google_apis::test_util::RunBlockingPoolTask();
2178 2196
2179 EXPECT_TRUE(success); 2197 EXPECT_TRUE(success);
2180 EXPECT_FALSE(cache_entry.is_mounted()); 2198 EXPECT_FALSE(cache_entry.is_mounted());
2181 } 2199 }
2182 2200
2183 } // namespace drive 2201 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698