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 <stddef.h> | 5 #include <stddef.h> |
6 #include <sstream> | 6 #include <sstream> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "components/dom_distiller/core/dom_distiller_service.h" | 24 #include "components/dom_distiller/core/dom_distiller_service.h" |
25 #include "components/dom_distiller/core/dom_distiller_store.h" | 25 #include "components/dom_distiller/core/dom_distiller_store.h" |
26 #include "components/dom_distiller/core/proto/distilled_article.pb.h" | 26 #include "components/dom_distiller/core/proto/distilled_article.pb.h" |
27 #include "components/dom_distiller/core/proto/distilled_page.pb.h" | 27 #include "components/dom_distiller/core/proto/distilled_page.pb.h" |
28 #include "components/dom_distiller/core/task_tracker.h" | 28 #include "components/dom_distiller/core/task_tracker.h" |
29 #include "components/leveldb_proto/proto_database.h" | 29 #include "components/leveldb_proto/proto_database.h" |
30 #include "components/leveldb_proto/proto_database_impl.h" | 30 #include "components/leveldb_proto/proto_database_impl.h" |
31 #include "components/pref_registry/testing_pref_service_syncable.h" | 31 #include "components/pref_registry/testing_pref_service_syncable.h" |
32 #include "content/public/browser/browser_context.h" | 32 #include "content/public/browser/browser_context.h" |
33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/storage_partition.h" | |
35 #include "content/public/common/isolated_world_ids.h" | 34 #include "content/public/common/isolated_world_ids.h" |
36 #include "content/public/test/content_browser_test.h" | 35 #include "content/public/test/content_browser_test.h" |
37 #include "content/shell/browser/shell.h" | 36 #include "content/shell/browser/shell.h" |
38 #include "google/protobuf/io/coded_stream.h" | 37 #include "google/protobuf/io/coded_stream.h" |
39 #include "google/protobuf/io/zero_copy_stream_impl_lite.h" | 38 #include "google/protobuf/io/zero_copy_stream_impl_lite.h" |
40 #include "net/dns/mock_host_resolver.h" | 39 #include "net/dns/mock_host_resolver.h" |
41 #include "third_party/dom_distiller_js/dom_distiller.pb.h" | 40 #include "third_party/dom_distiller_js/dom_distiller.pb.h" |
42 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
43 | 42 |
44 using content::ContentBrowserTest; | 43 using content::ContentBrowserTest; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // temporary directory. | 132 // temporary directory. |
134 scoped_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry> > db( | 133 scoped_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry> > db( |
135 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( | 134 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( |
136 background_task_runner)); | 135 background_task_runner)); |
137 scoped_ptr<DomDistillerStore> dom_distiller_store( | 136 scoped_ptr<DomDistillerStore> dom_distiller_store( |
138 new DomDistillerStore(std::move(db), db_path)); | 137 new DomDistillerStore(std::move(db), db_path)); |
139 | 138 |
140 scoped_ptr<DistillerPageFactory> distiller_page_factory( | 139 scoped_ptr<DistillerPageFactory> distiller_page_factory( |
141 new DistillerPageWebContentsFactory(context)); | 140 new DistillerPageWebContentsFactory(context)); |
142 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( | 141 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( |
143 new DistillerURLFetcherFactory( | 142 new DistillerURLFetcherFactory(context->GetRequestContext())); |
144 content::BrowserContext::GetDefaultStoragePartition(context)-> | |
145 GetURLRequestContext())); | |
146 | 143 |
147 dom_distiller::proto::DomDistillerOptions options; | 144 dom_distiller::proto::DomDistillerOptions options; |
148 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kExtractTextOnly)) { | 145 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kExtractTextOnly)) { |
149 options.set_extract_text_only(true); | 146 options.set_extract_text_only(true); |
150 } | 147 } |
151 int debug_level = 0; | 148 int debug_level = 0; |
152 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kDebugLevel) && | 149 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kDebugLevel) && |
153 base::StringToInt( | 150 base::StringToInt( |
154 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 151 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
155 kDebugLevel), | 152 kDebugLevel), |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 scoped_ptr<google::protobuf::io::StringOutputStream> protobuf_output_stream_; | 432 scoped_ptr<google::protobuf::io::StringOutputStream> protobuf_output_stream_; |
436 }; | 433 }; |
437 | 434 |
438 IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) { | 435 IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) { |
439 SetDistillerJavaScriptWorldId(content::ISOLATED_WORLD_ID_CONTENT_END); | 436 SetDistillerJavaScriptWorldId(content::ISOLATED_WORLD_ID_CONTENT_END); |
440 Start(); | 437 Start(); |
441 base::RunLoop().Run(); | 438 base::RunLoop().Run(); |
442 } | 439 } |
443 | 440 |
444 } // namespace dom_distiller | 441 } // namespace dom_distiller |
OLD | NEW |