| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/browser/layout_test/layout_test_devtools_frontend.h" | 5 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 if (!PathService::Get(base::DIR_EXE, &dir_exe)) { | 45 if (!PathService::Get(base::DIR_EXE, &dir_exe)) { |
| 46 NOTREACHED(); | 46 NOTREACHED(); |
| 47 return GURL(); | 47 return GURL(); |
| 48 } | 48 } |
| 49 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
| 50 // On Mac, the executable is in | 50 // On Mac, the executable is in |
| 51 // out/Release/Content Shell.app/Contents/MacOS/Content Shell. | 51 // out/Release/Content Shell.app/Contents/MacOS/Content Shell. |
| 52 // We need to go up 3 directories to get to out/Release. | 52 // We need to go up 3 directories to get to out/Release. |
| 53 dir_exe = dir_exe.AppendASCII("../../.."); | 53 dir_exe = dir_exe.AppendASCII("../../.."); |
| 54 #endif | 54 #endif |
| 55 base::FilePath dev_tools_path; |
| 55 bool is_debug_dev_tools = base::CommandLine::ForCurrentProcess()->HasSwitch( | 56 bool is_debug_dev_tools = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 56 switches::kDebugDevTools); | 57 switches::kDebugDevTools); |
| 57 std::string folder = is_debug_dev_tools ? "debug/" : ""; | 58 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 58 base::FilePath dev_tools_path = | 59 switches::kCustomDevToolsFrontend)) { |
| 59 dir_exe.AppendASCII("resources/inspector/" + folder + "inspector.html"); | 60 dev_tools_path = base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 61 switches::kCustomDevToolsFrontend); |
| 62 } else { |
| 63 std::string folder = is_debug_dev_tools ? "debug/" : ""; |
| 64 dev_tools_path = dir_exe.AppendASCII("resources/inspector/" + folder); |
| 65 } |
| 60 | 66 |
| 61 GURL result = net::FilePathToFileURL(dev_tools_path); | 67 GURL result = |
| 68 net::FilePathToFileURL(dev_tools_path.AppendASCII("inspector.html")); |
| 62 std::string url_string = | 69 std::string url_string = |
| 63 base::StringPrintf("%s?experiments=true", result.spec().c_str()); | 70 base::StringPrintf("%s?experiments=true", result.spec().c_str()); |
| 64 if (is_debug_dev_tools) | 71 if (is_debug_dev_tools) |
| 65 url_string += "&debugFrontend=true"; | 72 url_string += "&debugFrontend=true"; |
| 66 return GURL(url_string); | 73 return GURL(url_string); |
| 67 } | 74 } |
| 68 | 75 |
| 69 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, | 76 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, |
| 70 const std::string frontend_url) { | 77 const std::string frontend_url) { |
| 71 DisconnectFromTarget(); | 78 DisconnectFromTarget(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 base::TerminationStatus status) { | 138 base::TerminationStatus status) { |
| 132 BlinkTestController::Get()->DevToolsProcessCrashed(); | 139 BlinkTestController::Get()->DevToolsProcessCrashed(); |
| 133 } | 140 } |
| 134 | 141 |
| 135 void LayoutTestDevToolsFrontend::RenderFrameCreated( | 142 void LayoutTestDevToolsFrontend::RenderFrameCreated( |
| 136 RenderFrameHost* render_frame_host) { | 143 RenderFrameHost* render_frame_host) { |
| 137 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); | 144 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); |
| 138 } | 145 } |
| 139 | 146 |
| 140 } // namespace content | 147 } // namespace content |
| OLD | NEW |