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

Side by Side Diff: components/dom_distiller/content/browser/test/dom_distiller_js_browsertest.cc

Issue 1431653003: Migrating tests to use EmbeddedTestServer (misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing tests. Created 5 years, 1 month 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 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/callback.h" 5 #include "base/callback.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); 88 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
89 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( 89 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
90 pak_file, ui::SCALE_FACTOR_NONE); 90 pak_file, ui::SCALE_FACTOR_NONE);
91 } 91 }
92 92
93 void SetUpTestServer() { 93 void SetUpTestServer() {
94 base::FilePath path; 94 base::FilePath path;
95 PathService::Get(base::DIR_SOURCE_ROOT, &path); 95 PathService::Get(base::DIR_SOURCE_ROOT, &path);
96 path = path.AppendASCII(kExternalTestResourcesPath); 96 path = path.AppendASCII(kExternalTestResourcesPath);
97 embedded_test_server()->ServeFilesFromDirectory(path); 97 embedded_test_server()->ServeFilesFromDirectory(path);
98 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 98 ASSERT_TRUE(embedded_test_server()->Start());
99 } 99 }
100 }; 100 };
101 101
102 IN_PROC_BROWSER_TEST_F(DomDistillerJsTest, RunJsTests) { 102 IN_PROC_BROWSER_TEST_F(DomDistillerJsTest, RunJsTests) {
103 // Load the test file in content shell and wait until it has fully loaded. 103 // Load the test file in content shell and wait until it has fully loaded.
104 content::WebContents* web_contents = shell()->web_contents(); 104 content::WebContents* web_contents = shell()->web_contents();
105 dom_distiller::WebContentsMainFrameObserver::CreateForWebContents( 105 dom_distiller::WebContentsMainFrameObserver::CreateForWebContents(
106 web_contents); 106 web_contents);
107 base::RunLoop url_loaded_runner; 107 base::RunLoop url_loaded_runner;
108 WebContentsMainFrameHelper main_frame_loaded(web_contents, 108 WebContentsMainFrameHelper main_frame_loaded(web_contents,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // Only print the log if there was an error. 159 // Only print the log if there was an error.
160 if (!success) { 160 if (!success) {
161 ASSERT_TRUE(dict->HasKey("log")); 161 ASSERT_TRUE(dict->HasKey("log"));
162 std::string console_log; 162 std::string console_log;
163 ASSERT_TRUE(dict->GetString("log", &console_log)); 163 ASSERT_TRUE(dict->GetString("log", &console_log));
164 VLOG(0) << "Console log:\n" << console_log; 164 VLOG(0) << "Console log:\n" << console_log;
165 } 165 }
166 } 166 }
167 167
168 } // namespace dom_distiller 168 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc ('k') | components/html_viewer/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698