Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 content::Referrer(), | 41 content::Referrer(), |
| 42 ui::PAGE_TRANSITION_TYPED, | 42 ui::PAGE_TRANSITION_TYPED, |
| 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 #if defined(OS_ANDROID) | |
| 52 base::FilePath pak_file; | |
|
jbudorick
2015/04/10 13:34:31
Would it be better to just have the Android-specif
Jaekyun Seok (inactive)
2015/04/13 01:36:02
Done.
| |
| 53 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file); | |
| 54 CHECK(r); | |
| 55 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks")); | |
| 56 pak_file = | |
| 57 pak_file.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); | |
| 58 #else | |
| 51 base::FilePath pak_file; | 59 base::FilePath pak_file; |
| 52 base::FilePath pak_dir; | 60 base::FilePath pak_dir; |
| 53 PathService::Get(base::DIR_MODULE, &pak_dir); | 61 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 54 pak_file = | 62 pak_file = |
| 55 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); | 63 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); |
| 64 #endif // OS_ANDROID | |
| 56 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 65 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 57 pak_file, ui::SCALE_FACTOR_NONE); | 66 pak_file, ui::SCALE_FACTOR_NONE); |
| 58 } | 67 } |
| 59 | 68 |
| 60 void SetUpTestServer() { | 69 void SetUpTestServer() { |
| 61 base::FilePath path; | 70 base::FilePath path; |
| 62 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 71 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 63 path = path.AppendASCII("components/test/data/dom_distiller"); | 72 path = path.AppendASCII("components/test/data/dom_distiller"); |
| 64 embedded_test_server()->ServeFilesFromDirectory(path); | 73 embedded_test_server()->ServeFilesFromDirectory(path); |
| 65 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 74 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 LoadURL(kArticlePath); | 169 LoadURL(kArticlePath); |
| 161 base::RunLoop run_loop_; | 170 base::RunLoop run_loop_; |
| 162 ResultHolder holder(run_loop_.QuitClosure()); | 171 ResultHolder holder(run_loop_.QuitClosure()); |
| 163 IsDistillablePageForDetector(shell()->web_contents(), detector.get(), | 172 IsDistillablePageForDetector(shell()->web_contents(), detector.get(), |
| 164 holder.GetCallback()); | 173 holder.GetCallback()); |
| 165 run_loop_.Run(); | 174 run_loop_.Run(); |
| 166 ASSERT_FALSE(holder.GetResult()); | 175 ASSERT_FALSE(holder.GetResult()); |
| 167 } | 176 } |
| 168 | 177 |
| 169 } // namespace dom_distiller | 178 } // namespace dom_distiller |
| OLD | NEW |