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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc

Issue 656393002: [fsp] Pass proper data to Notify(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" 5 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 provided_file_system_->GetObservedEntries(); 532 provided_file_system_->GetObservedEntries();
533 EXPECT_EQ(1u, observed_entries->size()); 533 EXPECT_EQ(1u, observed_entries->size());
534 provided_file_system_->GetObservedEntries(); 534 provided_file_system_->GetObservedEntries();
535 EXPECT_EQ("", observed_entries->begin()->second.last_tag); 535 EXPECT_EQ("", observed_entries->begin()->second.last_tag);
536 } 536 }
537 537
538 { 538 {
539 // Notify about a change. 539 // Notify about a change.
540 const ProvidedFileSystemObserver::ChangeType change_type = 540 const ProvidedFileSystemObserver::ChangeType change_type =
541 ProvidedFileSystemObserver::CHANGED; 541 ProvidedFileSystemObserver::CHANGED;
542 const ProvidedFileSystemObserver::ChildChanges child_changes;
543 const std::string tag = "hello-world"; 542 const std::string tag = "hello-world";
544 EXPECT_TRUE(provided_file_system_->Notify( 543 EXPECT_TRUE(provided_file_system_->Notify(
545 base::FilePath::FromUTF8Unsafe(kDirectoryPath), 544 base::FilePath::FromUTF8Unsafe(kDirectoryPath),
546 change_type, 545 change_type,
547 child_changes, 546 make_scoped_ptr(new ProvidedFileSystemObserver::ChildChanges),
548 tag)); 547 tag));
549 548
550 // Verify the observer event. 549 // Verify the observer event.
551 ASSERT_EQ(1u, observer.change_events().size()); 550 ASSERT_EQ(1u, observer.change_events().size());
552 const Observer::ChangeEvent* const change_event = 551 const Observer::ChangeEvent* const change_event =
553 observer.change_events()[0]; 552 observer.change_events()[0];
554 EXPECT_EQ(change_type, change_event->change_type()); 553 EXPECT_EQ(change_type, change_event->change_type());
555 EXPECT_EQ(0u, change_event->child_changes().size()); 554 EXPECT_EQ(0u, change_event->child_changes().size());
556 555
557 // The tag should not be updated in advance, before all observers handle 556 // The tag should not be updated in advance, before all observers handle
(...skipping 17 matching lines...) Expand all
575 574
576 { 575 {
577 // Notify about deleting of the observed entry. 576 // Notify about deleting of the observed entry.
578 const ProvidedFileSystemObserver::ChangeType change_type = 577 const ProvidedFileSystemObserver::ChangeType change_type =
579 ProvidedFileSystemObserver::DELETED; 578 ProvidedFileSystemObserver::DELETED;
580 const ProvidedFileSystemObserver::ChildChanges child_changes; 579 const ProvidedFileSystemObserver::ChildChanges child_changes;
581 const std::string tag = "chocolate-disco"; 580 const std::string tag = "chocolate-disco";
582 EXPECT_TRUE(provided_file_system_->Notify( 581 EXPECT_TRUE(provided_file_system_->Notify(
583 base::FilePath::FromUTF8Unsafe(kDirectoryPath), 582 base::FilePath::FromUTF8Unsafe(kDirectoryPath),
584 change_type, 583 change_type,
585 child_changes, 584 make_scoped_ptr(new ProvidedFileSystemObserver::ChildChanges),
586 tag)); 585 tag));
587 base::RunLoop().RunUntilIdle(); 586 base::RunLoop().RunUntilIdle();
588 587
589 // Verify the observer event. 588 // Verify the observer event.
590 ASSERT_EQ(2u, observer.change_events().size()); 589 ASSERT_EQ(2u, observer.change_events().size());
591 const Observer::ChangeEvent* const change_event = 590 const Observer::ChangeEvent* const change_event =
592 observer.change_events()[1]; 591 observer.change_events()[1];
593 EXPECT_EQ(change_type, change_event->change_type()); 592 EXPECT_EQ(change_type, change_event->change_type());
594 EXPECT_EQ(0u, change_event->child_changes().size()); 593 EXPECT_EQ(0u, change_event->child_changes().size());
595 } 594 }
596 595
597 // Confirm, that the entry is not observed anymore. 596 // Confirm, that the entry is not observed anymore.
598 { 597 {
599 ProvidedFileSystemInterface::ObservedEntries* const observed_entries = 598 ProvidedFileSystemInterface::ObservedEntries* const observed_entries =
600 provided_file_system_->GetObservedEntries(); 599 provided_file_system_->GetObservedEntries();
601 EXPECT_EQ(0u, observed_entries->size()); 600 EXPECT_EQ(0u, observed_entries->size());
602 EXPECT_EQ(2, observer.list_changed_counter()); 601 EXPECT_EQ(2, observer.list_changed_counter());
603 EXPECT_EQ(2, observer.tag_updated_counter()); 602 EXPECT_EQ(2, observer.tag_updated_counter());
604 } 603 }
605 604
606 provided_file_system_->RemoveObserver(&observer); 605 provided_file_system_->RemoveObserver(&observer);
607 } 606 }
608 607
609 } // namespace file_system_provider 608 } // namespace file_system_provider
610 } // namespace chromeos 609 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698