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

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

Issue 1088883002: Add events for configuring and adding new providers to FSP API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/operations/configure_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/configure_unittest.cc
similarity index 58%
copy from chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
copy to chrome/browser/chromeos/file_system_provider/operations/configure_unittest.cc
index e53bda4bacc87c39ae1de4844d904884478a4575..984ca847bd271b3fc63679dd26e31ccb352cb3e1 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/configure_unittest.cc
@@ -1,8 +1,8 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/file_system_provider/operations/unmount.h"
+#include "chrome/browser/chromeos/file_system_provider/operations/configure.h"
#include <string>
#include <vector>
@@ -28,40 +28,38 @@ const int kRequestId = 2;
} // namespace
-class FileSystemProviderOperationsUnmountTest : public testing::Test {
+class FileSystemProviderOperationsConfigureTest : public testing::Test {
protected:
- FileSystemProviderOperationsUnmountTest() {}
- ~FileSystemProviderOperationsUnmountTest() override {}
+ FileSystemProviderOperationsConfigureTest() {}
+ ~FileSystemProviderOperationsConfigureTest() override {}
void SetUp() override {
file_system_info_ = ProvidedFileSystemInfo(
- kExtensionId,
- MountOptions(kFileSystemId, "" /* display_name */),
+ kExtensionId, MountOptions(kFileSystemId, "" /* display_name */),
base::FilePath());
}
ProvidedFileSystemInfo file_system_info_;
};
-TEST_F(FileSystemProviderOperationsUnmountTest, Execute) {
- using extensions::api::file_system_provider::UnmountRequestedOptions;
+TEST_F(FileSystemProviderOperationsConfigureTest, Execute) {
+ using extensions::api::file_system_provider::ConfigureRequestedOptions;
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- Unmount unmount(NULL,
- file_system_info_,
- base::Bind(&util::LogStatusCallback, &callback_log));
- unmount.SetDispatchEventImplForTesting(
+ Configure configure(NULL, file_system_info_,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ configure.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(unmount.Execute(kRequestId));
+ EXPECT_TRUE(configure.Execute(kRequestId));
ASSERT_EQ(1u, dispatcher.events().size());
extensions::Event* event = dispatcher.events()[0];
EXPECT_EQ(
- extensions::api::file_system_provider::OnUnmountRequested::kEventName,
+ extensions::api::file_system_provider::OnConfigureRequested::kEventName,
event->event_name);
base::ListValue* event_args = event->event_args.get();
ASSERT_EQ(1u, event_args->GetSize());
@@ -69,66 +67,58 @@ TEST_F(FileSystemProviderOperationsUnmountTest, Execute) {
const base::DictionaryValue* options_as_value = NULL;
ASSERT_TRUE(event_args->GetDictionary(0, &options_as_value));
- UnmountRequestedOptions options;
- ASSERT_TRUE(UnmountRequestedOptions::Populate(*options_as_value, &options));
+ ConfigureRequestedOptions options;
+ ASSERT_TRUE(ConfigureRequestedOptions::Populate(*options_as_value, &options));
EXPECT_EQ(kFileSystemId, options.file_system_id);
EXPECT_EQ(kRequestId, options.request_id);
}
-TEST_F(FileSystemProviderOperationsUnmountTest, Execute_NoListener) {
+TEST_F(FileSystemProviderOperationsConfigureTest, Execute_NoListener) {
util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- Unmount unmount(NULL,
- file_system_info_,
- base::Bind(&util::LogStatusCallback, &callback_log));
- unmount.SetDispatchEventImplForTesting(
+ Configure configure(NULL, file_system_info_,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ configure.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_FALSE(unmount.Execute(kRequestId));
+ EXPECT_FALSE(configure.Execute(kRequestId));
}
-TEST_F(FileSystemProviderOperationsUnmountTest, OnSuccess) {
- using extensions::api::file_system_provider_internal::
- UnmountRequestedSuccess::Params;
-
+TEST_F(FileSystemProviderOperationsConfigureTest, OnSuccess) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- Unmount unmount(NULL,
- file_system_info_,
- base::Bind(&util::LogStatusCallback, &callback_log));
- unmount.SetDispatchEventImplForTesting(
+ Configure configure(NULL, file_system_info_,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ configure.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(unmount.Execute(kRequestId));
+ EXPECT_TRUE(configure.Execute(kRequestId));
- unmount.OnSuccess(kRequestId,
- scoped_ptr<RequestValue>(new RequestValue()),
- false /* has_more */);
+ configure.OnSuccess(kRequestId, scoped_ptr<RequestValue>(new RequestValue()),
+ false /* has_more */);
ASSERT_EQ(1u, callback_log.size());
base::File::Error event_result = callback_log[0];
EXPECT_EQ(base::File::FILE_OK, event_result);
}
-TEST_F(FileSystemProviderOperationsUnmountTest, OnError) {
+TEST_F(FileSystemProviderOperationsConfigureTest, OnError) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- Unmount unmount(NULL,
- file_system_info_,
- base::Bind(&util::LogStatusCallback, &callback_log));
- unmount.SetDispatchEventImplForTesting(
+ Configure configure(NULL, file_system_info_,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ configure.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(unmount.Execute(kRequestId));
+ EXPECT_TRUE(configure.Execute(kRequestId));
- unmount.OnError(kRequestId,
- scoped_ptr<RequestValue>(new RequestValue()),
- base::File::FILE_ERROR_NOT_FOUND);
+ configure.OnError(kRequestId, scoped_ptr<RequestValue>(new RequestValue()),
+ base::File::FILE_ERROR_NOT_FOUND);
ASSERT_EQ(1u, callback_log.size());
base::File::Error event_result = callback_log[0];
EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, event_result);

Powered by Google App Engine
This is Rietveld 408576698