| 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 18 matching lines...) Expand all Loading... |
| 29 virtual void SetUpOnMainThread() OVERRIDE { | 29 virtual void SetUpOnMainThread() OVERRIDE { |
| 30 AddComponentsResources(); | 30 AddComponentsResources(); |
| 31 SetUpTestServer(); | 31 SetUpTestServer(); |
| 32 ContentBrowserTest::SetUpOnMainThread(); | 32 ContentBrowserTest::SetUpOnMainThread(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void DistillPage(const base::Closure& quit_closure, const std::string& url) { | 35 void DistillPage(const base::Closure& quit_closure, const std::string& url) { |
| 36 quit_closure_ = quit_closure; | 36 quit_closure_ = quit_closure; |
| 37 distiller_page_->DistillPage( | 37 distiller_page_->DistillPage( |
| 38 embedded_test_server()->GetURL(url), | 38 embedded_test_server()->GetURL(url), |
| 39 dom_distiller::proto::DomDistillerOptions(), |
| 39 base::Bind(&DistillerPageWebContentsTest::OnPageDistillationFinished, | 40 base::Bind(&DistillerPageWebContentsTest::OnPageDistillationFinished, |
| 40 this)); | 41 this)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void OnPageDistillationFinished(scoped_ptr<DistilledPageInfo> distilled_page, | 44 void OnPageDistillationFinished(scoped_ptr<DistilledPageInfo> distilled_page, |
| 44 bool distillation_successful) { | 45 bool distillation_successful) { |
| 45 page_info_ = distilled_page.Pass(); | 46 page_info_ = distilled_page.Pass(); |
| 46 quit_closure_.Run(); | 47 quit_closure_.Run(); |
| 47 } | 48 } |
| 48 | 49 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 136 |
| 136 { | 137 { |
| 137 base::RunLoop run_loop; | 138 base::RunLoop run_loop; |
| 138 DistillPage(run_loop.QuitClosure(), "/invisible_style.html"); | 139 DistillPage(run_loop.QuitClosure(), "/invisible_style.html"); |
| 139 run_loop.Run(); | 140 run_loop.Run(); |
| 140 EXPECT_THAT(page_info_.get()->html, Not(HasSubstr("Lorem ipsum"))); | 141 EXPECT_THAT(page_info_.get()->html, Not(HasSubstr("Lorem ipsum"))); |
| 141 } | 142 } |
| 142 } | 143 } |
| 143 | 144 |
| 144 } // namespace dom_distiller | 145 } // namespace dom_distiller |
| OLD | NEW |