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 "ios/chrome/browser/reading_list/reading_list_model_memory.h" | 5 #include "ios/chrome/browser/reading_list/reading_list_model_memory.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace { | 8 namespace { |
9 | 9 |
10 class ReadingListModelTest : public ReadingListModelObserver, | 10 class ReadingListModelTest : public ReadingListModelObserver, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 int observer_loaded_; | 84 int observer_loaded_; |
85 int observer_started_batch_update_; | 85 int observer_started_batch_update_; |
86 int observer_completed_batch_update_; | 86 int observer_completed_batch_update_; |
87 int observer_deleted_; | 87 int observer_deleted_; |
88 int observer_remove_unread_; | 88 int observer_remove_unread_; |
89 int observer_remove_read_; | 89 int observer_remove_read_; |
90 int observer_add_unread_; | 90 int observer_add_unread_; |
91 int observer_add_read_; | 91 int observer_add_read_; |
92 int observer_did_apply_; | 92 int observer_did_apply_; |
93 | 93 |
94 scoped_ptr<ReadingListModelMemory> model_; | 94 std::unique_ptr<ReadingListModelMemory> model_; |
95 }; | 95 }; |
96 | 96 |
97 TEST_F(ReadingListModelTest, EmptyLoaded) { | 97 TEST_F(ReadingListModelTest, EmptyLoaded) { |
98 EXPECT_TRUE(model_->loaded()); | 98 EXPECT_TRUE(model_->loaded()); |
99 AssertObserverCount(1, 0, 0, 0, 0, 0, 0, 0, 0); | 99 AssertObserverCount(1, 0, 0, 0, 0, 0, 0, 0, 0); |
100 EXPECT_EQ(0ul, model_->unread_size()); | 100 EXPECT_EQ(0ul, model_->unread_size()); |
101 EXPECT_EQ(0ul, model_->read_size()); | 101 EXPECT_EQ(0ul, model_->read_size()); |
102 model_->Shutdown(); | 102 model_->Shutdown(); |
103 EXPECT_FALSE(model_->loaded()); | 103 EXPECT_FALSE(model_->loaded()); |
104 AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0); | 104 AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 auto third_token = model_->BeginBatchUpdates(); | 172 auto third_token = model_->BeginBatchUpdates(); |
173 AssertObserverCount(1, 2, 1, 0, 0, 0, 0, 0, 0); | 173 AssertObserverCount(1, 2, 1, 0, 0, 0, 0, 0, 0); |
174 EXPECT_TRUE(model_->IsPerformingBatchUpdates()); | 174 EXPECT_TRUE(model_->IsPerformingBatchUpdates()); |
175 | 175 |
176 delete third_token.release(); | 176 delete third_token.release(); |
177 AssertObserverCount(1, 2, 2, 0, 0, 0, 0, 0, 0); | 177 AssertObserverCount(1, 2, 2, 0, 0, 0, 0, 0, 0); |
178 EXPECT_FALSE(model_->IsPerformingBatchUpdates()); | 178 EXPECT_FALSE(model_->IsPerformingBatchUpdates()); |
179 } | 179 } |
180 | 180 |
181 } // namespace | 181 } // namespace |
OLD | NEW |