OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/download/internal/model_impl.h" | 5 #include "components/download/internal/model_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 std::vector<Entry> entries = {entry1, entry2}; | 211 std::vector<Entry> entries = {entry1, entry2}; |
212 | 212 |
213 InSequence sequence; | 213 InSequence sequence; |
214 EXPECT_CALL(client_, OnInitialized(true)).Times(1); | 214 EXPECT_CALL(client_, OnInitialized(true)).Times(1); |
215 | 215 |
216 model_->Initialize(); | 216 model_->Initialize(); |
217 store_->TriggerInit(true, base::MakeUnique<std::vector<Entry>>(entries)); | 217 store_->TriggerInit(true, base::MakeUnique<std::vector<Entry>>(entries)); |
218 | 218 |
219 std::vector<Entry*> expected_peek = {&entry1, &entry2}; | 219 std::vector<Entry*> expected_peek = {&entry1, &entry2}; |
220 | 220 |
221 EXPECT_TRUE( | 221 EXPECT_TRUE(test::CompareEntryList(expected_peek, model_->PeekEntries())); |
222 test::SuperficialEntryListCompare(expected_peek, model_->PeekEntries())); | |
223 } | 222 } |
224 | 223 |
225 TEST_F(DownloadServiceModelImplTest, TestRemoveAfterAdd) { | 224 TEST_F(DownloadServiceModelImplTest, TestRemoveAfterAdd) { |
226 Entry entry = test::BuildEntry(DownloadClient::TEST, base::GenerateGUID()); | 225 Entry entry = test::BuildEntry(DownloadClient::TEST, base::GenerateGUID()); |
227 | 226 |
228 InSequence sequence; | 227 InSequence sequence; |
229 EXPECT_CALL(client_, OnInitialized(true)).Times(1); | 228 EXPECT_CALL(client_, OnInitialized(true)).Times(1); |
230 EXPECT_CALL(client_, OnItemAdded(_, _, _)).Times(0); | 229 EXPECT_CALL(client_, OnItemAdded(_, _, _)).Times(0); |
231 EXPECT_CALL(client_, OnItemRemoved(true, entry.client, entry.guid)).Times(1); | 230 EXPECT_CALL(client_, OnItemRemoved(true, entry.client, entry.guid)).Times(1); |
232 | 231 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 EXPECT_TRUE(test::SuperficialEntryCompare(&entry2, model_->Get(entry2.guid))); | 264 EXPECT_TRUE(test::SuperficialEntryCompare(&entry2, model_->Get(entry2.guid))); |
266 | 265 |
267 model_->Remove(entry2.guid); | 266 model_->Remove(entry2.guid); |
268 EXPECT_EQ(nullptr, model_->Get(entry2.guid)); | 267 EXPECT_EQ(nullptr, model_->Get(entry2.guid)); |
269 | 268 |
270 store_->TriggerUpdate(true); | 269 store_->TriggerUpdate(true); |
271 store_->TriggerRemove(true); | 270 store_->TriggerRemove(true); |
272 } | 271 } |
273 | 272 |
274 } // namespace download | 273 } // namespace download |
OLD | NEW |