OLD | NEW |
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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 command_line->AppendSwitch(switches::kEnableDomDistiller); | 120 command_line->AppendSwitch(switches::kEnableDomDistiller); |
121 } | 121 } |
122 | 122 |
123 static KeyedService* Build(content::BrowserContext* context) { | 123 static KeyedService* Build(content::BrowserContext* context) { |
124 FakeDB* fake_db = new FakeDB(database_model_); | 124 FakeDB* fake_db = new FakeDB(database_model_); |
125 MockDistillerFactory* factory = new MockDistillerFactory(); | 125 MockDistillerFactory* factory = new MockDistillerFactory(); |
126 DomDistillerContextKeyedService* service = | 126 DomDistillerContextKeyedService* service = |
127 new DomDistillerContextKeyedService( | 127 new DomDistillerContextKeyedService( |
128 scoped_ptr<DomDistillerStoreInterface>( | 128 scoped_ptr<DomDistillerStoreInterface>( |
129 CreateStoreWithFakeDB(fake_db, FakeDB::EntryMap())), | 129 CreateStoreWithFakeDB(fake_db, FakeDB::EntryMap())), |
130 scoped_ptr<DistillerFactory>(factory)); | 130 scoped_ptr<DistillerFactory>(factory), |
| 131 scoped_ptr<DistillerPageFactory>()); |
131 fake_db->InitCallback(true); | 132 fake_db->InitCallback(true); |
132 fake_db->LoadCallback(true); | 133 fake_db->LoadCallback(true); |
133 if (expect_distillation_) { | 134 if (expect_distillation_) { |
134 // There will only be destillation of an article if the database contains | 135 // There will only be destillation of an article if the database contains |
135 // the article. | 136 // the article. |
136 FakeDistiller* distiller = new FakeDistiller(true); | 137 FakeDistiller* distiller = new FakeDistiller(true); |
137 EXPECT_CALL(*factory, CreateDistillerImpl()) | 138 EXPECT_CALL(*factory, CreateDistillerImpl()) |
138 .WillOnce(testing::Return(distiller)); | 139 .WillOnce(testing::Return(distiller)); |
139 } | 140 } |
140 return service; | 141 return service; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 ASSERT_TRUE(observer.finished_load()); | 235 ASSERT_TRUE(observer.finished_load()); |
235 ASSERT_EQ(url, observer.validated_url()); | 236 ASSERT_EQ(url, observer.validated_url()); |
236 // Ensure no bindings. | 237 // Ensure no bindings. |
237 const content::RenderViewHost* render_view_host = observer.render_view_host(); | 238 const content::RenderViewHost* render_view_host = observer.render_view_host(); |
238 ASSERT_EQ(0, render_view_host->GetEnabledBindings()); | 239 ASSERT_EQ(0, render_view_host->GetEnabledBindings()); |
239 // The MIME-type should always be text/css for the CSS resources. | 240 // The MIME-type should always be text/css for the CSS resources. |
240 EXPECT_EQ("text/css", observer.web_contents()->GetContentsMimeType()); | 241 EXPECT_EQ("text/css", observer.web_contents()->GetContentsMimeType()); |
241 } | 242 } |
242 | 243 |
243 } // namespace dom_distiller | 244 } // namespace dom_distiller |
OLD | NEW |