Index: headless/test/headless_browser_test.cc |
diff --git a/headless/test/headless_browser_test.cc b/headless/test/headless_browser_test.cc |
index 44e3f9b5d7d9b482ece969d46a8d24fc09f38dcf..a5191a3ccae26e9834cff332d7c04ec4be4806a3 100644 |
--- a/headless/test/headless_browser_test.cc |
+++ b/headless/test/headless_browser_test.cc |
@@ -5,8 +5,10 @@ |
#include "headless/test/headless_browser_test.h" |
#include "base/files/file_path.h" |
+#include "base/macros.h" |
#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/path_service.h" |
#include "base/run_loop.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/render_process_host.h" |
@@ -121,6 +123,14 @@ void LoadObserver::OnResponseReceived( |
} |
HeadlessBrowserTest::HeadlessBrowserTest() { |
+#if defined(OS_MACOSX) |
+ // On Mac the source root is not set properly. We override it by assuming |
+ // that is two directories up from the execution test file. |
+ base::FilePath dir_exe_path; |
+ CHECK(PathService::Get(base::DIR_EXE, &dir_exe_path)); |
+ dir_exe_path = dir_exe_path.Append("../../"); |
+ CHECK(PathService::Override(base::DIR_SOURCE_ROOT, dir_exe_path)); |
+#endif // defined(OS_MACOSX) |
base::FilePath headless_test_data(FILE_PATH_LITERAL("headless/test/data")); |
CreateTestServer(headless_test_data); |
} |