Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Side by Side Diff: components/dom_distiller/content/distiller_page_web_contents_browsertest.cc

Issue 411253008: dom distiller: extract markup properties from protobuf (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | components/dom_distiller/core/distiller_page.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 base::RunLoop run_loop; 348 base::RunLoop run_loop;
349 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath); 349 DistillPage(run_loop.QuitClosure(), kSimpleArticlePath);
350 run_loop.Run(); 350 run_loop.Run();
351 351
352 // Sanity check of distillation process. 352 // Sanity check of distillation process.
353 EXPECT_EQ(expect_new_web_contents, distiller_page.new_web_contents_created()); 353 EXPECT_EQ(expect_new_web_contents, distiller_page.new_web_contents_created());
354 EXPECT_EQ("Test Page Title", page_info_.get()->title); 354 EXPECT_EQ("Test Page Title", page_info_.get()->title);
355 } 355 }
356 356
357 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, MarkupInfo) {
358 DistillerPageWebContents distiller_page(
359 shell()->web_contents()->GetBrowserContext(),
360 shell()->web_contents()->GetContainerBounds().size(),
361 scoped_ptr<SourcePageHandleWebContents>());
362 distiller_page_ = &distiller_page;
363
364 base::RunLoop run_loop;
365 DistillPage(run_loop.QuitClosure(), "/markup_article.html");
366 run_loop.Run();
367
368 EXPECT_THAT(page_info_.get()->html, HasSubstr("Lorem ipsum"));
369 EXPECT_EQ("Marked-up Markup Test Page Title", page_info_.get()->title);
370
371 const DistilledPageInfo::MarkupInfo& markup_info = page_info_->markup_info;
372 EXPECT_EQ("Marked-up Markup Test Page Title", markup_info.title);
373 EXPECT_EQ("Article", markup_info.type);
374 EXPECT_EQ("http://test/markup.html", markup_info.url);
375 EXPECT_EQ("This page tests Markup Info.", markup_info.description);
376 EXPECT_EQ("Whoever Published", markup_info.publisher);
377 EXPECT_EQ("Copyright 2000-2014 Whoever Copyrighted", markup_info.copyright);
378 EXPECT_EQ("Whoever Authored", markup_info.author);
379
380 const DistilledPageInfo::MarkupArticle& markup_article = markup_info.article;
381 EXPECT_EQ("Whatever Section", markup_article.section);
382 EXPECT_EQ("July 23, 2014", markup_article.published_time);
383 EXPECT_EQ("2014-07-23T23:59", markup_article.modified_time);
384 EXPECT_EQ("", markup_article.expiration_time);
385 ASSERT_EQ(1U, markup_article.authors.size());
386 EXPECT_EQ("Whoever Authored", markup_article.authors[0]);
387
388 ASSERT_EQ(2U, markup_info.images.size());
389
390 const DistilledPageInfo::MarkupImage& markup_image1 = markup_info.images[0];
391 EXPECT_EQ("http://test/markup1.jpeg", markup_image1.url);
392 EXPECT_EQ("https://test/markup1.jpeg", markup_image1.secure_url);
393 EXPECT_EQ("jpeg", markup_image1.type);
394 EXPECT_EQ("", markup_image1.caption);
395 EXPECT_EQ(600, markup_image1.width);
396 EXPECT_EQ(400, markup_image1.height);
397
398 const DistilledPageInfo::MarkupImage& markup_image2 = markup_info.images[1];
399 EXPECT_EQ("http://test/markup2.gif", markup_image2.url);
400 EXPECT_EQ("https://test/markup2.gif", markup_image2.secure_url);
401 EXPECT_EQ("gif", markup_image2.type);
402 EXPECT_EQ("", markup_image2.caption);
403 EXPECT_EQ(1000, markup_image2.width);
404 EXPECT_EQ(600, markup_image2.height);
405 }
406
357 } // namespace dom_distiller 407 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « no previous file | components/dom_distiller/core/distiller_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698