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

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

Issue 674413002: [fsp] Rename ObserveEntry with AddWatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 2 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/remove_watcher_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc
similarity index 70%
rename from chrome/browser/chromeos/file_system_provider/operations/unobserve_entry_unittest.cc
rename to chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc
index 20fec02049ebf3f27309d5932d4ff0ee39c28ea2..a43719ab51b4529bee41fdb93ffb9d61c1541988 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc
@@ -2,7 +2,7 @@
// 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/unobserve_entry.h"
+#include "chrome/browser/chromeos/file_system_provider/operations/remove_watcher.h"
#include <string>
#include <vector>
@@ -31,10 +31,10 @@ const base::FilePath::CharType kEntryPath[] = "/kitty/and/puppy/happy";
} // namespace
-class FileSystemProviderOperationsUnobserveEntryTest : public testing::Test {
+class FileSystemProviderOperationsRemoveWatcherTest : public testing::Test {
protected:
- FileSystemProviderOperationsUnobserveEntryTest() {}
- virtual ~FileSystemProviderOperationsUnobserveEntryTest() {}
+ FileSystemProviderOperationsRemoveWatcherTest() {}
+ virtual ~FileSystemProviderOperationsRemoveWatcherTest() {}
virtual void SetUp() override {
file_system_info_ = ProvidedFileSystemInfo(
@@ -46,27 +46,27 @@ class FileSystemProviderOperationsUnobserveEntryTest : public testing::Test {
ProvidedFileSystemInfo file_system_info_;
};
-TEST_F(FileSystemProviderOperationsUnobserveEntryTest, Execute) {
- using extensions::api::file_system_provider::UnobserveEntryRequestedOptions;
+TEST_F(FileSystemProviderOperationsRemoveWatcherTest, Execute) {
+ using extensions::api::file_system_provider::RemoveWatcherRequestedOptions;
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- UnobserveEntry unobserve_entry(
+ RemoveWatcher remove_watcher(
NULL,
file_system_info_,
base::FilePath::FromUTF8Unsafe(kEntryPath),
true /* recursive */,
base::Bind(&util::LogStatusCallback, &callback_log));
- unobserve_entry.SetDispatchEventImplForTesting(
+ remove_watcher.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(unobserve_entry.Execute(kRequestId));
+ EXPECT_TRUE(remove_watcher.Execute(kRequestId));
ASSERT_EQ(1u, dispatcher.events().size());
extensions::Event* event = dispatcher.events()[0];
- EXPECT_EQ(extensions::api::file_system_provider::OnUnobserveEntryRequested::
+ EXPECT_EQ(extensions::api::file_system_provider::OnRemoveWatcherRequested::
kEventName,
event->event_name);
base::ListValue* event_args = event->event_args.get();
@@ -75,74 +75,74 @@ TEST_F(FileSystemProviderOperationsUnobserveEntryTest, Execute) {
const base::DictionaryValue* options_as_value = NULL;
ASSERT_TRUE(event_args->GetDictionary(0, &options_as_value));
- UnobserveEntryRequestedOptions options;
+ RemoveWatcherRequestedOptions options;
ASSERT_TRUE(
- UnobserveEntryRequestedOptions::Populate(*options_as_value, &options));
+ RemoveWatcherRequestedOptions::Populate(*options_as_value, &options));
EXPECT_EQ(kFileSystemId, options.file_system_id);
EXPECT_EQ(kRequestId, options.request_id);
EXPECT_EQ(kEntryPath, options.entry_path);
EXPECT_TRUE(options.recursive);
}
-TEST_F(FileSystemProviderOperationsUnobserveEntryTest, Execute_NoListener) {
+TEST_F(FileSystemProviderOperationsRemoveWatcherTest, Execute_NoListener) {
util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- UnobserveEntry unobserve_entry(
+ RemoveWatcher remove_watcher(
NULL,
file_system_info_,
base::FilePath::FromUTF8Unsafe(kEntryPath),
true /* recursive */,
base::Bind(&util::LogStatusCallback, &callback_log));
- unobserve_entry.SetDispatchEventImplForTesting(
+ remove_watcher.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_FALSE(unobserve_entry.Execute(kRequestId));
+ EXPECT_FALSE(remove_watcher.Execute(kRequestId));
}
-TEST_F(FileSystemProviderOperationsUnobserveEntryTest, OnSuccess) {
+TEST_F(FileSystemProviderOperationsRemoveWatcherTest, OnSuccess) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- UnobserveEntry unobserve_entry(
+ RemoveWatcher remove_watcher(
NULL,
file_system_info_,
base::FilePath::FromUTF8Unsafe(kEntryPath),
true /* recursive */,
base::Bind(&util::LogStatusCallback, &callback_log));
- unobserve_entry.SetDispatchEventImplForTesting(
+ remove_watcher.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(unobserve_entry.Execute(kRequestId));
+ EXPECT_TRUE(remove_watcher.Execute(kRequestId));
- unobserve_entry.OnSuccess(kRequestId,
- scoped_ptr<RequestValue>(new RequestValue()),
- false /* has_more */);
+ remove_watcher.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(FileSystemProviderOperationsUnobserveEntryTest, OnError) {
+TEST_F(FileSystemProviderOperationsRemoveWatcherTest, OnError) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;
- UnobserveEntry unobserve_entry(
+ RemoveWatcher remove_watcher(
NULL,
file_system_info_,
base::FilePath::FromUTF8Unsafe(kEntryPath),
true /* recursive */,
base::Bind(&util::LogStatusCallback, &callback_log));
- unobserve_entry.SetDispatchEventImplForTesting(
+ remove_watcher.SetDispatchEventImplForTesting(
base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
- EXPECT_TRUE(unobserve_entry.Execute(kRequestId));
+ EXPECT_TRUE(remove_watcher.Execute(kRequestId));
- unobserve_entry.OnError(kRequestId,
- scoped_ptr<RequestValue>(new RequestValue()),
- base::File::FILE_ERROR_TOO_MANY_OPENED);
+ remove_watcher.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