| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 bool distillation_successful) { | 58 bool distillation_successful) { |
| 59 distiller_result_ = distiller_result.Pass(); | 59 distiller_result_ = distiller_result.Pass(); |
| 60 quit_closure_.Run(); | 60 quit_closure_.Run(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 void AddComponentsResources() { | 64 void AddComponentsResources() { |
| 65 base::FilePath pak_file; | 65 base::FilePath pak_file; |
| 66 base::FilePath pak_dir; | 66 base::FilePath pak_dir; |
| 67 PathService::Get(base::DIR_MODULE, &pak_dir); | 67 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 68 pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_resources.pak")); | 68 pak_file = |
| 69 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); |
| 69 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 70 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 70 pak_file, ui::SCALE_FACTOR_NONE); | 71 pak_file, ui::SCALE_FACTOR_NONE); |
| 71 } | 72 } |
| 72 | 73 |
| 73 void SetUpTestServer() { | 74 void SetUpTestServer() { |
| 74 base::FilePath path; | 75 base::FilePath path; |
| 75 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 76 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 76 path = path.AppendASCII("components/test/data/dom_distiller"); | 77 path = path.AppendASCII("components/test/data/dom_distiller"); |
| 77 embedded_test_server()->ServeFilesFromDirectory(path); | 78 embedded_test_server()->ServeFilesFromDirectory(path); |
| 78 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 79 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 std::string html = viewer::GetUnsafePartialArticleHtml(page_proto.get(), | 513 std::string html = viewer::GetUnsafePartialArticleHtml(page_proto.get(), |
| 513 DistilledPagePrefs::LIGHT, DistilledPagePrefs::SERIF); | 514 DistilledPagePrefs::LIGHT, DistilledPagePrefs::SERIF); |
| 514 EXPECT_THAT(html, HasSubstr(some_title)); | 515 EXPECT_THAT(html, HasSubstr(some_title)); |
| 515 EXPECT_THAT(html, HasSubstr(no_content)); | 516 EXPECT_THAT(html, HasSubstr(no_content)); |
| 516 EXPECT_THAT(html, Not(HasSubstr(no_title))); | 517 EXPECT_THAT(html, Not(HasSubstr(no_title))); |
| 517 EXPECT_THAT(html, Not(HasSubstr(some_content))); | 518 EXPECT_THAT(html, Not(HasSubstr(some_content))); |
| 518 } | 519 } |
| 519 } | 520 } |
| 520 | 521 |
| 521 } // namespace dom_distiller | 522 } // namespace dom_distiller |
| OLD | NEW |