OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.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 "components/dom_distiller/content/browser/distillable_page_utils.h" | 8 #include "components/dom_distiller/content/browser/distillable_page_utils.h" |
9 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" | 9 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" |
10 #include "components/dom_distiller/core/distillable_page_detector.h" | 10 #include "components/dom_distiller/core/distillable_page_detector.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); | 65 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); |
66 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 66 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
67 pak_file, ui::SCALE_FACTOR_NONE); | 67 pak_file, ui::SCALE_FACTOR_NONE); |
68 } | 68 } |
69 | 69 |
70 void SetUpTestServer() { | 70 void SetUpTestServer() { |
71 base::FilePath path; | 71 base::FilePath path; |
72 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 72 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
73 path = path.AppendASCII("components/test/data/dom_distiller"); | 73 path = path.AppendASCII("components/test/data/dom_distiller"); |
74 embedded_test_server()->ServeFilesFromDirectory(path); | 74 embedded_test_server()->ServeFilesFromDirectory(path); |
75 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 75 ASSERT_TRUE(embedded_test_server()->Start()); |
76 } | 76 } |
77 | 77 |
78 void DocumentLoadedInFrame( | 78 void DocumentLoadedInFrame( |
79 content::RenderFrameHost* render_frame_host) override { | 79 content::RenderFrameHost* render_frame_host) override { |
80 if (!render_frame_host->GetParent()) | 80 if (!render_frame_host->GetParent()) |
81 main_frame_loaded_callback_.Run(); | 81 main_frame_loaded_callback_.Run(); |
82 } | 82 } |
83 | 83 |
84 base::Closure main_frame_loaded_callback_; | 84 base::Closure main_frame_loaded_callback_; |
85 }; | 85 }; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 LoadURL(kArticlePath); | 170 LoadURL(kArticlePath); |
171 base::RunLoop run_loop_; | 171 base::RunLoop run_loop_; |
172 ResultHolder holder(run_loop_.QuitClosure()); | 172 ResultHolder holder(run_loop_.QuitClosure()); |
173 IsDistillablePageForDetector(shell()->web_contents(), detector.get(), | 173 IsDistillablePageForDetector(shell()->web_contents(), detector.get(), |
174 holder.GetCallback()); | 174 holder.GetCallback()); |
175 run_loop_.Run(); | 175 run_loop_.Run(); |
176 ASSERT_FALSE(holder.GetResult()); | 176 ASSERT_FALSE(holder.GetResult()); |
177 } | 177 } |
178 | 178 |
179 } // namespace dom_distiller | 179 } // namespace dom_distiller |
OLD | NEW |