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 "base/memory/weak_ptr.h" | 5 #include "base/memory/weak_ptr.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "components/dom_distiller/content/distiller_page_web_contents.h" | 9 #include "components/dom_distiller/content/distiller_page_web_contents.h" |
10 #include "components/dom_distiller/content/web_contents_main_frame_observer.h" | 10 #include "components/dom_distiller/content/web_contents_main_frame_observer.h" |
11 #include "components/dom_distiller/core/distiller_page.h" | 11 #include "components/dom_distiller/core/distiller_page.h" |
12 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 #include "content/public/test/content_browser_test.h" | 16 #include "content/public/test/content_browser_test.h" |
17 #include "content/shell/browser/shell.h" | 17 #include "content/shell/browser/shell.h" |
18 #include "net/test/embedded_test_server/embedded_test_server.h" | 18 #include "net/test/embedded_test_server/embedded_test_server.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "third_party/dom_distiller_js/dom_distiller.pb.h" |
20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
21 | 22 |
22 using content::ContentBrowserTest; | 23 using content::ContentBrowserTest; |
23 using testing::ContainsRegex; | 24 using testing::ContainsRegex; |
24 using testing::HasSubstr; | 25 using testing::HasSubstr; |
25 using testing::Not; | 26 using testing::Not; |
26 | 27 |
27 namespace dom_distiller { | 28 namespace dom_distiller { |
28 | 29 |
29 const char* kSimpleArticlePath = "/simple_article.html"; | 30 const char* kSimpleArticlePath = "/simple_article.html"; |
(...skipping 10 matching lines...) Expand all Loading... |
40 | 41 |
41 void DistillPage(const base::Closure& quit_closure, const std::string& url) { | 42 void DistillPage(const base::Closure& quit_closure, const std::string& url) { |
42 quit_closure_ = quit_closure; | 43 quit_closure_ = quit_closure; |
43 distiller_page_->DistillPage( | 44 distiller_page_->DistillPage( |
44 embedded_test_server()->GetURL(url), | 45 embedded_test_server()->GetURL(url), |
45 dom_distiller::proto::DomDistillerOptions(), | 46 dom_distiller::proto::DomDistillerOptions(), |
46 base::Bind(&DistillerPageWebContentsTest::OnPageDistillationFinished, | 47 base::Bind(&DistillerPageWebContentsTest::OnPageDistillationFinished, |
47 this)); | 48 this)); |
48 } | 49 } |
49 | 50 |
50 void OnPageDistillationFinished(scoped_ptr<DistilledPageInfo> distilled_page, | 51 void OnPageDistillationFinished( |
51 bool distillation_successful) { | 52 scoped_ptr<proto::DomDistillerResult> distiller_result, |
52 page_info_ = distilled_page.Pass(); | 53 bool distillation_successful) { |
| 54 distiller_result_ = distiller_result.Pass(); |
53 quit_closure_.Run(); | 55 quit_closure_.Run(); |
54 } | 56 } |
55 | 57 |
56 private: | 58 private: |
57 void AddComponentsResources() { | 59 void AddComponentsResources() { |
58 base::FilePath pak_file; | 60 base::FilePath pak_file; |
59 base::FilePath pak_dir; | 61 base::FilePath pak_dir; |
60 PathService::Get(base::DIR_MODULE, &pak_dir); | 62 PathService::Get(base::DIR_MODULE, &pak_dir); |
61 pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_resources.pak")); | 63 pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_resources.pak")); |
62 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 64 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
63 pak_file, ui::SCALE_FACTOR_NONE); | 65 pak_file, ui::SCALE_FACTOR_NONE); |
64 } | 66 } |
65 | 67 |
66 void SetUpTestServer() { | 68 void SetUpTestServer() { |
67 base::FilePath path; | 69 base::FilePath path; |
68 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 70 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
69 path = path.AppendASCII("components/test/data/dom_distiller"); | 71 path = path.AppendASCII("components/test/data/dom_distiller"); |
70 embedded_test_server()->ServeFilesFromDirectory(path); | 72 embedded_test_server()->ServeFilesFromDirectory(path); |
71 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 73 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
72 } | 74 } |
73 | 75 |
74 protected: | 76 protected: |
75 void RunUseCurrentWebContentsTest(const std::string& url, | 77 void RunUseCurrentWebContentsTest(const std::string& url, |
76 bool expect_new_web_contents, | 78 bool expect_new_web_contents, |
77 bool setup_main_frame_observer, | 79 bool setup_main_frame_observer, |
78 bool wait_for_document_loaded); | 80 bool wait_for_document_loaded); |
79 | 81 |
80 DistillerPageWebContents* distiller_page_; | 82 DistillerPageWebContents* distiller_page_; |
81 base::Closure quit_closure_; | 83 base::Closure quit_closure_; |
82 scoped_ptr<DistilledPageInfo> page_info_; | 84 scoped_ptr<proto::DomDistillerResult> distiller_result_; |
83 }; | 85 }; |
84 | 86 |
85 // Use this class to be able to leak the WebContents, which is needed for when | 87 // Use this class to be able to leak the WebContents, which is needed for when |
86 // the current WebContents is used for distillation. | 88 // the current WebContents is used for distillation. |
87 class TestDistillerPageWebContents : public DistillerPageWebContents { | 89 class TestDistillerPageWebContents : public DistillerPageWebContents { |
88 public: | 90 public: |
89 TestDistillerPageWebContents( | 91 TestDistillerPageWebContents( |
90 content::BrowserContext* browser_context, | 92 content::BrowserContext* browser_context, |
91 const gfx::Size& render_view_size, | 93 const gfx::Size& render_view_size, |
92 scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle, | 94 scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 DistillerPageWebContents distiller_page( | 164 DistillerPageWebContents distiller_page( |
163 shell()->web_contents()->GetBrowserContext(), | 165 shell()->web_contents()->GetBrowserContext(), |
164 shell()->web_contents()->GetContainerBounds().size(), | 166 shell()->web_contents()->GetContainerBounds().size(), |
165 scoped_ptr<SourcePageHandleWebContents>()); | 167 scoped_ptr<SourcePageHandleWebContents>()); |
166 distiller_page_ = &distiller_page; | 168 distiller_page_ = &distiller_page; |
167 | 169 |
168 base::RunLoop run_loop; | 170 base::RunLoop run_loop; |
169 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); | 171 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); |
170 run_loop.Run(); | 172 run_loop.Run(); |
171 | 173 |
172 EXPECT_EQ("Test Page Title", page_info_.get()->title); | 174 EXPECT_EQ("Test Page Title", distiller_result_->title()); |
173 EXPECT_THAT(page_info_.get()->html, HasSubstr("Lorem ipsum")); | 175 EXPECT_THAT(distiller_result_->distilled_content().html(), |
174 EXPECT_THAT(page_info_.get()->html, Not(HasSubstr("questionable content"))); | 176 HasSubstr("Lorem ipsum")); |
175 EXPECT_EQ("", page_info_.get()->next_page_url); | 177 EXPECT_THAT(distiller_result_->distilled_content().html(), |
176 EXPECT_EQ("", page_info_.get()->prev_page_url); | 178 Not(HasSubstr("questionable content"))); |
| 179 EXPECT_EQ("", distiller_result_->pagination_info().next_page()); |
| 180 EXPECT_EQ("", distiller_result_->pagination_info().prev_page()); |
177 } | 181 } |
178 | 182 |
179 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeLinks) { | 183 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeLinks) { |
180 DistillerPageWebContents distiller_page( | 184 DistillerPageWebContents distiller_page( |
181 shell()->web_contents()->GetBrowserContext(), | 185 shell()->web_contents()->GetBrowserContext(), |
182 shell()->web_contents()->GetContainerBounds().size(), | 186 shell()->web_contents()->GetContainerBounds().size(), |
183 scoped_ptr<SourcePageHandleWebContents>()); | 187 scoped_ptr<SourcePageHandleWebContents>()); |
184 distiller_page_ = &distiller_page; | 188 distiller_page_ = &distiller_page; |
185 | 189 |
186 base::RunLoop run_loop; | 190 base::RunLoop run_loop; |
187 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); | 191 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); |
188 run_loop.Run(); | 192 run_loop.Run(); |
189 | 193 |
190 // A relative link should've been updated. | 194 // A relative link should've been updated. |
191 EXPECT_THAT(page_info_.get()->html, | 195 EXPECT_THAT(distiller_result_->distilled_content().html(), |
192 ContainsRegex("href=\"http://127.0.0.1:.*/relativelink.html\"")); | 196 ContainsRegex("href=\"http://127.0.0.1:.*/relativelink.html\"")); |
193 EXPECT_THAT(page_info_.get()->html, | 197 EXPECT_THAT(distiller_result_->distilled_content().html(), |
194 HasSubstr("href=\"http://www.google.com/absolutelink.html\"")); | 198 HasSubstr("href=\"http://www.google.com/absolutelink.html\"")); |
195 } | 199 } |
196 | 200 |
197 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeImages) { | 201 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeImages) { |
198 DistillerPageWebContents distiller_page( | 202 DistillerPageWebContents distiller_page( |
199 shell()->web_contents()->GetBrowserContext(), | 203 shell()->web_contents()->GetBrowserContext(), |
200 shell()->web_contents()->GetContainerBounds().size(), | 204 shell()->web_contents()->GetContainerBounds().size(), |
201 scoped_ptr<SourcePageHandleWebContents>()); | 205 scoped_ptr<SourcePageHandleWebContents>()); |
202 distiller_page_ = &distiller_page; | 206 distiller_page_ = &distiller_page; |
203 | 207 |
204 base::RunLoop run_loop; | 208 base::RunLoop run_loop; |
205 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); | 209 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); |
206 run_loop.Run(); | 210 run_loop.Run(); |
207 | 211 |
208 // A relative link should've been updated. | 212 // A relative link should've been updated. |
209 EXPECT_THAT(page_info_.get()->html, | 213 EXPECT_THAT(distiller_result_->distilled_content().html(), |
210 ContainsRegex("src=\"http://127.0.0.1:.*/relativeimage.png\"")); | 214 ContainsRegex("src=\"http://127.0.0.1:.*/relativeimage.png\"")); |
211 EXPECT_THAT(page_info_.get()->html, | 215 EXPECT_THAT(distiller_result_->distilled_content().html(), |
212 HasSubstr("src=\"http://www.google.com/absoluteimage.png\"")); | 216 HasSubstr("src=\"http://www.google.com/absoluteimage.png\"")); |
213 } | 217 } |
214 | 218 |
215 | 219 |
216 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeVideos) { | 220 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeVideos) { |
217 DistillerPageWebContents distiller_page( | 221 DistillerPageWebContents distiller_page( |
218 shell()->web_contents()->GetBrowserContext(), | 222 shell()->web_contents()->GetBrowserContext(), |
219 shell()->web_contents()->GetContainerBounds().size(), | 223 shell()->web_contents()->GetContainerBounds().size(), |
220 scoped_ptr<SourcePageHandleWebContents>()); | 224 scoped_ptr<SourcePageHandleWebContents>()); |
221 distiller_page_ = &distiller_page; | 225 distiller_page_ = &distiller_page; |
222 | 226 |
223 base::RunLoop run_loop; | 227 base::RunLoop run_loop; |
224 DistillPage(run_loop.QuitClosure(), kVideoArticlePath); | 228 DistillPage(run_loop.QuitClosure(), kVideoArticlePath); |
225 run_loop.Run(); | 229 run_loop.Run(); |
226 | 230 |
227 // A relative source/track should've been updated. | 231 // A relative source/track should've been updated. |
| 232 EXPECT_THAT(distiller_result_->distilled_content().html(), |
| 233 ContainsRegex("src=\"http://127.0.0.1:.*/relative_video.mp4\"")); |
228 EXPECT_THAT( | 234 EXPECT_THAT( |
229 page_info_.get()->html, | 235 distiller_result_->distilled_content().html(), |
230 ContainsRegex("src=\"http://127.0.0.1:.*/relative_video.mp4\"")); | |
231 EXPECT_THAT( | |
232 page_info_.get()->html, | |
233 ContainsRegex("src=\"http://127.0.0.1:.*/relative_track_en.vtt\"")); | 236 ContainsRegex("src=\"http://127.0.0.1:.*/relative_track_en.vtt\"")); |
234 EXPECT_THAT( | 237 EXPECT_THAT(distiller_result_->distilled_content().html(), |
235 page_info_.get()->html, | 238 HasSubstr("src=\"http://www.google.com/absolute_video.ogg\"")); |
236 HasSubstr("src=\"http://www.google.com/absolute_video.ogg\"")); | 239 EXPECT_THAT(distiller_result_->distilled_content().html(), |
237 EXPECT_THAT( | 240 HasSubstr("src=\"http://www.google.com/absolute_track_fr.vtt\"")); |
238 page_info_.get()->html, | |
239 HasSubstr("src=\"http://www.google.com/absolute_track_fr.vtt\"")); | |
240 } | 241 } |
241 | 242 |
242 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, VisibilityDetection) { | 243 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, VisibilityDetection) { |
243 DistillerPageWebContents distiller_page( | 244 DistillerPageWebContents distiller_page( |
244 shell()->web_contents()->GetBrowserContext(), | 245 shell()->web_contents()->GetBrowserContext(), |
245 shell()->web_contents()->GetContainerBounds().size(), | 246 shell()->web_contents()->GetContainerBounds().size(), |
246 scoped_ptr<SourcePageHandleWebContents>()); | 247 scoped_ptr<SourcePageHandleWebContents>()); |
247 distiller_page_ = &distiller_page; | 248 distiller_page_ = &distiller_page; |
248 | 249 |
249 // visble_style.html and invisible_style.html only differ by the visibility | 250 // visble_style.html and invisible_style.html only differ by the visibility |
250 // internal stylesheet. | 251 // internal stylesheet. |
251 | 252 |
252 { | 253 { |
253 base::RunLoop run_loop; | 254 base::RunLoop run_loop; |
254 DistillPage(run_loop.QuitClosure(), "/visible_style.html"); | 255 DistillPage(run_loop.QuitClosure(), "/visible_style.html"); |
255 run_loop.Run(); | 256 run_loop.Run(); |
256 EXPECT_THAT(page_info_.get()->html, HasSubstr("Lorem ipsum")); | 257 EXPECT_THAT(distiller_result_->distilled_content().html(), |
| 258 HasSubstr("Lorem ipsum")); |
257 } | 259 } |
258 | 260 |
259 { | 261 { |
260 base::RunLoop run_loop; | 262 base::RunLoop run_loop; |
261 DistillPage(run_loop.QuitClosure(), "/invisible_style.html"); | 263 DistillPage(run_loop.QuitClosure(), "/invisible_style.html"); |
262 run_loop.Run(); | 264 run_loop.Run(); |
263 EXPECT_THAT(page_info_.get()->html, Not(HasSubstr("Lorem ipsum"))); | 265 EXPECT_THAT(distiller_result_->distilled_content().html(), |
| 266 Not(HasSubstr("Lorem ipsum"))); |
264 } | 267 } |
265 } | 268 } |
266 | 269 |
267 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, | 270 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, |
268 UsingCurrentWebContentsWrongUrl) { | 271 UsingCurrentWebContentsWrongUrl) { |
269 std::string url("/bogus"); | 272 std::string url("/bogus"); |
270 bool expect_new_web_contents = true; | 273 bool expect_new_web_contents = true; |
271 bool setup_main_frame_observer = true; | 274 bool setup_main_frame_observer = true; |
272 bool wait_for_document_loaded = true; | 275 bool wait_for_document_loaded = true; |
273 RunUseCurrentWebContentsTest(url, | 276 RunUseCurrentWebContentsTest(url, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 source_page_handle.Pass(), | 346 source_page_handle.Pass(), |
344 expect_new_web_contents); | 347 expect_new_web_contents); |
345 distiller_page_ = &distiller_page; | 348 distiller_page_ = &distiller_page; |
346 | 349 |
347 base::RunLoop run_loop; | 350 base::RunLoop run_loop; |
348 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); | 351 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); |
349 run_loop.Run(); | 352 run_loop.Run(); |
350 | 353 |
351 // Sanity check of distillation process. | 354 // Sanity check of distillation process. |
352 EXPECT_EQ(expect_new_web_contents, distiller_page.new_web_contents_created()); | 355 EXPECT_EQ(expect_new_web_contents, distiller_page.new_web_contents_created()); |
353 EXPECT_EQ("Test Page Title", page_info_.get()->title); | 356 EXPECT_EQ("Test Page Title", distiller_result_->title()); |
354 } | 357 } |
355 | 358 |
356 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, MarkupInfo) { | 359 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, MarkupInfo) { |
357 DistillerPageWebContents distiller_page( | 360 DistillerPageWebContents distiller_page( |
358 shell()->web_contents()->GetBrowserContext(), | 361 shell()->web_contents()->GetBrowserContext(), |
359 shell()->web_contents()->GetContainerBounds().size(), | 362 shell()->web_contents()->GetContainerBounds().size(), |
360 scoped_ptr<SourcePageHandleWebContents>()); | 363 scoped_ptr<SourcePageHandleWebContents>()); |
361 distiller_page_ = &distiller_page; | 364 distiller_page_ = &distiller_page; |
362 | 365 |
363 base::RunLoop run_loop; | 366 base::RunLoop run_loop; |
364 DistillPage(run_loop.QuitClosure(), "/markup_article.html"); | 367 DistillPage(run_loop.QuitClosure(), "/markup_article.html"); |
365 run_loop.Run(); | 368 run_loop.Run(); |
366 | 369 |
367 EXPECT_THAT(page_info_.get()->html, HasSubstr("Lorem ipsum")); | 370 EXPECT_THAT(distiller_result_->distilled_content().html(), |
368 EXPECT_EQ("Marked-up Markup Test Page Title", page_info_.get()->title); | 371 HasSubstr("Lorem ipsum")); |
| 372 EXPECT_EQ("Marked-up Markup Test Page Title", distiller_result_->title()); |
369 | 373 |
370 const DistilledPageInfo::MarkupInfo& markup_info = page_info_->markup_info; | 374 const proto::MarkupInfo markup_info = distiller_result_->markup_info(); |
371 EXPECT_EQ("Marked-up Markup Test Page Title", markup_info.title); | 375 EXPECT_EQ("Marked-up Markup Test Page Title", markup_info.title()); |
372 EXPECT_EQ("Article", markup_info.type); | 376 EXPECT_EQ("Article", markup_info.type()); |
373 EXPECT_EQ("http://test/markup.html", markup_info.url); | 377 EXPECT_EQ("http://test/markup.html", markup_info.url()); |
374 EXPECT_EQ("This page tests Markup Info.", markup_info.description); | 378 EXPECT_EQ("This page tests Markup Info.", markup_info.description()); |
375 EXPECT_EQ("Whoever Published", markup_info.publisher); | 379 EXPECT_EQ("Whoever Published", markup_info.publisher()); |
376 EXPECT_EQ("Copyright 2000-2014 Whoever Copyrighted", markup_info.copyright); | 380 EXPECT_EQ("Copyright 2000-2014 Whoever Copyrighted", markup_info.copyright()); |
377 EXPECT_EQ("Whoever Authored", markup_info.author); | 381 EXPECT_EQ("Whoever Authored", markup_info.author()); |
378 | 382 |
379 const DistilledPageInfo::MarkupArticle& markup_article = markup_info.article; | 383 const proto::MarkupArticle markup_article = markup_info.article(); |
380 EXPECT_EQ("Whatever Section", markup_article.section); | 384 EXPECT_EQ("Whatever Section", markup_article.section()); |
381 EXPECT_EQ("July 23, 2014", markup_article.published_time); | 385 EXPECT_EQ("July 23, 2014", markup_article.published_time()); |
382 EXPECT_EQ("2014-07-23T23:59", markup_article.modified_time); | 386 EXPECT_EQ("2014-07-23T23:59", markup_article.modified_time()); |
383 EXPECT_EQ("", markup_article.expiration_time); | 387 EXPECT_EQ("", markup_article.expiration_time()); |
384 ASSERT_EQ(1U, markup_article.authors.size()); | 388 ASSERT_EQ(1, markup_article.authors_size()); |
385 EXPECT_EQ("Whoever Authored", markup_article.authors[0]); | 389 EXPECT_EQ("Whoever Authored", markup_article.authors(0)); |
386 | 390 |
387 ASSERT_EQ(2U, markup_info.images.size()); | 391 ASSERT_EQ(2, markup_info.images_size()); |
388 | 392 |
389 const DistilledPageInfo::MarkupImage& markup_image1 = markup_info.images[0]; | 393 const proto::MarkupImage markup_image1 = markup_info.images(0); |
390 EXPECT_EQ("http://test/markup1.jpeg", markup_image1.url); | 394 EXPECT_EQ("http://test/markup1.jpeg", markup_image1.url()); |
391 EXPECT_EQ("https://test/markup1.jpeg", markup_image1.secure_url); | 395 EXPECT_EQ("https://test/markup1.jpeg", markup_image1.secure_url()); |
392 EXPECT_EQ("jpeg", markup_image1.type); | 396 EXPECT_EQ("jpeg", markup_image1.type()); |
393 EXPECT_EQ("", markup_image1.caption); | 397 EXPECT_EQ("", markup_image1.caption()); |
394 EXPECT_EQ(600, markup_image1.width); | 398 EXPECT_EQ(600, markup_image1.width()); |
395 EXPECT_EQ(400, markup_image1.height); | 399 EXPECT_EQ(400, markup_image1.height()); |
396 | 400 |
397 const DistilledPageInfo::MarkupImage& markup_image2 = markup_info.images[1]; | 401 const proto::MarkupImage markup_image2 = markup_info.images(1); |
398 EXPECT_EQ("http://test/markup2.gif", markup_image2.url); | 402 EXPECT_EQ("http://test/markup2.gif", markup_image2.url()); |
399 EXPECT_EQ("https://test/markup2.gif", markup_image2.secure_url); | 403 EXPECT_EQ("https://test/markup2.gif", markup_image2.secure_url()); |
400 EXPECT_EQ("gif", markup_image2.type); | 404 EXPECT_EQ("gif", markup_image2.type()); |
401 EXPECT_EQ("", markup_image2.caption); | 405 EXPECT_EQ("", markup_image2.caption()); |
402 EXPECT_EQ(1000, markup_image2.width); | 406 EXPECT_EQ(1000, markup_image2.width()); |
403 EXPECT_EQ(600, markup_image2.height); | 407 EXPECT_EQ(600, markup_image2.height()); |
404 } | 408 } |
405 | 409 |
406 } // namespace dom_distiller | 410 } // namespace dom_distiller |
OLD | NEW |