summaryrefslogtreecommitdiffstats
path: root/apps/saved_files_service_unittest.cc
diff options
context:
space:
mode:
authorsammc@chromium.org <sammc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-29 14:16:24 +0000
committersammc@chromium.org <sammc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-29 14:16:24 +0000
commit6b7ecdd48738d917c870a18e1ba3bb7707a4894e (patch)
treea1fd71148f5c1f89c166ac35cce308c29ddcb5a1 /apps/saved_files_service_unittest.cc
parentf5f2b724da0926b45c9a6bd34df0e974206819c5 (diff)
downloadchromium_src-6b7ecdd48738d917c870a18e1ba3bb7707a4894e.zip
chromium_src-6b7ecdd48738d917c870a18e1ba3bb7707a4894e.tar.gz
chromium_src-6b7ecdd48738d917c870a18e1ba3bb7707a4894e.tar.bz2
Add support for directory access to the file system API.
This adds 'openDirectory' as a type option for chrome.fileSystem.chooseEntry to allow access to directories. This is restricted to apps with the fileSystem.directory permission. BUG=148486 Review URL: https://chromiumcodereview.appspot.com/23146016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps/saved_files_service_unittest.cc')
-rw-r--r--apps/saved_files_service_unittest.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/saved_files_service_unittest.cc b/apps/saved_files_service_unittest.cc
index 336049b..313c97c 100644
--- a/apps/saved_files_service_unittest.cc
+++ b/apps/saved_files_service_unittest.cc
@@ -71,6 +71,7 @@ class SavedFilesServiceUnitTest : public testing::Test {
ASSERT_TRUE(entry);
EXPECT_EQ(id_string, entry->id);
EXPECT_EQ(path_, entry->path);
+ EXPECT_TRUE(entry->is_directory);
EXPECT_EQ(sequence_number, entry->sequence_number);
}
@@ -89,9 +90,9 @@ class SavedFilesServiceUnitTest : public testing::Test {
};
TEST_F(SavedFilesServiceUnitTest, RetainTwoFilesTest) {
- service_->RegisterFileEntry(extension_->id(), GenerateId(1), path_);
- service_->RegisterFileEntry(extension_->id(), GenerateId(2), path_);
- service_->RegisterFileEntry(extension_->id(), GenerateId(3), path_);
+ service_->RegisterFileEntry(extension_->id(), GenerateId(1), path_, true);
+ service_->RegisterFileEntry(extension_->id(), GenerateId(2), path_, true);
+ service_->RegisterFileEntry(extension_->id(), GenerateId(3), path_, true);
// Test that no entry has a sequence number.
TRACE_CALL(CheckEntrySequenceNumber(1, 0));
@@ -151,7 +152,7 @@ TEST_F(SavedFilesServiceUnitTest, NoRetainEntriesPermissionTest) {
extension_ = env_.MakeExtension(*base::test::ParseJson(
"{\"app\": {\"background\": {\"scripts\": [\"background.js\"]}},"
"\"permissions\": [\"fileSystem\"]}"));
- service_->RegisterFileEntry(extension_->id(), GenerateId(1), path_);
+ service_->RegisterFileEntry(extension_->id(), GenerateId(1), path_, true);
TRACE_CALL(CheckEntrySequenceNumber(1, 0));
SavedFileEntry entry;
service_->EnqueueFileEntry(extension_->id(), GenerateId(1));
@@ -170,10 +171,10 @@ TEST_F(SavedFilesServiceUnitTest, NoRetainEntriesPermissionTest) {
TEST_F(SavedFilesServiceUnitTest, EvictionTest) {
SavedFilesService::SetLruSizeForTest(10);
for (int i = 0; i < 10; i++) {
- service_->RegisterFileEntry(extension_->id(), GenerateId(i), path_);
+ service_->RegisterFileEntry(extension_->id(), GenerateId(i), path_, true);
service_->EnqueueFileEntry(extension_->id(), GenerateId(i));
}
- service_->RegisterFileEntry(extension_->id(), GenerateId(10), path_);
+ service_->RegisterFileEntry(extension_->id(), GenerateId(10), path_, true);
// Expect that entries 0 to 9 are in the queue, but 10 is not.
TRACE_CALL(CheckRangeEnqueuedInOrder(0, 10));
@@ -208,7 +209,7 @@ TEST_F(SavedFilesServiceUnitTest, SequenceNumberCompactionTest) {
SavedFilesService::SetMaxSequenceNumberForTest(8);
SavedFilesService::SetLruSizeForTest(8);
for (int i = 0; i < 4; i++) {
- service_->RegisterFileEntry(extension_->id(), GenerateId(i), path_);
+ service_->RegisterFileEntry(extension_->id(), GenerateId(i), path_, true);
service_->EnqueueFileEntry(extension_->id(), GenerateId(i));
}
service_->EnqueueFileEntry(extension_->id(), GenerateId(2));