| 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/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "components/dom_distiller/content/distiller_page_web_contents.h" | 7 #include "components/dom_distiller/content/distiller_page_web_contents.h" |
| 8 #include "components/dom_distiller/core/distiller_page.h" | 8 #include "components/dom_distiller/core/distiller_page.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/shell/browser/shell.h" | 10 #include "content/shell/browser/shell.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 void DistillPage(const base::Closure& quit_closure, const std::string& url) { | 41 void DistillPage(const base::Closure& quit_closure, const std::string& url) { |
| 42 quit_closure_ = quit_closure; | 42 quit_closure_ = quit_closure; |
| 43 distiller_page_->LoadURL( | 43 distiller_page_->LoadURL( |
| 44 embedded_test_server()->GetURL(url)); | 44 embedded_test_server()->GetURL(url)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 virtual void OnLoadURLDone() OVERRIDE { | 47 virtual void OnLoadURLDone() OVERRIDE { |
| 48 distiller_page_->ExecuteJavaScript(kScript); | 48 distiller_page_->ExecuteJavaScript(kScript); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void OnExecuteJavaScriptDone(const base::Value* value) OVERRIDE { | 51 virtual void OnExecuteJavaScriptDone(const GURL& page_url, |
| 52 const base::Value* value) OVERRIDE { |
| 52 value_ = value->DeepCopy(); | 53 value_ = value->DeepCopy(); |
| 53 quit_closure_.Run(); | 54 quit_closure_.Run(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 protected: | 57 protected: |
| 57 DistillerPageWebContents* distiller_page_; | 58 DistillerPageWebContents* distiller_page_; |
| 58 base::Closure quit_closure_; | 59 base::Closure quit_closure_; |
| 59 const base::Value* value_; | 60 const base::Value* value_; |
| 60 }; | 61 }; |
| 61 | 62 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 77 ASSERT_EQ(kTitle, title); | 78 ASSERT_EQ(kTitle, title); |
| 78 std::string html; | 79 std::string html; |
| 79 result_list->GetString(1, &html); | 80 result_list->GetString(1, &html); |
| 80 ASSERT_EQ(kHtml, html); | 81 ASSERT_EQ(kHtml, html); |
| 81 std::string image_url; | 82 std::string image_url; |
| 82 result_list->GetString(2, &image_url); | 83 result_list->GetString(2, &image_url); |
| 83 ASSERT_EQ(kImageUrl, image_url); | 84 ASSERT_EQ(kImageUrl, image_url); |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace dom_distiller | 87 } // namespace dom_distiller |
| OLD | NEW |