| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 GURL result = | 67 GURL result = |
| 68 net::FilePathToFileURL(dev_tools_path.AppendASCII("inspector.html")); | 68 net::FilePathToFileURL(dev_tools_path.AppendASCII("inspector.html")); |
| 69 std::string url_string = | 69 std::string url_string = |
| 70 base::StringPrintf("%s?experiments=true", result.spec().c_str()); | 70 base::StringPrintf("%s?experiments=true", result.spec().c_str()); |
| 71 if (is_debug_dev_tools) | 71 if (is_debug_dev_tools) |
| 72 url_string += "&debugFrontend=true"; | 72 url_string += "&debugFrontend=true"; |
| 73 return GURL(url_string); | 73 return GURL(url_string); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // static. |
| 77 GURL LayoutTestDevToolsFrontend::MapJSTestURL(const GURL& test_url) { |
| 78 std::string test_url_spec = test_url.spec(); |
| 79 std::string inspector_unit_path = "/inspector-unit/"; |
| 80 if (test_url_spec.find(inspector_unit_path) == std::string::npos) |
| 81 return test_url; |
| 82 std::string test_path = test_url_spec.substr( |
| 83 test_url_spec.find(inspector_unit_path) + inspector_unit_path.length()); |
| 84 return test_url.Resolve( |
| 85 "/inspector-unit/inspector-unit-test-shell.html?test=" + test_path); |
| 86 } |
| 87 |
| 76 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, | 88 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, |
| 77 const std::string frontend_url) { | 89 const std::string frontend_url) { |
| 78 DisconnectFromTarget(); | 90 DisconnectFromTarget(); |
| 79 SetPreferences(settings); | 91 SetPreferences(settings); |
| 80 ready_for_test_ = false; | 92 ready_for_test_ = false; |
| 81 pending_evaluations_.clear(); | 93 pending_evaluations_.clear(); |
| 82 frontend_shell()->LoadURL(GetDevToolsPathAsURL(frontend_url)); | 94 frontend_shell()->LoadURL(GetDevToolsPathAsURL(frontend_url)); |
| 83 } | 95 } |
| 84 | 96 |
| 85 void LayoutTestDevToolsFrontend::EvaluateInFrontend( | 97 void LayoutTestDevToolsFrontend::EvaluateInFrontend( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 base::TerminationStatus status) { | 150 base::TerminationStatus status) { |
| 139 BlinkTestController::Get()->DevToolsProcessCrashed(); | 151 BlinkTestController::Get()->DevToolsProcessCrashed(); |
| 140 } | 152 } |
| 141 | 153 |
| 142 void LayoutTestDevToolsFrontend::RenderFrameCreated( | 154 void LayoutTestDevToolsFrontend::RenderFrameCreated( |
| 143 RenderFrameHost* render_frame_host) { | 155 RenderFrameHost* render_frame_host) { |
| 144 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); | 156 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); |
| 145 } | 157 } |
| 146 | 158 |
| 147 } // namespace content | 159 } // namespace content |
| OLD | NEW |