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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 message.SerializeWithCachedSizes(&coded_output); | 131 message.SerializeWithCachedSizes(&coded_output); |
132 return !coded_output.HadError(); | 132 return !coded_output.HadError(); |
133 } | 133 } |
134 | 134 |
135 std::string GetReadableArticleString( | 135 std::string GetReadableArticleString( |
136 const DistilledArticleProto& article_proto) { | 136 const DistilledArticleProto& article_proto) { |
137 std::stringstream output; | 137 std::stringstream output; |
138 output << "Article Title: " << article_proto.title() << std::endl; | 138 output << "Article Title: " << article_proto.title() << std::endl; |
139 output << "# of pages: " << article_proto.pages_size() << std::endl; | 139 output << "# of pages: " << article_proto.pages_size() << std::endl; |
140 for (int i = 0; i < article_proto.pages_size(); ++i) { | 140 for (int i = 0; i < article_proto.pages_size(); ++i) { |
| 141 if (i > 0) output << std::endl; |
141 const DistilledPageProto& page = article_proto.pages(i); | 142 const DistilledPageProto& page = article_proto.pages(i); |
142 output << "Page " << i << std::endl; | 143 output << "Page " << i << std::endl; |
143 output << "URL: " << page.url() << std::endl; | 144 output << "URL: " << page.url() << std::endl; |
144 output << "Content: " << page.html() << std::endl; | 145 output << "Content: " << page.html() << std::endl; |
145 if (page.has_debug_info() && page.debug_info().has_log()) | 146 if (page.has_debug_info() && page.debug_info().has_log()) |
146 output << "Log: " << page.debug_info().log() << std::endl; | 147 output << "Log: " << page.debug_info().log() << std::endl; |
| 148 if (page.has_pagination_info()) { |
| 149 if (page.pagination_info().has_next_page()) { |
| 150 output << "Next Page: " << page.pagination_info().next_page() |
| 151 << std::endl; |
| 152 } |
| 153 if (page.pagination_info().has_prev_page()) { |
| 154 output << "Prev Page: " << page.pagination_info().prev_page() |
| 155 << std::endl; |
| 156 } |
| 157 } |
147 } | 158 } |
148 return output.str(); | 159 return output.str(); |
149 } | 160 } |
150 | 161 |
151 } // namespace | 162 } // namespace |
152 | 163 |
153 class ContentExtractionRequest : public ViewRequestDelegate { | 164 class ContentExtractionRequest : public ViewRequestDelegate { |
154 public: | 165 public: |
155 void Start(DomDistillerService* service, const gfx::Size& render_view_size, | 166 void Start(DomDistillerService* service, const gfx::Size& render_view_size, |
156 base::Closure finished_callback) { | 167 base::Closure finished_callback) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 std::string output_data_; | 342 std::string output_data_; |
332 scoped_ptr<google::protobuf::io::StringOutputStream> protobuf_output_stream_; | 343 scoped_ptr<google::protobuf::io::StringOutputStream> protobuf_output_stream_; |
333 }; | 344 }; |
334 | 345 |
335 IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) { | 346 IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) { |
336 Start(); | 347 Start(); |
337 base::RunLoop().Run(); | 348 base::RunLoop().Run(); |
338 } | 349 } |
339 | 350 |
340 } // namespace dom_distiller | 351 } // namespace dom_distiller |
OLD | NEW |