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/distillable_page_utils.h" | 8 #include "components/dom_distiller/content/distillable_page_utils.h" |
9 #include "components/dom_distiller/core/distillable_page_detector.h" | 9 #include "components/dom_distiller/core/distillable_page_detector.h" |
10 #include "components/dom_distiller/core/page_features.h" | 10 #include "components/dom_distiller/core/page_features.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 std::string()); | 43 std::string()); |
44 url_loaded_runner.Run(); | 44 url_loaded_runner.Run(); |
45 main_frame_loaded_callback_ = base::Closure(); | 45 main_frame_loaded_callback_ = base::Closure(); |
46 Observe(nullptr); | 46 Observe(nullptr); |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 void AddComponentsResources() { | 50 void AddComponentsResources() { |
51 base::FilePath pak_file; | 51 base::FilePath pak_file; |
52 base::FilePath pak_dir; | 52 base::FilePath pak_dir; |
| 53 #if defined(OS_ANDROID) |
| 54 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir)); |
| 55 pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks")); |
| 56 #else |
53 PathService::Get(base::DIR_MODULE, &pak_dir); | 57 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 58 #endif // OS_ANDROID |
54 pak_file = | 59 pak_file = |
55 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); | 60 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); |
56 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 61 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
57 pak_file, ui::SCALE_FACTOR_NONE); | 62 pak_file, ui::SCALE_FACTOR_NONE); |
58 } | 63 } |
59 | 64 |
60 void SetUpTestServer() { | 65 void SetUpTestServer() { |
61 base::FilePath path; | 66 base::FilePath path; |
62 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 67 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
63 path = path.AppendASCII("components/test/data/dom_distiller"); | 68 path = path.AppendASCII("components/test/data/dom_distiller"); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 LoadURL(kArticlePath); | 165 LoadURL(kArticlePath); |
161 base::RunLoop run_loop_; | 166 base::RunLoop run_loop_; |
162 ResultHolder holder(run_loop_.QuitClosure()); | 167 ResultHolder holder(run_loop_.QuitClosure()); |
163 IsDistillablePageForDetector(shell()->web_contents(), detector.get(), | 168 IsDistillablePageForDetector(shell()->web_contents(), detector.get(), |
164 holder.GetCallback()); | 169 holder.GetCallback()); |
165 run_loop_.Run(); | 170 run_loop_.Run(); |
166 ASSERT_FALSE(holder.GetResult()); | 171 ASSERT_FALSE(holder.GetResult()); |
167 } | 172 } |
168 | 173 |
169 } // namespace dom_distiller | 174 } // namespace dom_distiller |
OLD | NEW |