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

Unified Diff: chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc

Issue 375543002: [fsp] Add support for deleting entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased + cleaned up. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
similarity index 55%
copy from chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc
copy to chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
index 8336db43c373f118fcf9e874ca7daff2f70e581f..43a7dd341b1320c77eb462e8f7642b2de74a5a71 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
@@ -9,7 +9,7 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
-#include "chrome/browser/chromeos/file_system_provider/operations/create_directory.h"
+#include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h"
#include "chrome/browser/chromeos/file_system_provider/operations/test_util.h"
#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
#include "chrome/common/extensions/api/file_system_provider.h"
@@ -26,14 +26,14 @@ namespace {
const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj";
const char kFileSystemId[] = "testing-file-system";
const int kRequestId = 2;
-const base::FilePath::CharType kDirectoryPath[] = "/kitty/and/puppy/happy";
+const base::FilePath::CharType kEntryPath[] = "/kitty/and/puppy/happy";
} // namespace
-class FileSystemProviderOperationsCreateDirectoryTest : public testing::Test {
+class FileSystemProviderOperationsDeleteEntryTest : public testing::Test {
protected:
- FileSystemProviderOperationsCreateDirectoryTest() {}
- virtual ~FileSystemProviderOperationsCreateDirectoryTest() {}
+ FileSystemProviderOperationsDeleteEntryTest() {}
+ virtual ~FileSystemProviderOperationsDeleteEntryTest() {}
virtual void SetUp() OVERRIDE {
file_system_info_ =
@@ -46,28 +46,26 @@ class FileSystemProviderOperationsCreateDirectoryTest : public testing::Test {
ProvidedFileSystemInfo file_system_info_;
};
-TEST_F(FileSystemProviderOperationsCreateDirectoryTest, Execute) {
+TEST_F(FileSystemProviderOperationsDeleteEntryTest, Execute) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- CreateDirectory create_directory(
- NULL,
- file_system_info_,
- base::FilePath::FromUTF8Unsafe(kDirectoryPath),
- false /* exclusive */,
- true /* recursive */,
- base::Bind(&util::LogStatusCallback, &callback_log));
- create_directory.SetDispatchEventImplForTesting(
+ DeleteEntry delete_entry(NULL,
+ file_system_info_,
+ base::FilePath::FromUTF8Unsafe(kEntryPath),
+ true /* recursive */,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ delete_entry.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(create_directory.Execute(kRequestId));
+ EXPECT_TRUE(delete_entry.Execute(kRequestId));
ASSERT_EQ(1u, dispatcher.events().size());
extensions::Event* event = dispatcher.events()[0];
- EXPECT_EQ(extensions::api::file_system_provider::OnCreateDirectoryRequested::
- kEventName,
- event->event_name);
+ EXPECT_EQ(
+ extensions::api::file_system_provider::OnDeleteEntryRequested::kEventName,
+ event->event_name);
base::ListValue* event_args = event->event_args.get();
ASSERT_EQ(1u, event_args->GetSize());
@@ -82,81 +80,71 @@ TEST_F(FileSystemProviderOperationsCreateDirectoryTest, Execute) {
EXPECT_TRUE(options->GetInteger("requestId", &event_request_id));
EXPECT_EQ(kRequestId, event_request_id);
- std::string event_directory_path;
- EXPECT_TRUE(options->GetString("directoryPath", &event_directory_path));
- EXPECT_EQ(kDirectoryPath, event_directory_path);
-
- bool event_exclusive;
- EXPECT_TRUE(options->GetBoolean("exclusive", &event_exclusive));
- EXPECT_FALSE(event_exclusive);
+ std::string event_entry_path;
+ EXPECT_TRUE(options->GetString("entryPath", &event_entry_path));
+ EXPECT_EQ(kEntryPath, event_entry_path);
bool event_recursive;
EXPECT_TRUE(options->GetBoolean("recursive", &event_recursive));
EXPECT_TRUE(event_recursive);
}
-TEST_F(FileSystemProviderOperationsCreateDirectoryTest, Execute_NoListener) {
+TEST_F(FileSystemProviderOperationsDeleteEntryTest, Execute_NoListener) {
util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- CreateDirectory create_directory(
- NULL,
- file_system_info_,
- base::FilePath::FromUTF8Unsafe(kDirectoryPath),
- false /* exclusive */,
- true /* recursive */,
- base::Bind(&util::LogStatusCallback, &callback_log));
- create_directory.SetDispatchEventImplForTesting(
+ DeleteEntry delete_entry(NULL,
+ file_system_info_,
+ base::FilePath::FromUTF8Unsafe(kEntryPath),
+ true /* recursive */,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ delete_entry.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_FALSE(create_directory.Execute(kRequestId));
+ EXPECT_FALSE(delete_entry.Execute(kRequestId));
}
-TEST_F(FileSystemProviderOperationsCreateDirectoryTest, OnSuccess) {
+TEST_F(FileSystemProviderOperationsDeleteEntryTest, OnSuccess) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- CreateDirectory create_directory(
- NULL,
- file_system_info_,
- base::FilePath::FromUTF8Unsafe(kDirectoryPath),
- false /* exclusive */,
- true /* recursive */,
- base::Bind(&util::LogStatusCallback, &callback_log));
- create_directory.SetDispatchEventImplForTesting(
+ DeleteEntry delete_entry(NULL,
+ file_system_info_,
+ base::FilePath::FromUTF8Unsafe(kEntryPath),
+ true /* recursive */,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ delete_entry.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(create_directory.Execute(kRequestId));
+ EXPECT_TRUE(delete_entry.Execute(kRequestId));
- create_directory.OnSuccess(kRequestId,
- scoped_ptr<RequestValue>(new RequestValue()),
- false /* has_more */);
+ delete_entry.OnSuccess(kRequestId,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ false /* has_more */);
ASSERT_EQ(1u, callback_log.size());
EXPECT_EQ(base::File::FILE_OK, callback_log[0]);
}
-TEST_F(FileSystemProviderOperationsCreateDirectoryTest, OnError) {
+TEST_F(FileSystemProviderOperationsDeleteEntryTest, OnError) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- CreateDirectory create_directory(
- NULL,
- file_system_info_,
- base::FilePath::FromUTF8Unsafe(kDirectoryPath),
- false /* exclusive */,
- true /* recursive */,
- base::Bind(&util::LogStatusCallback, &callback_log));
- create_directory.SetDispatchEventImplForTesting(
+ DeleteEntry delete_entry(NULL,
+ file_system_info_,
+ base::FilePath::FromUTF8Unsafe(kEntryPath),
+ true /* recursive */,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ delete_entry.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(create_directory.Execute(kRequestId));
+ EXPECT_TRUE(delete_entry.Execute(kRequestId));
- create_directory.OnError(kRequestId,
- scoped_ptr<RequestValue>(new RequestValue()),
- base::File::FILE_ERROR_TOO_MANY_OPENED);
+ delete_entry.OnError(kRequestId,
+ scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_TOO_MANY_OPENED);
ASSERT_EQ(1u, callback_log.size());
EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
}

Powered by Google App Engine
This is Rietveld 408576698