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/core/distiller_page.h" | 10 #include "components/dom_distiller/core/distiller_page.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 DistillPage(run_loop.QuitClosure(), "/simple_article.html"); | 111 DistillPage(run_loop.QuitClosure(), "/simple_article.html"); |
112 run_loop.Run(); | 112 run_loop.Run(); |
113 | 113 |
114 // A relative link should've been updated. | 114 // A relative link should've been updated. |
115 EXPECT_THAT(page_info_.get()->html, | 115 EXPECT_THAT(page_info_.get()->html, |
116 ContainsRegex("src=\"http://127.0.0.1:.*/relativeimage.png\"")); | 116 ContainsRegex("src=\"http://127.0.0.1:.*/relativeimage.png\"")); |
117 EXPECT_THAT(page_info_.get()->html, | 117 EXPECT_THAT(page_info_.get()->html, |
118 HasSubstr("src=\"http://www.google.com/absoluteimage.png\"")); | 118 HasSubstr("src=\"http://www.google.com/absoluteimage.png\"")); |
119 } | 119 } |
120 | 120 |
| 121 IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, VisibilityDetection) { |
| 122 DistillerPageWebContents distiller_page( |
| 123 shell()->web_contents()->GetBrowserContext()); |
| 124 distiller_page_ = &distiller_page; |
| 125 |
| 126 // visble_style.html and invisible_style.html only differ by the visibility |
| 127 // internal stylesheet. |
| 128 |
| 129 { |
| 130 base::RunLoop run_loop; |
| 131 DistillPage(run_loop.QuitClosure(), "/visible_style.html"); |
| 132 run_loop.Run(); |
| 133 EXPECT_THAT(page_info_.get()->html, HasSubstr("Lorem ipsum")); |
| 134 } |
| 135 |
| 136 { |
| 137 base::RunLoop run_loop; |
| 138 DistillPage(run_loop.QuitClosure(), "/invisible_style.html"); |
| 139 run_loop.Run(); |
| 140 EXPECT_THAT(page_info_.get()->html, Not(HasSubstr("Lorem ipsum"))); |
| 141 } |
| 142 } |
| 143 |
121 } // namespace dom_distiller | 144 } // namespace dom_distiller |
OLD | NEW |