| 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/content/web_contents_main_frame_observer.h" | 10 #include "components/dom_distiller/content/web_contents_main_frame_observer.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 scoped_ptr<proto::DomDistillerResult> distiller_result, | 97 scoped_ptr<proto::DomDistillerResult> distiller_result, |
| 98 bool distillation_successful) { | 98 bool distillation_successful) { |
| 99 distiller_result_ = distiller_result.Pass(); | 99 distiller_result_ = distiller_result.Pass(); |
| 100 quit_closure_.Run(); | 100 quit_closure_.Run(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 void AddComponentsResources() { | 104 void AddComponentsResources() { |
| 105 base::FilePath pak_file; | 105 base::FilePath pak_file; |
| 106 base::FilePath pak_dir; | 106 base::FilePath pak_dir; |
| 107 #if defined(OS_ANDROID) |
| 108 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir)); |
| 109 pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks")); |
| 110 #else |
| 107 PathService::Get(base::DIR_MODULE, &pak_dir); | 111 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 112 #endif // OS_ANDROID |
| 108 pak_file = | 113 pak_file = |
| 109 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); | 114 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); |
| 110 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 115 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 111 pak_file, ui::SCALE_FACTOR_NONE); | 116 pak_file, ui::SCALE_FACTOR_NONE); |
| 112 } | 117 } |
| 113 | 118 |
| 114 void SetUpTestServer() { | 119 void SetUpTestServer() { |
| 115 base::FilePath path; | 120 base::FilePath path; |
| 116 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 121 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 117 path = path.AppendASCII("components/test/data/dom_distiller"); | 122 path = path.AppendASCII("components/test/data/dom_distiller"); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 { // Test missing title for page. | 452 { // Test missing title for page. |
| 448 scoped_ptr<DistilledPageProto> page_proto(new DistilledPageProto()); | 453 scoped_ptr<DistilledPageProto> page_proto(new DistilledPageProto()); |
| 449 std::string html = viewer::GetUnsafeArticleTemplateHtml( | 454 std::string html = viewer::GetUnsafeArticleTemplateHtml( |
| 450 page_proto.get(), DistilledPagePrefs::LIGHT, DistilledPagePrefs::SERIF); | 455 page_proto.get(), DistilledPagePrefs::LIGHT, DistilledPagePrefs::SERIF); |
| 451 EXPECT_THAT(html, HasSubstr(no_title)); | 456 EXPECT_THAT(html, HasSubstr(no_title)); |
| 452 EXPECT_THAT(html, Not(HasSubstr(some_title))); | 457 EXPECT_THAT(html, Not(HasSubstr(some_title))); |
| 453 } | 458 } |
| 454 } | 459 } |
| 455 | 460 |
| 456 } // namespace dom_distiller | 461 } // namespace dom_distiller |
| OLD | NEW |