OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dom_distiller/core/dom_distiller_service.h" | 5 #include "components/dom_distiller/core/dom_distiller_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "components/dom_distiller/core/article_entry.h" | 13 #include "components/dom_distiller/core/article_entry.h" |
| 14 #include "components/dom_distiller/core/distilled_page_prefs.h" |
14 #include "components/dom_distiller/core/dom_distiller_model.h" | 15 #include "components/dom_distiller/core/dom_distiller_model.h" |
15 #include "components/dom_distiller/core/dom_distiller_store.h" | 16 #include "components/dom_distiller/core/dom_distiller_store.h" |
16 #include "components/dom_distiller/core/dom_distiller_test_util.h" | 17 #include "components/dom_distiller/core/dom_distiller_test_util.h" |
17 #include "components/dom_distiller/core/fake_distiller.h" | 18 #include "components/dom_distiller/core/fake_distiller.h" |
18 #include "components/dom_distiller/core/fake_distiller_page.h" | 19 #include "components/dom_distiller/core/fake_distiller_page.h" |
19 #include "components/dom_distiller/core/task_tracker.h" | 20 #include "components/dom_distiller/core/task_tracker.h" |
20 #include "components/leveldb_proto/testing/fake_db.h" | 21 #include "components/leveldb_proto/testing/fake_db.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 | 24 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 main_loop_.reset(new base::MessageLoop()); | 83 main_loop_.reset(new base::MessageLoop()); |
83 FakeDB<ArticleEntry>* fake_db = new FakeDB<ArticleEntry>(&db_model_); | 84 FakeDB<ArticleEntry>* fake_db = new FakeDB<ArticleEntry>(&db_model_); |
84 FakeDB<ArticleEntry>::EntryMap store_model; | 85 FakeDB<ArticleEntry>::EntryMap store_model; |
85 store_ = | 86 store_ = |
86 test::util::CreateStoreWithFakeDB(fake_db, store_model); | 87 test::util::CreateStoreWithFakeDB(fake_db, store_model); |
87 distiller_factory_ = new MockDistillerFactory(); | 88 distiller_factory_ = new MockDistillerFactory(); |
88 distiller_page_factory_ = new MockDistillerPageFactory(); | 89 distiller_page_factory_ = new MockDistillerPageFactory(); |
89 service_.reset(new DomDistillerService( | 90 service_.reset(new DomDistillerService( |
90 scoped_ptr<DomDistillerStoreInterface>(store_), | 91 scoped_ptr<DomDistillerStoreInterface>(store_), |
91 scoped_ptr<DistillerFactory>(distiller_factory_), | 92 scoped_ptr<DistillerFactory>(distiller_factory_), |
92 scoped_ptr<DistillerPageFactory>(distiller_page_factory_))); | 93 scoped_ptr<DistillerPageFactory>(distiller_page_factory_), |
| 94 scoped_ptr<DistilledPagePrefs>())); |
93 fake_db->InitCallback(true); | 95 fake_db->InitCallback(true); |
94 fake_db->LoadCallback(true); | 96 fake_db->LoadCallback(true); |
95 } | 97 } |
96 | 98 |
97 virtual void TearDown() { | 99 virtual void TearDown() { |
98 base::RunLoop().RunUntilIdle(); | 100 base::RunLoop().RunUntilIdle(); |
99 store_ = NULL; | 101 store_ = NULL; |
100 distiller_factory_ = NULL; | 102 distiller_factory_ = NULL; |
101 service_.reset(); | 103 service_.reset(); |
102 } | 104 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 EXPECT_TRUE(store_->GetEntryByUrl(pages_url[page_num], &entry)); | 441 EXPECT_TRUE(store_->GetEntryByUrl(pages_url[page_num], &entry)); |
440 } | 442 } |
441 | 443 |
442 service_->RemoveEntry(entry_id); | 444 service_->RemoveEntry(entry_id); |
443 base::RunLoop().RunUntilIdle(); | 445 base::RunLoop().RunUntilIdle(); |
444 EXPECT_EQ(0u, store_->GetEntries().size()); | 446 EXPECT_EQ(0u, store_->GetEntries().size()); |
445 } | 447 } |
446 | 448 |
447 } // namespace test | 449 } // namespace test |
448 } // namespace dom_distiller | 450 } // namespace dom_distiller |
OLD | NEW |