Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: components/dom_distiller/content/distiller_page_web_contents_browsertest.cc

Issue 900223003: components: Provide an unified target to generate components_tests_resources.pak. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698