OLD | NEW |
---|---|
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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1524 file_system_->CreateDirectory( | 1524 file_system_->CreateDirectory( |
1525 base::FilePath(FILE_PATH_LITERAL("drive/root/Sample Directory Title")), | 1525 base::FilePath(FILE_PATH_LITERAL("drive/root/Sample Directory Title")), |
1526 false, // is_exclusive | 1526 false, // is_exclusive |
1527 true, // is_recursive | 1527 true, // is_recursive |
1528 google_apis::test_util::CreateCopyResultCallback(&error)); | 1528 google_apis::test_util::CreateCopyResultCallback(&error)); |
1529 google_apis::test_util::RunBlockingPoolTask(); | 1529 google_apis::test_util::RunBlockingPoolTask(); |
1530 | 1530 |
1531 EXPECT_EQ(DRIVE_FILE_OK, error); | 1531 EXPECT_EQ(DRIVE_FILE_OK, error); |
1532 } | 1532 } |
1533 | 1533 |
1534 TEST_F(DriveFileSystemTest, PinAndUnpin) { | |
1535 ASSERT_TRUE(LoadRootFeedDocument()); | |
1536 | |
1537 base::FilePath file_path(FILE_PATH_LITERAL("drive/root/File 1.txt")); | |
1538 | |
1539 // Get the file info. | |
1540 DriveFileError error = DRIVE_FILE_ERROR_FAILED; | |
1541 scoped_ptr<DriveEntryProto> entry; | |
hidehiko
2013/04/19 08:56:28
nit: GetEntryInfoByPathSync should work here?
hashimoto
2013/04/19 10:34:47
Done.
| |
1542 file_system_->GetEntryInfoByPath( | |
1543 file_path, | |
1544 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | |
1545 google_apis::test_util::RunBlockingPoolTask(); | |
1546 EXPECT_EQ(DRIVE_FILE_OK, error); | |
1547 ASSERT_TRUE(entry); | |
1548 | |
1549 // Pin the file. | |
1550 error = DRIVE_FILE_ERROR_FAILED; | |
1551 EXPECT_CALL(*mock_cache_observer_, | |
1552 OnCachePinned(entry->resource_id(), | |
1553 entry->file_specific_info().file_md5())).Times(1); | |
1554 file_system_->Pin(file_path, | |
1555 google_apis::test_util::CreateCopyResultCallback(&error)); | |
1556 google_apis::test_util::RunBlockingPoolTask(); | |
1557 EXPECT_EQ(DRIVE_FILE_OK, error); | |
1558 | |
1559 // Unpin the file. | |
1560 error = DRIVE_FILE_ERROR_FAILED; | |
1561 EXPECT_CALL(*mock_cache_observer_, | |
1562 OnCacheUnpinned(entry->resource_id(), | |
1563 entry->file_specific_info().file_md5())).Times(1); | |
1564 file_system_->Unpin(file_path, | |
1565 google_apis::test_util::CreateCopyResultCallback(&error)); | |
1566 google_apis::test_util::RunBlockingPoolTask(); | |
1567 EXPECT_EQ(DRIVE_FILE_OK, error); | |
1568 } | |
1569 | |
1534 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { | 1570 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { |
1535 ASSERT_TRUE(LoadRootFeedDocument()); | 1571 ASSERT_TRUE(LoadRootFeedDocument()); |
1536 | 1572 |
1537 // The transfered file is cached and the change of "offline available" | 1573 // The transfered file is cached and the change of "offline available" |
1538 // attribute is notified. | 1574 // attribute is notified. |
1539 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( | 1575 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( |
1540 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); | 1576 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); |
1541 | 1577 |
1542 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 1578 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
1543 scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); | 1579 scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2132 | 2168 |
2133 // An app for foo.exe should now be found, as the registry was loaded. | 2169 // An app for foo.exe should now be found, as the registry was loaded. |
2134 drive_webapps_registry_->GetWebAppsForFile( | 2170 drive_webapps_registry_->GetWebAppsForFile( |
2135 base::FilePath(FILE_PATH_LITERAL("foo.exe")), | 2171 base::FilePath(FILE_PATH_LITERAL("foo.exe")), |
2136 "" /* mime_type */, | 2172 "" /* mime_type */, |
2137 &apps); | 2173 &apps); |
2138 EXPECT_EQ(1U, apps.size()); | 2174 EXPECT_EQ(1U, apps.size()); |
2139 } | 2175 } |
2140 | 2176 |
2141 } // namespace drive | 2177 } // namespace drive |
OLD | NEW |