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

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

Issue 14348016: chromeos: Add DriveFileSystem::Pin/Unpin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use GetEntryInfoByPathSync 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
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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 scoped_ptr<DriveEntryProto> entry(GetEntryInfoByPathSync(file_path));
1541 ASSERT_TRUE(entry);
1542
1543 // Pin the file.
1544 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
1545 EXPECT_CALL(*mock_cache_observer_,
1546 OnCachePinned(entry->resource_id(),
1547 entry->file_specific_info().file_md5())).Times(1);
1548 file_system_->Pin(file_path,
1549 google_apis::test_util::CreateCopyResultCallback(&error));
1550 google_apis::test_util::RunBlockingPoolTask();
1551 EXPECT_EQ(DRIVE_FILE_OK, error);
1552
1553 // Unpin the file.
1554 error = DRIVE_FILE_ERROR_FAILED;
1555 EXPECT_CALL(*mock_cache_observer_,
1556 OnCacheUnpinned(entry->resource_id(),
1557 entry->file_specific_info().file_md5())).Times(1);
1558 file_system_->Unpin(file_path,
1559 google_apis::test_util::CreateCopyResultCallback(&error));
1560 google_apis::test_util::RunBlockingPoolTask();
1561 EXPECT_EQ(DRIVE_FILE_OK, error);
1562 }
1563
1534 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { 1564 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) {
1535 ASSERT_TRUE(LoadRootFeedDocument()); 1565 ASSERT_TRUE(LoadRootFeedDocument());
1536 1566
1537 // The transfered file is cached and the change of "offline available" 1567 // The transfered file is cached and the change of "offline available"
1538 // attribute is notified. 1568 // attribute is notified.
1539 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( 1569 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged(
1540 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); 1570 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1);
1541 1571
1542 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); 1572 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt"));
1543 scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); 1573 scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root));
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 2162
2133 // An app for foo.exe should now be found, as the registry was loaded. 2163 // An app for foo.exe should now be found, as the registry was loaded.
2134 drive_webapps_registry_->GetWebAppsForFile( 2164 drive_webapps_registry_->GetWebAppsForFile(
2135 base::FilePath(FILE_PATH_LITERAL("foo.exe")), 2165 base::FilePath(FILE_PATH_LITERAL("foo.exe")),
2136 "" /* mime_type */, 2166 "" /* mime_type */,
2137 &apps); 2167 &apps);
2138 EXPECT_EQ(1U, apps.size()); 2168 EXPECT_EQ(1U, apps.size());
2139 } 2169 }
2140 2170
2141 } // namespace drive 2171 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system_interface.h ('k') | chrome/browser/chromeos/drive/fake_drive_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698