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

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

Issue 1075783002: Enable components_browsertests on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix DistillerPageWebContentsTest and DomDistillerDistillablePageUtilsTest Created 5 years, 8 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 void OnPageDistillationFinished( 56 void OnPageDistillationFinished(
57 scoped_ptr<proto::DomDistillerResult> distiller_result, 57 scoped_ptr<proto::DomDistillerResult> distiller_result,
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 #if defined(OS_ANDROID)
jbudorick 2015/04/10 13:34:32 ditto
Jaekyun Seok (inactive) 2015/04/13 01:36:02 Done.
66 base::FilePath pak_file;
67 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file);
68 CHECK(r);
69 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks"));
70 pak_file =
71 pak_file.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
72 #else
65 base::FilePath pak_file; 73 base::FilePath pak_file;
66 base::FilePath pak_dir; 74 base::FilePath pak_dir;
67 PathService::Get(base::DIR_MODULE, &pak_dir); 75 PathService::Get(base::DIR_MODULE, &pak_dir);
68 pak_file = 76 pak_file =
69 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); 77 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
78 #endif // OS_ANDROID
70 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( 79 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
71 pak_file, ui::SCALE_FACTOR_NONE); 80 pak_file, ui::SCALE_FACTOR_NONE);
72 } 81 }
73 82
74 void SetUpTestServer() { 83 void SetUpTestServer() {
75 base::FilePath path; 84 base::FilePath path;
76 PathService::Get(base::DIR_SOURCE_ROOT, &path); 85 PathService::Get(base::DIR_SOURCE_ROOT, &path);
77 path = path.AppendASCII("components/test/data/dom_distiller"); 86 path = path.AppendASCII("components/test/data/dom_distiller");
78 embedded_test_server()->ServeFilesFromDirectory(path); 87 embedded_test_server()->ServeFilesFromDirectory(path);
79 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 88 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 { // Test missing title for page. 452 { // Test missing title for page.
444 scoped_ptr<DistilledPageProto> page_proto(new DistilledPageProto()); 453 scoped_ptr<DistilledPageProto> page_proto(new DistilledPageProto());
445 std::string html = viewer::GetUnsafeArticleTemplateHtml( 454 std::string html = viewer::GetUnsafeArticleTemplateHtml(
446 page_proto.get(), DistilledPagePrefs::LIGHT, DistilledPagePrefs::SERIF); 455 page_proto.get(), DistilledPagePrefs::LIGHT, DistilledPagePrefs::SERIF);
447 EXPECT_THAT(html, HasSubstr(no_title)); 456 EXPECT_THAT(html, HasSubstr(no_title));
448 EXPECT_THAT(html, Not(HasSubstr(some_title))); 457 EXPECT_THAT(html, Not(HasSubstr(some_title)));
449 } 458 }
450 } 459 }
451 460
452 } // namespace dom_distiller 461 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698