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

Side by Side Diff: headless/test/headless_browser_test.cc

Issue 2778983002: Fix browser tests on Mac (Closed)
Patch Set: nit change on #if defined on DefaultSizes test Created 3 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
« no previous file with comments | « headless/public/headless_browser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "headless/test/headless_browser_test.h" 5 #include "headless/test/headless_browser_test.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/path_service.h"
10 #include "base/run_loop.h" 12 #include "base/run_loop.h"
11 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
13 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
14 #include "content/public/test/test_navigation_observer.h" 16 #include "content/public/test/test_navigation_observer.h"
15 #include "headless/lib/browser/headless_browser_impl.h" 17 #include "headless/lib/browser/headless_browser_impl.h"
16 #include "headless/lib/browser/headless_web_contents_impl.h" 18 #include "headless/lib/browser/headless_web_contents_impl.h"
17 #include "headless/lib/headless_content_main_delegate.h" 19 #include "headless/lib/headless_content_main_delegate.h"
18 #include "headless/public/devtools/domains/runtime.h" 20 #include "headless/public/devtools/domains/runtime.h"
19 #include "headless/public/headless_devtools_client.h" 21 #include "headless/public/headless_devtools_client.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 116
115 void LoadObserver::OnResponseReceived( 117 void LoadObserver::OnResponseReceived(
116 const network::ResponseReceivedParams& params) { 118 const network::ResponseReceivedParams& params) {
117 if (params.GetResponse()->GetStatus() != 200 || 119 if (params.GetResponse()->GetStatus() != 200 ||
118 params.GetResponse()->GetUrl() == content::kUnreachableWebDataURL) { 120 params.GetResponse()->GetUrl() == content::kUnreachableWebDataURL) {
119 navigation_succeeded_ = false; 121 navigation_succeeded_ = false;
120 } 122 }
121 } 123 }
122 124
123 HeadlessBrowserTest::HeadlessBrowserTest() { 125 HeadlessBrowserTest::HeadlessBrowserTest() {
126 #if defined(OS_MACOSX)
127 // On Mac the source root is not set properly. We override it by assuming
128 // that is two directories up from the execution test file.
129 base::FilePath dir_exe_path;
130 CHECK(PathService::Get(base::DIR_EXE, &dir_exe_path));
131 dir_exe_path = dir_exe_path.Append("../../");
132 CHECK(PathService::Override(base::DIR_SOURCE_ROOT, dir_exe_path));
133 #endif // defined(OS_MACOSX)
124 base::FilePath headless_test_data(FILE_PATH_LITERAL("headless/test/data")); 134 base::FilePath headless_test_data(FILE_PATH_LITERAL("headless/test/data"));
125 CreateTestServer(headless_test_data); 135 CreateTestServer(headless_test_data);
126 } 136 }
127 137
128 HeadlessBrowserTest::~HeadlessBrowserTest() {} 138 HeadlessBrowserTest::~HeadlessBrowserTest() {}
129 139
130 void HeadlessBrowserTest::SetUpOnMainThread() {} 140 void HeadlessBrowserTest::SetUpOnMainThread() {}
131 141
132 void HeadlessBrowserTest::TearDownOnMainThread() { 142 void HeadlessBrowserTest::TearDownOnMainThread() {
133 browser()->Shutdown(); 143 browser()->Shutdown();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 web_contents_ = nullptr; 242 web_contents_ = nullptr;
233 browser_context_->Close(); 243 browser_context_->Close();
234 browser_context_ = nullptr; 244 browser_context_ = nullptr;
235 } 245 }
236 246
237 ProtocolHandlerMap HeadlessAsyncDevTooledBrowserTest::GetProtocolHandlers() { 247 ProtocolHandlerMap HeadlessAsyncDevTooledBrowserTest::GetProtocolHandlers() {
238 return ProtocolHandlerMap(); 248 return ProtocolHandlerMap();
239 } 249 }
240 250
241 } // namespace headless 251 } // namespace headless
OLDNEW
« no previous file with comments | « headless/public/headless_browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698