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

Unified Diff: chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc

Issue 679573002: [fsp] Separate recursive and non-recursive watchers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. 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/provided_file_system_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
index 8404c70f61988926a0f4121a46f15af32ee81bae..976b9545a43dd16b906cd47950985d110315a0db 100644
--- a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
@@ -101,20 +101,20 @@ class Observer : public ProvidedFileSystemObserver {
class ChangeEvent {
public:
ChangeEvent(ProvidedFileSystemObserver::ChangeType change_type,
- const ProvidedFileSystemObserver::ChildChanges& child_changes)
+ const ProvidedFileSystemObserver::Changes& child_changes)
hirono 2014/10/24 06:58:43 nit: child_changes -> changes Same for followings.
mtomasz 2014/10/24 09:50:24 Done.
: change_type_(change_type), child_changes_(child_changes) {}
virtual ~ChangeEvent() {}
ProvidedFileSystemObserver::ChangeType change_type() const {
return change_type_;
}
- const ProvidedFileSystemObserver::ChildChanges& child_changes() const {
+ const ProvidedFileSystemObserver::Changes& child_changes() const {
return child_changes_;
}
private:
const ProvidedFileSystemObserver::ChangeType change_type_;
- const ProvidedFileSystemObserver::ChildChanges child_changes_;
+ const ProvidedFileSystemObserver::Changes child_changes_;
DISALLOW_COPY_AND_ASSIGN(ChangeEvent);
};
@@ -126,7 +126,7 @@ class Observer : public ProvidedFileSystemObserver {
const ProvidedFileSystemInfo& file_system_info,
const ObservedEntry& observed_entry,
ProvidedFileSystemObserver::ChangeType change_type,
- const ProvidedFileSystemObserver::ChildChanges& child_changes,
+ const ProvidedFileSystemObserver::Changes& child_changes,
const base::Closure& callback) override {
EXPECT_EQ(kFileSystemId, file_system_info.file_system_id());
change_events_.push_back(new ChangeEvent(change_type, child_changes));
@@ -369,8 +369,7 @@ TEST_F(FileSystemProviderProvidedFileSystemTest, ObserveDirectory_Exists) {
{
// Create another observer on the same path, but a recursive one. That
- // should
- // succeed.
+ // should succeed.
Log log;
provided_file_system_->ObserveDirectory(
base::FilePath::FromUTF8Unsafe(kDirectoryPath),
@@ -385,11 +384,14 @@ TEST_F(FileSystemProviderProvidedFileSystemTest, ObserveDirectory_Exists) {
ObservedEntries* const observed_entries =
provided_file_system_->GetObservedEntries();
- ASSERT_EQ(1u, observed_entries->size());
- const ObservedEntry& observed_entry = observed_entries->begin()->second;
- EXPECT_EQ(kDirectoryPath, observed_entry.entry_path.value());
- EXPECT_TRUE(observed_entry.recursive);
- EXPECT_EQ("", observed_entry.last_tag);
+ const auto& observed_entry_it = observed_entries->find(
+ ObservedEntryKey(base::FilePath(FILE_PATH_LITERAL(kDirectoryPath)),
+ true /* recursive */));
+ ASSERT_NE(observed_entries->end(), observed_entry_it);
+
+ EXPECT_EQ(kDirectoryPath, observed_entry_it->second.entry_path.value());
+ EXPECT_TRUE(observed_entry_it->second.recursive);
+ EXPECT_EQ("", observed_entry_it->second.last_tag);
}
{
@@ -420,6 +422,7 @@ TEST_F(FileSystemProviderProvidedFileSystemTest, UnobserveEntry) {
Log log;
provided_file_system_->UnobserveEntry(
base::FilePath::FromUTF8Unsafe(kDirectoryPath),
+ false /* recursive */,
base::Bind(&LogStatus, base::Unretained(&log)));
base::RunLoop().RunUntilIdle();
@@ -453,6 +456,7 @@ TEST_F(FileSystemProviderProvidedFileSystemTest, UnobserveEntry) {
Log log;
provided_file_system_->UnobserveEntry(
base::FilePath::FromUTF8Unsafe(kDirectoryPath),
+ false /* recursive */,
base::Bind(&LogStatus, base::Unretained(&log)));
base::RunLoop().RunUntilIdle();
@@ -494,6 +498,7 @@ TEST_F(FileSystemProviderProvidedFileSystemTest, UnobserveEntry) {
Log log;
provided_file_system_->UnobserveEntry(
base::FilePath::FromUTF8Unsafe(kDirectoryPath),
+ false /* recursive */,
base::Bind(&LogStatus, base::Unretained(&log)));
base::RunLoop().RunUntilIdle();
@@ -542,8 +547,9 @@ TEST_F(FileSystemProviderProvidedFileSystemTest, Notify) {
const std::string tag = "hello-world";
EXPECT_TRUE(provided_file_system_->Notify(
base::FilePath::FromUTF8Unsafe(kDirectoryPath),
+ false /* recursive */,
change_type,
- make_scoped_ptr(new ProvidedFileSystemObserver::ChildChanges),
+ make_scoped_ptr(new ProvidedFileSystemObserver::Changes),
tag));
// Verify the observer event.
@@ -576,12 +582,13 @@ TEST_F(FileSystemProviderProvidedFileSystemTest, Notify) {
// Notify about deleting of the observed entry.
const ProvidedFileSystemObserver::ChangeType change_type =
ProvidedFileSystemObserver::DELETED;
- const ProvidedFileSystemObserver::ChildChanges child_changes;
+ const ProvidedFileSystemObserver::Changes child_changes;
const std::string tag = "chocolate-disco";
EXPECT_TRUE(provided_file_system_->Notify(
base::FilePath::FromUTF8Unsafe(kDirectoryPath),
+ false /* recursive */,
change_type,
- make_scoped_ptr(new ProvidedFileSystemObserver::ChildChanges),
+ make_scoped_ptr(new ProvidedFileSystemObserver::Changes),
tag));
base::RunLoop().RunUntilIdle();

Powered by Google App Engine
This is Rietveld 408576698