| 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/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #if defined(OS_MACOSX) | 46 #if defined(OS_MACOSX) |
| 47 // On Mac, the executable is in | 47 // On Mac, the executable is in |
| 48 // out/Release/Content Shell.app/Contents/MacOS/Content Shell. | 48 // out/Release/Content Shell.app/Contents/MacOS/Content Shell. |
| 49 // We need to go up 3 directories to get to out/Release. | 49 // We need to go up 3 directories to get to out/Release. |
| 50 dir_exe = dir_exe.AppendASCII("../../.."); | 50 dir_exe = dir_exe.AppendASCII("../../.."); |
| 51 #endif | 51 #endif |
| 52 base::FilePath dev_tools_path = | 52 base::FilePath dev_tools_path = |
| 53 dir_exe.AppendASCII("resources/inspector/inspector.html"); | 53 dir_exe.AppendASCII("resources/inspector/inspector.html"); |
| 54 | 54 |
| 55 GURL result = net::FilePathToFileURL(dev_tools_path); | 55 GURL result = net::FilePathToFileURL(dev_tools_path); |
| 56 std::string url_string = |
| 57 base::StringPrintf("%s?experiments=true", result.spec().c_str()); |
| 58 #if defined(DEBUG_DEVTOOLS) |
| 59 url_string += "&debugFrontend=true"; |
| 60 #endif // defined(DEBUG_DEVTOOLS) |
| 56 if (!settings.empty()) | 61 if (!settings.empty()) |
| 57 result = GURL(base::StringPrintf("%s?settings=%s&experiments=true", | 62 url_string += "&settings=" + settings; |
| 58 result.spec().c_str(), | 63 return GURL(url_string); |
| 59 settings.c_str())); | |
| 60 return result; | |
| 61 } | 64 } |
| 62 | 65 |
| 63 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, | 66 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, |
| 64 const std::string frontend_url) { | 67 const std::string frontend_url) { |
| 65 DisconnectFromTarget(); | 68 DisconnectFromTarget(); |
| 66 preferences()->Clear(); | 69 preferences()->Clear(); |
| 67 frontend_shell()->LoadURL(GetDevToolsPathAsURL(settings, frontend_url)); | 70 frontend_shell()->LoadURL(GetDevToolsPathAsURL(settings, frontend_url)); |
| 68 } | 71 } |
| 69 | 72 |
| 70 LayoutTestDevToolsFrontend::LayoutTestDevToolsFrontend( | 73 LayoutTestDevToolsFrontend::LayoutTestDevToolsFrontend( |
| 71 Shell* frontend_shell, | 74 Shell* frontend_shell, |
| 72 WebContents* inspected_contents) | 75 WebContents* inspected_contents) |
| 73 : ShellDevToolsFrontend(frontend_shell, inspected_contents) { | 76 : ShellDevToolsFrontend(frontend_shell, inspected_contents) { |
| 74 } | 77 } |
| 75 | 78 |
| 76 LayoutTestDevToolsFrontend::~LayoutTestDevToolsFrontend() { | 79 LayoutTestDevToolsFrontend::~LayoutTestDevToolsFrontend() { |
| 77 } | 80 } |
| 78 | 81 |
| 79 void LayoutTestDevToolsFrontend::AgentHostClosed( | 82 void LayoutTestDevToolsFrontend::AgentHostClosed( |
| 80 DevToolsAgentHost* agent_host, bool replaced) { | 83 DevToolsAgentHost* agent_host, bool replaced) { |
| 81 // Do not close the front-end shell. | 84 // Do not close the front-end shell. |
| 82 } | 85 } |
| 83 | 86 |
| 84 void LayoutTestDevToolsFrontend::RenderProcessGone( | 87 void LayoutTestDevToolsFrontend::RenderProcessGone( |
| 85 base::TerminationStatus status) { | 88 base::TerminationStatus status) { |
| 86 BlinkTestController::Get()->DevToolsProcessCrashed(); | 89 BlinkTestController::Get()->DevToolsProcessCrashed(); |
| 87 } | 90 } |
| 88 | 91 |
| 89 } // namespace content | 92 } // namespace content |
| OLD | NEW |