| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/reading_list/ios/reading_list_model.h" | 5 #include "components/reading_list/ios/reading_list_model.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #import "base/test/ios/wait_util.h" | 9 #import "base/test/ios/wait_util.h" |
| 10 #include "components/reading_list/ios/reading_list_model_impl.h" | 10 #include "components/reading_list/ios/reading_list_model_impl.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class TestReadingListStorageObserver { | 22 class TestReadingListStorageObserver { |
| 23 public: | 23 public: |
| 24 virtual void ReadingListDidSaveEntry() = 0; | 24 virtual void ReadingListDidSaveEntry() = 0; |
| 25 virtual void ReadingListDidRemoveEntry() = 0; | 25 virtual void ReadingListDidRemoveEntry() = 0; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 class TestReadingListStorage : public ReadingListModelStorage { | 28 class TestReadingListStorage : public ReadingListModelStorage { |
| 29 public: | 29 public: |
| 30 TestReadingListStorage(TestReadingListStorageObserver* observer) | 30 TestReadingListStorage(TestReadingListStorageObserver* observer) |
| 31 : ReadingListModelStorage( | 31 : ReadingListModelStorage( |
| 32 base::Bind(&syncer::ModelTypeChangeProcessor::Create), | 32 base::Bind(&syncer::ModelTypeChangeProcessor::Create, |
| 33 base::RepeatingClosure()), |
| 33 syncer::READING_LIST), | 34 syncer::READING_LIST), |
| 34 entries_(new ReadingListStoreDelegate::ReadingListEntries()), | 35 entries_(new ReadingListStoreDelegate::ReadingListEntries()), |
| 35 observer_(observer) {} | 36 observer_(observer) {} |
| 36 | 37 |
| 37 void AddSampleEntries() { | 38 void AddSampleEntries() { |
| 38 // Adds timer and interlace read/unread entry creation to avoid having two | 39 // Adds timer and interlace read/unread entry creation to avoid having two |
| 39 // entries with the same creation timestamp. | 40 // entries with the same creation timestamp. |
| 40 ReadingListEntry unread_a(GURL("http://unread_a.com"), "unread_a"); | 41 ReadingListEntry unread_a(GURL("http://unread_a.com"), "unread_a"); |
| 41 entries_->insert( | 42 entries_->insert( |
| 42 std::make_pair(GURL("http://unread_a.com"), std::move(unread_a))); | 43 std::make_pair(GURL("http://unread_a.com"), std::move(unread_a))); |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 677 } |
| 677 | 678 |
| 678 // Tests that ReadingListModel calls CallbackModelBeingDeleted when destroyed. | 679 // Tests that ReadingListModel calls CallbackModelBeingDeleted when destroyed. |
| 679 TEST_F(ReadingListModelTest, CallbackModelBeingDeleted) { | 680 TEST_F(ReadingListModelTest, CallbackModelBeingDeleted) { |
| 680 AssertObserverCount(1, 0, 0, 0, 0, 0, 0, 0, 0); | 681 AssertObserverCount(1, 0, 0, 0, 0, 0, 0, 0, 0); |
| 681 model_.reset(); | 682 model_.reset(); |
| 682 AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0); | 683 AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0); |
| 683 } | 684 } |
| 684 | 685 |
| 685 } // namespace | 686 } // namespace |
| OLD | NEW |